fix vm returning without doing gc reset

This commit is contained in:
Lobo 2026-01-21 11:47:34 -03:00
parent f76c4f9af9
commit fd8c7e7cc5

View file

@ -223,7 +223,7 @@ I vm_run(Vm *vm, Bc *chunk, I offset) {
vm_rpush(vm, vm->chunk, vm->ip); vm_rpush(vm, vm->chunk, vm->ip);
vm->ip = chunk->items + ofs; vm->ip = chunk->items + ofs;
break; break;
} }
case OP_DOWORD: { case OP_DOWORD: {
I hash = decode_sleb128(&vm->ip); I hash = decode_sleb128(&vm->ip);
Dt *word = lookup_hash(&vm->dictionary, hash); Dt *word = lookup_hash(&vm->dictionary, hash);
@ -279,7 +279,7 @@ I vm_run(Vm *vm, Bc *chunk, I offset) {
vm->chunk = frame.chunk; vm->chunk = frame.chunk;
vm->ip = frame.ip; vm->ip = frame.ip;
} else { } else {
return 1; goto done;
} }
break; break;
case OP_CHOOSE: { case OP_CHOOSE: {
@ -324,5 +324,7 @@ I vm_run(Vm *vm, Bc *chunk, I offset) {
vm_error(vm, VM_ERR_RUNTIME, "unknown opcode"); vm_error(vm, VM_ERR_RUNTIME, "unknown opcode");
} }
} }
done:
gc_reset(&vm->gc, mark);
return 1; return 1;
} }