Skip to content

parrt/simple-virtual-machine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 with invokingContext 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.

About

A simple VM for a talk on building VMs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages