Browse Source

Optimize: VM self operation fast path

Akeit0 11 months ago
parent
commit
05718bcb04
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/Lua/Runtime/LuaVirtualMachine.cs

+ 2 - 2
src/Lua/Runtime/LuaVirtualMachine.cs

@@ -424,8 +424,8 @@ public static partial class LuaVirtualMachine
                         vc = ref RKC(ref stackHead, ref constHead, instruction);
                         table = Unsafe.Add(ref stackHead, instruction.UIntB);
 
-
-                        if (GetTableValueSlowPath(table, vc, ref context, out resultValue, out doRestart))
+                        doRestart = false;
+                        if ((table.TryReadTable(out luaTable) && luaTable.TryGetValue(vc, out resultValue)) || GetTableValueSlowPath(table, vc, ref context, out resultValue, out doRestart))
                         {
                             if (doRestart) goto Restart;
                             Unsafe.Add(ref stackHead, iA) = resultValue;