瀏覽代碼

fix script.dump closure bug

Bug
Since NumVal of closure of bytecode output by ScriptDump is absolute address, when using LoadStream, it jumps to an invalid address.

Fix
Since the Closure value field is an address value, it has been changed to NumValAsCodeAddress so that relocation is possible.
otoroshi 8 年之前
父節點
當前提交
ec7ccd8b09
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/MoonSharp.Interpreter/Execution/InstructionFieldUsage.cs

+ 1 - 1
src/MoonSharp.Interpreter/Execution/InstructionFieldUsage.cs

@@ -82,7 +82,7 @@ namespace MoonSharp.Interpreter.Execution
 				case OpCode.BeginFn:
 				case OpCode.BeginFn:
 					return InstructionFieldUsage.SymbolList | InstructionFieldUsage.NumVal | InstructionFieldUsage.NumVal2;
 					return InstructionFieldUsage.SymbolList | InstructionFieldUsage.NumVal | InstructionFieldUsage.NumVal2;
 				case OpCode.Closure:
 				case OpCode.Closure:
-					return InstructionFieldUsage.SymbolList | InstructionFieldUsage.NumVal;
+					return InstructionFieldUsage.SymbolList | InstructionFieldUsage.NumValAsCodeAddress;
 				case OpCode.Nop:
 				case OpCode.Nop:
 				case OpCode.Debug:
 				case OpCode.Debug:
 				case OpCode.Invalid:
 				case OpCode.Invalid: