aboutsummaryrefslogtreecommitdiffstats
path: root/src/bytecode/vm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bytecode/vm.h')
-rwxr-xr-xsrc/bytecode/vm.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/bytecode/vm.h b/src/bytecode/vm.h
index 15a6b86..3c99131 100755
--- a/src/bytecode/vm.h
+++ b/src/bytecode/vm.h
@@ -175,8 +175,11 @@ vm_interpret(VM *vm) {
175 u8 instruction = *vm->pc++; 175 u8 instruction = *vm->pc++;
176 switch (instruction) { 176 switch (instruction) {
177 case OP_LOCAL: { 177 case OP_LOCAL: {
178 u8 local = *vm->pc++; 178 ssize_t idx = AS_FIXNUM(array_pop(vm->stack));
179 array_push(vm->stack, vm->stack[frame->stack_offset + local]); 179 ssize_t depth = AS_FIXNUM(array_pop(vm->stack));
180 CallFrame frame = vm->frames[depth];
181 array_push(vm->stack, vm->stack[frame.stack_offset + idx]);
182
180 } break; 183 } break;
181 case OP_CONSTANT: { 184 case OP_CONSTANT: {
182 u8 constant = *vm->pc++; 185 u8 constant = *vm->pc++;