File:  [gforth] / gforth / README.vmgen
Revision 1.1: download - view: text, annotated - select for diffs
Tue May 1 13:35:41 2001 UTC (20 years, 5 months ago) by anton
Branches: MAIN
CVS tags: HEAD
vmgen-related changes in Makefile
fixed FORTHB/prims2x breakage
removed lit_plus
added peeprules.vmg as a place to put superinstructions
testdist now also tests vmgen-ex

Vmgen generates much of the code for efficient virtual machine (VM)
interpreters from a simple descriptions of the VM instructions.  It
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

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

The main shortcoming in the current release is the lack of a user
manual; however, there is a paper describing vmgen's operation (at, and there is a simple,
working and somewhat commented example of using vmgen (in directory

If you have bugs to report, suggestions to make, questions, or any
other feedback, mail me (

You can find vmgen at

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 will probably require small changes
in programs written for the present version (e.g., requiring a few
additional macro definitions).

FreeBSD-CVSweb <>