Skip to content

Commit 930ae2d

Browse files
authored
Increase size of continuation PC (#109)
Prevents a panic on executing large chunks
1 parent 38aca5e commit 930ae2d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

runtime/luacont.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type LuaCont struct {
1414
*Closure
1515
registers []Value
1616
cells []Cell
17-
pc int16
17+
pc int32
1818
acc []Value
1919
running bool
2020
borrowedCells bool
@@ -358,12 +358,12 @@ RunLoop:
358358
case code.Type5Pfx:
359359
switch opcode.GetJ() {
360360
case code.OpJump:
361-
pc += int16(opcode.GetOffset())
361+
pc += int32(opcode.GetOffset())
362362
continue RunLoop
363363
case code.OpJumpIf:
364364
test := Truth(getReg(regs, cells, opcode.GetA()))
365365
if test == opcode.GetF() {
366-
pc += int16(opcode.GetOffset())
366+
pc += int32(opcode.GetOffset())
367367
} else {
368368
pc++
369369
}

0 commit comments

Comments
 (0)