systems · sub-star
neon_vm
stack-based virtual machine executing packed bytecode.
readme
A lightweight virtual machine in native C that executes densely packed binary opcodes through a stack-based pipeline, emulating the architecture behind runtimes like the JVM and LuaJIT. Written to understand instruction dispatch and how a compiler target actually consumes bytecode.
artifact
stack
out:
simulated dispatch loop: bytecode steps, the stack pushes and pops.
signal log
- stack-based execution loop that decodes instructions and manipulates a virtual stack.
- bytecode chunking: data structures for storing and decoding densely packed opcodes and their constants.
- written in native C to keep dispatch overhead minimal.
- bytecode is treated as untrusted input: every step checks stack overflow and underflow, constant indices, truncated operands, and running off the end without a return.
- single-step dispatch (vmStep) drives both the CLI and a browser debugger that shows the instruction pointer, stack and constant pool after each instruction.
- scoped deliberately small: six opcodes, one value type, no control flow and no compiler in front of it. bytecode is hand-assembled to isolate the dispatch loop itself.
built with
CWebAssembly