simple-virtual-machine
A simple VM for a talk on building VMs in Java. See video and slides.
There are multiple branches:
- master. Basic instructions only (no function calls).
- add-functions. Includes CALL/RET instructions, runs factorial test function.
- split-stack. Split into operand stack and function call stack.
- func-meta-info. CALL bytecode instruction takes an index into a metadata table for functions rather than an address and the number of arguments. This makes it much easier for bytecode compiler to generate code because it doesn't need to worry about forward references. This branch also properly allocates space for local variables.
- shatter-stack. Broke apart the
Context[]
stack into a linked-list withinvokingContext
as parent pointer to caller. added call stack for trace.
See also a C version derived from split-stack. Parts derived from codyebberson's C implementation.