Browse Source

Add: support LoadKX

Akeit0 7 months ago
parent
commit
d031777484
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/Lua/Runtime/LuaVirtualMachine.cs

+ 3 - 0
src/Lua/Runtime/LuaVirtualMachine.cs

@@ -347,6 +347,9 @@ public static partial class LuaVirtualMachine
                     case OpCode.LoadK:
                     case OpCode.LoadK:
                         stack.GetWithNotifyTop(iA + frameBase) = Unsafe.Add(ref constHead, instruction.Bx);
                         stack.GetWithNotifyTop(iA + frameBase) = Unsafe.Add(ref constHead, instruction.Bx);
                         continue;
                         continue;
+                    case OpCode.LoadKX:
+                        stack.GetWithNotifyTop(iA + frameBase) = Unsafe.Add(ref constHead, Unsafe.Add(ref instructionsHead, ++context.Pc).Ax);
+                        continue;
                     case OpCode.LoadBool:
                     case OpCode.LoadBool:
                         stack.GetWithNotifyTop(iA + frameBase) = instruction.B != 0;
                         stack.GetWithNotifyTop(iA + frameBase) = instruction.B != 0;
                         if (instruction.C != 0) context.Pc++;
                         if (instruction.C != 0) context.Pc++;