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
list, as we saw in the
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.
|• Lexical Environment Instructions:|
|• Top-Level Environment Instructions:|
|• Procedure Call and Return Instructions:|
|• Function Prologue Instructions:|
|• Trampoline Instructions:|
|• Branch Instructions:|
|• Data Constructor Instructions:|
|• Loading Instructions:|
|• Dynamic Environment Instructions:|
|• Miscellaneous Instructions:|
|• Inlined Scheme Instructions:|
|• Inlined Mathematical Instructions:|
|• Inlined Bytevector Instructions:|