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
+18
View File
@@ -0,0 +1,18 @@
#include <vm/fzl_vm.h>
#include <vm/internals/opcode.h>
int op_not(fzl_vm_t *vm)
{
if (vm->dtop < 1)
{
snprintf(last_err, sizeof(last_err),
"runtime error - expected value in data stack");
print_err_data(vm);
return -1;
}
fzl_value_t notval = vm->dstack[--vm->dtop];
vm->dstack[vm->dtop++] =
(fzl_value_t){.type = FZL_TYPE_BOOL, .as.b = !notval.as.b};
return 0;
}