https://github.com/parrt/simple-virtual-machine
A simple VM for a talk on building VMs
https://github.com/parrt/simple-virtual-machine
Last synced: 4 months ago
JSON representation
A simple VM for a talk on building VMs
- Host: GitHub
- URL: https://github.com/parrt/simple-virtual-machine
- Owner: parrt
- License: bsd-3-clause
- Created: 2014-05-10T01:22:48.000Z (almost 12 years ago)
- Default Branch: shatter-stack
- Last Pushed: 2017-04-07T19:45:59.000Z (almost 9 years ago)
- Last Synced: 2025-04-07T22:13:02.951Z (11 months ago)
- Language: Java
- Size: 39.1 KB
- Stars: 218
- Watchers: 16
- Forks: 60
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
simple-virtual-machine
======================
A simple VM for a talk on building VMs in Java. See [video](https://www.youtube.com/watch?v=OjaAToVkoTw) and [slides](http://www.slideshare.net/parrt/how-to-build-a-virtual-machine).
There are multiple branches:
* [master](https://github.com/parrt/simple-virtual-machine). Basic instructions only (no function calls).
* [add-functions](https://github.com/parrt/simple-virtual-machine/tree/add-functions). Includes CALL/RET instructions, runs factorial test function.
* [split-stack](https://github.com/parrt/simple-virtual-machine/tree/split-stack). Split into operand stack and function call stack.
* [func-meta-info](https://github.com/parrt/simple-virtual-machine/tree/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](https://github.com/parrt/simple-virtual-machine/tree/shatter-stack). Broke apart the `Context[]` stack into a linked-list with `invokingContext` as parent pointer to caller. added call stack for trace.
See also a [C version derived from split-stack](https://github.com/parrt/simple-virtual-machine-C). Parts derived from [codyebberson's C implementation](https://github.com/codyebberson/vm).