(vm *VM)
| 22 | } |
| 23 | |
| 24 | func opJumpIf(vm *VM) { |
| 25 | offset := int64(vm.popInt()) |
| 26 | cond := vm.popBool() |
| 27 | if !cond { |
| 28 | return |
| 29 | } |
| 30 | dest, ok := checked.AddInt64(vm.run.pc, offset) |
| 31 | if !ok { |
| 32 | panic(errors.Wrap(ErrIntOverflow, "computing jump destination")) |
| 33 | } |
| 34 | if dest < 0 || dest > int64(len(vm.run.prog)) { |
| 35 | panic(errors.WithData(ErrJump, "destination", dest, "len(prog)", len(vm.run.prog))) |
| 36 | } |
| 37 | vm.run.pc = dest |
| 38 | } |
| 39 | |
| 40 | func opExec(vm *VM) { |
| 41 | prog := vm.popBytes() |