feat: optimize VM using dispatch table
This commit is contained in:
+5
-1
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user