next up previous contents
Next: 13 QScheme libraries Up: QScheme Documentation Previous: 11 Internal representation of   Contents

Subsections

12 Virtual Machine

12.1 Introduction

The virtual machine consists of a set of registers and a stack. See table 7

Table 7: Virtual Machine registers
Register Description
ip the instruction pointer
sp the stack pointer
TOS the top of stack register. You can consider TOS as a cache.
cont the pointer to the current continuation frame.
env the pointer to the current dynamic environment


The stack is used both at compile-time and at run-time.

At compilation time, QScheme uses the stack as temporary workspace to generate code. This is done to limit the number of cells created and as consequence the number of GCs (garbage collections).

At run time, QScheme uses the stack to store function arguments, runtime environment, catches and partial continuations.

The default stack size is 32000 pointers.. This default can be changed on the command line.

Presently, stack overflow and underflow conditions are not caught during execution, to avoid the related execution overhead and raise the performance of the VM - speed matters.

The virtual machine is in the file vm2.c file.

12.2 Internal opcodes

The internal opcodes are stored in the table symbols local to the function scm_vm() in the file vm2.c .

A pointer to this table is provided during initialization of the virtual machine.

12.3 Various things to know

Things to know


next up previous contents
Next: 13 QScheme libraries Up: QScheme Documentation Previous: 11 Internal representation of   Contents
Daniel Crettol 2000-06-12