Warning: This is the manual of the legacy Guile 2.0 series. You may want to read the manual of the current stable series instead.

Next: , Previous: , Up: A Virtual Machine for Guile   [Contents][Index]

9.3.2 VM Concepts

Compiled code is run by a virtual machine (VM). Each thread has its own VM. When a compiled procedure is run, Guile looks up the virtual machine for the current thread and executes the procedure using that VM.

Guile’s virtual machine is a stack machine—that is, it has few registers, and the instructions defined in the VM operate by pushing and popping values from a stack.

Stack memory is exclusive to the virtual machine that owns it. In addition to their stacks, virtual machines also have access to the global memory (modules, global bindings, etc) that is shared among other parts of Guile, including other VMs.

A VM has generic instructions, such as those to reference local variables, and instructions designed to support Guile’s languages – mathematical instructions that support the entire numerical tower, an inlined implementation of cons, etc.

The registers that a VM has are as follows:

In other architectures, the instruction pointer is sometimes called the “program counter” (pc). This set of registers is pretty typical for stack machines; their exact meanings in the context of Guile’s VM are described in the next section.