aboutsummaryrefslogtreecommitdiff
path: root/vm/runtime.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm/runtime.c')
-rw-r--r--vm/runtime.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/vm/runtime.c b/vm/runtime.c
index 622228f..0fbea05 100644
--- a/vm/runtime.c
+++ b/vm/runtime.c
@@ -326,11 +326,22 @@ void vm_load_registers(vm_t *vm, registers_t registers)
vm->registers = registers;
}
+void vm_load_heap(vm_t *vm, heap_t heap)
+{
+ vm->heap = heap;
+}
+
void vm_stop(vm_t *vm)
{
free(vm->registers.data);
free(vm->program.instructions);
free(vm->stack.data);
+ heap_stop(&vm->heap);
+
+ vm->registers = (registers_t){0};
+ vm->program = (struct Program){0};
+ vm->stack = (struct Stack){0};
+ vm->heap = (heap_t){0};
}
void vm_print_registers(vm_t *vm, FILE *fp)