From ab7d7c155fb1bec5eed8f97462fbb656ea27dbb5 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Fri, 22 Oct 2021 11:24:09 +0200 Subject: Add VM structure and fix AdressSanitizer bugs --- src/bytecode/vm.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/bytecode/vm.h (limited to 'src/bytecode/vm.h') diff --git a/src/bytecode/vm.h b/src/bytecode/vm.h new file mode 100644 index 0000000..36547cb --- /dev/null +++ b/src/bytecode/vm.h @@ -0,0 +1,27 @@ +#ifndef BDL_VM_H +#define BDL_VM_H + +#include "types.h" +#include "chunk.h" + +typedef struct VM { + Chunk *chunk; +} VM; + +VM vm_init(void); +void vm_free(VM vm); + +VM +vm_init(void) { + VM vm = { + .chunk = chunk_init(), + }; + return vm; +} + +void +vm_free(VM vm) { + chunk_free(vm.chunk); +} + +#endif // BDL_VM_H -- cgit v1.2.1