StackJIT
StackJIT copied to clipboard
Simple virtual machine for a stack-based assembler language.
StackJIT
Simple multi-platform virtual machine for a stack-based assembler language.
Features
- Supports both Linux and Windows.
- Baseline JIT compiler (no optimizations).
- Supports arrays, classes.
- Compacting generational garbage collector.
- Supports lazy JIT compilation.
- Can easily be embedded.
- No external dependencies.
Running
To run the VM, supply a program via stdin:
./stackjit < programs/basic/program.txt
Options
-dor--debug: Enables debugging.-ogcor--output-generated-code: Outputs the generated machine code. The output can be viewed using objdump:objdump -D -M intel -b binary -mi386 -Mx86-64 <file name>.-tor--test: Enables test mode, which loads test related libraries.-ngcor--no-gc: Disables garbage collection. The GC can still be used by calling the runtime function.-i <library file>: Loads a library.
Supported platforms
- Linux x64
- Windows x64
Build
Linux
Requirments:
- C++11 compiler.
- CxxTest for tests.
To build:
make all
To run tests:
make test
Windows
Requirements:
- Visual Studio 2015.
- CMake.
- CxxTest for tests.
The following command installs CxxTest:
git clone -q --branch=master https://github.com/svenslaggare/CxxTest.git C:\CXXTest
set PATH=%PATH%;C:\CXXTest\bin
To create the solution file run:
mkdir Windows
cd Windows
cmake -G "Visual Studio 14 2015 Win64" ..\
Documentation
See the documentation folder.