From 930ae2da46c34b28da077eef900100f7404e3afb Mon Sep 17 00:00:00 2001 From: Arnaud Delobelle Date: Sun, 15 Dec 2024 20:56:06 +0000 Subject: [PATCH] Increase size of continuation PC (#109) Prevents a panic on executing large chunks --- runtime/luacont.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/luacont.go b/runtime/luacont.go index 2110716c..1edb1b91 100644 --- a/runtime/luacont.go +++ b/runtime/luacont.go @@ -14,7 +14,7 @@ type LuaCont struct { *Closure registers []Value cells []Cell - pc int16 + pc int32 acc []Value running bool borrowedCells bool @@ -358,12 +358,12 @@ RunLoop: case code.Type5Pfx: switch opcode.GetJ() { case code.OpJump: - pc += int16(opcode.GetOffset()) + pc += int32(opcode.GetOffset()) continue RunLoop case code.OpJumpIf: test := Truth(getReg(regs, cells, opcode.GetA())) if test == opcode.GetF() { - pc += int16(opcode.GetOffset()) + pc += int32(opcode.GetOffset()) } else { pc++ }