feat: optimize VM using dispatch table

This commit is contained in:
samsonium
2026-10-29 02:59:38 +03:00
parent e2de23ed57
commit f4c97795fa
18 changed files with 1240 additions and 938 deletions
+5 -1
View File
@@ -3,6 +3,7 @@
#include <common/fzl_value.h>
#include <compiler/utils/fzl_const_pool.h> // NOTE: move outside compiler scope to common
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <vm/fzl_vm_env.h>
@@ -23,6 +24,9 @@ typedef struct
size_t ip;
bool allow_infinite;
size_t max_iter;
// Data stack
fzl_value_t dstack[256];
size_t dtop;
@@ -40,7 +44,7 @@ typedef struct
fzl_vm_t *fzl_mkvm(const char *filepath);
// Load and run code
int fzl_vm_run(fzl_vm_t *vm, bool allow_infinite, uint64_t max_iter);
int fzl_vm_run(fzl_vm_t *vm);
// Get last VM error message
char *fzl_vm_geterror();