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 consist 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 compile time, QScheme uses the stack as temporary workspace to generate code. The goal of this is to limit the number of cells created and as consequence the number of GCs.

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

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

Stack overflow and underflow condition is not tested during execution now, speed matters.

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

12.2 Internal opcodes

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
1999-09-17