diff options
author | Bad Diode <bd@badd10de.dev> | 2021-10-22 11:24:09 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2021-10-22 11:24:09 +0200 |
commit | ab7d7c155fb1bec5eed8f97462fbb656ea27dbb5 (patch) | |
tree | c0ab41a9078a67aa1fa9aa25a69942329200ea32 /src/bytecode/vm.h | |
parent | f4113cbcdc192b23f9b6e5e14b0a3e4afac35272 (diff) | |
download | bdl-ab7d7c155fb1bec5eed8f97462fbb656ea27dbb5.tar.gz bdl-ab7d7c155fb1bec5eed8f97462fbb656ea27dbb5.zip |
Add VM structure and fix AdressSanitizer bugs
Diffstat (limited to 'src/bytecode/vm.h')
-rw-r--r-- | src/bytecode/vm.h | 27 |
1 files changed, 27 insertions, 0 deletions
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 @@ | |||
1 | #ifndef BDL_VM_H | ||
2 | #define BDL_VM_H | ||
3 | |||
4 | #include "types.h" | ||
5 | #include "chunk.h" | ||
6 | |||
7 | typedef struct VM { | ||
8 | Chunk *chunk; | ||
9 | } VM; | ||
10 | |||
11 | VM vm_init(void); | ||
12 | void vm_free(VM vm); | ||
13 | |||
14 | VM | ||
15 | vm_init(void) { | ||
16 | VM vm = { | ||
17 | .chunk = chunk_init(), | ||
18 | }; | ||
19 | return vm; | ||
20 | } | ||
21 | |||
22 | void | ||
23 | vm_free(VM vm) { | ||
24 | chunk_free(vm.chunk); | ||
25 | } | ||
26 | |||
27 | #endif // BDL_VM_H | ||