[virtmach] New vmgen release

Anton Ertl anton@mips.complang.tuwien.ac.at
Sat, 24 Aug 2002 09:47:30 +0200 (MET DST)

Vmgen (gforth) 0.5.9-20020822 is now available at


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.

This file is about Vmgen-specific issues.  Issues affecting both
Gforth and Vmgen (e.g., platform compatibility) are discussed in

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).


There is now a manual (in info, HTML, Postscript, or plain text format).

There is the vmgen-ex2 variant of the vmgen-ex example; the new
variant uses a union type instead of lots of casting.

Both variants of the example can now be compiled with an ANSI C
compiler (using switch dispatch and losing quite a bit of
performance); tested with lcc.

There are several changes in the way you have to define macros (see
node/section "Changes" in the manual).  I recommend keeping the
gforth-0.5.9-20010501 version until you have completed the changes
(note that you can have several versions of Gforth installed at the
same time).


This release has only been tested on Linux-Intel.  Portability work is
planned for the next release.

The Gforth version that comes with this release is probably less
portable than the one in the 0.5.9-20010501 release or gforth-0.5.0.
If you have problems in this respect, you can use Vmgen with these
earlier Gforth versions with a little work (just edit the definition
of GFORTH in the script "vmgen").  You can have several versions of
Vmgen/Gforth installed at the same time.

- anton