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.

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

9.3.6 Instruction Set

There are about 180 instructions in Guile’s virtual machine. These instructions represent atomic units of a program’s execution. Ideally, they perform one task without conditional branches, then dispatch to the next instruction in the stream.

Instructions themselves are one byte long. Some instructions take parameters, which follow the instruction byte in the instruction stream.

Sometimes the compiler can figure out that it is compiling a special case that can be run more efficiently. So, for example, while Guile offers a generic test-and-branch instruction, it also offers specific instructions for special cases, so that the following cases all have their own test-and-branch instructions:

(if pred then else)
(if (not pred) then else)
(if (null? l) then else)
(if (not (null? l)) then else)

In addition, some Scheme primitives have their own inline implementations, e.g. cons, and list, as we saw in the previous section.

So Guile’s instruction set is a complete instruction set, in that it provides the instructions that are suited to the problem, and is not concerned with making a minimal, orthogonal set of instructions. More instructions may be added over time.

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