The Rusalka Virtual Machine. Perhaps one day it will be aptly named.
C++ Ruby Lua Assembly
Latest commit 6fbfd2a Dec 15, 2014 @nilium Move attribute def to the top.
Failed to load latest commit information.
.gitignore Add .gitignore May 26, 2014
Doxyfile Add basic Doxyfile. Dec 6, 2014
LICENSE_1_0.txt Relicense under Boost Software License v1. Jun 8, 2014
README.adoc Move attribute def to the top. Dec 15, 2014
_types.h Document vm_find_result. Dec 5, 2014
asm2bc attr_*s -- one line per attribute. Oct 30, 2014
build-aux.lua Tweak build script a bit. Sep 25, 2014
bytecode.adoc Use asciidoc for document. Dec 15, 2014
colors.rb Extend self for colors. Oct 28, 2014
hash.cpp Remove constexpr use in hash functions. Oct 7, 2014
hash.h Add snow-hash functions to Rusalka. Oct 4, 2014
lexer.cpp Use switch single-character punctuation that starts idents. Nov 1, 2014
lexer.h Default values for line/column member variables. Nov 1, 2014
lexer.rb Relicense under Boost Software License v1. Jun 8, 2014
premake4.lua Add a quick test file for vm_value. Dec 4, 2014
test.asm Update test.asm again. Jun 8, 2014
value_test.cpp Add a quick test file for vm_value. Dec 4, 2014
vm_exception.h Reorganize exceptions header. Nov 11, 2014
vm_function.cpp Add missing license headers. Sep 7, 2014
vm_function.h Document vm_function.h Nov 13, 2014
vm_instructions.h Remove call frame instructions. Aug 25, 2014
vm_op.cpp Three line breaks between non-inline methods. Oct 23, 2014
vm_opcode.cpp Three line breaks between non-inline methods. Oct 23, 2014
vm_opcode.h Comment for OP_COUNT. Dec 12, 2014
vm_state.cpp Strip out unneeded includes. Move one to implementation. Oct 25, 2014
vm_state.h Remove stack_t type. Dec 2, 2014
vm_test.cpp Add argument logging to imported prints function. Sep 22, 2014
vm_thread.cpp Basic doc comments for most of vm_thread.cpp. Oct 27, 2014
vm_thread.h Quick doc comment for vm_invoke_function. Dec 12, 2014
vm_unit+chunk_offsets.inl Document vm_chunk_offsets member functions. Nov 26, 2014
vm_unit+chunk_types.inl Document chunk_types.inl types Nov 26, 2014
vm_unit+io.inl Document unit IO functions. Nov 28, 2014
vm_unit.h Document some of vm_unit's member functions. Dec 10, 2014
vm_value.cpp Three line breaks between non-inline methods. Oct 23, 2014
vm_value.h Document make_value. Nov 30, 2014


Rusalka Virtual Machine

The Rusalka VM is a small personal project of mine to implement a fairly simple register-based process virtual machine.

Rusalka is implemented in C++11. Currently, it supports

  • Executing a limited instruction set

  • Loading and executing Rusalka bytecode [1]

  • Importing host functions into the VM

  • Exporting VM functions as callable C++ objects

  • Working with typed values [2]

  • Keeping concurrent threads of execution per VM process [3]

Once the Rusalka language is fleshed out and implemented on top of the Rusalka VM, there will likely be more to say about what it does and does not support, but for now it’s a fairly bare-bones virtual machine. The upside is that it’s fairly easy to produce bytecode for or to compile to Rusalka assembly.

In all likelihood, Rusalka assembly will be abandoned as a core part of the VM, as it’s only in there for testing at the moment and building an assembler into the VM probably isn’t a great use of resources.

Finally, if you want to read a lot of very dry writing about Rusalka’s design and implementation, see my blog post over on Spifftastic: [4]


If you want to contribute to Rusalka’s development, it’s simplest to create a patch and submit it via a pull request on Rusalka’s GitHub repository. Please include a decent explanation of your changes to help folks read them (i.e., walk me through why you made the change, what it does, etc.).


The Rusalka VM is licensed under the Boost Software License, Version 1.0. The license can be read in full in the accompanying LICENSE_1_0.txt file or at

1. Assembled via asm2bc.
2. Specifically uint64_t, int64_t, and double.
3. Not yet thread-safe for the host process.
4. One large difference between the blog post and the current state of Rusalka is that values are no longer strictly 64-bit floats, but are typed as integers, floats, and other data types depending on the value and the result type of an instruction.