Skip to content

Commit

Permalink
Increase size of continuation PC (#109)
Browse files Browse the repository at this point in the history
Prevents a panic on executing large chunks
  • Loading branch information
arnodel authored Dec 15, 2024
1 parent 38aca5e commit 930ae2d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions runtime/luacont.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type LuaCont struct {
*Closure
registers []Value
cells []Cell
pc int16
pc int32
acc []Value
running bool
borrowedCells bool
Expand Down Expand Up @@ -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++
}
Expand Down

0 comments on commit 930ae2d

Please sign in to comment.