Vmgen interpreter generator

Vmgen supports the construction of interpretive systems by generating the code for executing and dealing with virtual machine (VM) instructions from simple descriptions of the VM instructions.

Vmgen generates code for executing VM instructions (with optional tracing), for generating VM code, for disassembling VM code, and for profiling VM instruction sequences. A VM instruction description looks like this:

add  ( i1 i2 -- i )
i = i1+i2;

Vmgen supports several techniques for writing efficient interpreters: virtual machine interpreters, threaded code, combining VM instructions into superinstructions, keeping the top-of-stack in a register, scheduling the dispatch of the next VM instruction, and a couple of minor optimizations. Interpreters created with vmgen usually are faster than competing interpreters and are typically only a factor of 2-10 slower than the code generateed by native-code compilers.

Vmgen has special support for stack-based VMs (but it can also be used to advantage when implementing a register-based VM).

Vmgen is currently distributed with Gforth (because it needs Gforth to run, and Gforth needs it to build), and is installed together with Gforth (read INSTALL for instructions).

Note that future versions of vmgen may require small changes in programs written for the present version (e.g., requiring a few additional macro definitions).

Vmgen applications

Gforth
a fast implementation of Forth.
Unladen Swallow
a faster implementation of Python, uses Vmgen at least in its first release. They have plans for replacing the Vmgen-based interpreter with a LLVM-based JIT compiler, but if you write a new programming language implementation, it may be a good idea to follow their approach: Build an interpreter with Vmgen first to get something out the door, and reserve more ambitious approaches for later.
Cacao Interpreter
Cacao is a Java VM with a JIT compiler for a number of targets, but also with a Vmgen-based interpreter.

Links

[ICO]NameLast modifiedSizeDescription

[DIR]Parent Directory  -  
[DIR]Old/09-Mar-2003 23:02 -  
[   ]NEWS.vmgen09-Mar-2003 23:12 1.3KChanges from earlier versions
[   ]vmgen-0.6.1.ps.gz24-Mar-2003 18:08 106KManual (for letter and A4 paper)

Apache/2.2.22 (Debian) DAV/2 mod_fcgid/2.3.6 PHP/5.4.36-0+deb7u3 mod_python/3.3.1 Python/2.7.3 mod_ssl/2.2.22 OpenSSL/1.0.1e mod_perl/2.0.7 Perl/v5.14.2 Server at www.complang.tuwien.ac.at Port 443