[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [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:
- ip - Instruction pointer
- sp - Stack pointer
- fp - Frame pointer
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.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on April 20, 2013 using texi2html 5.0.