Prechádzať zdrojové kódy

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 rokov pred
rodič
commit
ec7ccd8b09

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

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