694 B
694 B
Developer Notes
This project splits VM opcode handlers into one-include-per-op file for readability.
The main interpreter loop (src/vm.c, vm_run) includes vm_case_*.inc files,
each containing a single case OP_*: { ... } handler.
Adding a new opcode
- Add the enum in
src/bytecode.h(e.g.,OP_FOO) and add its human-readable name toopcode_names[]insrc/vm.h. Updateopcode_is_validupper bound if needed. - Implement the VM handler in
src/vm_case_foo.incusing the established style:- No function wrappers, just
case OP_FOO: { ... break; }.
- No function wrappers, just
- Include the new file in the switch inside
src/vm.c(vm_run), near similar ops. - Run the checker script: