Next: , Previous: , Up: Instruction Set   [Contents][Index] Inlined Scheme Instructions

The Scheme compiler can recognize the application of standard Scheme procedures. It tries to inline these small operations to avoid the overhead of creating new stack frames.

Since most of these operations are historically implemented as C primitives, not inlining them would entail constantly calling out from the VM to the interpreter, which has some costs—registers must be saved, the interpreter has to dispatch, called procedures have to do much type checking, etc. It’s much more efficient to inline these operations in the virtual machine itself.

All of these instructions pop their arguments from the stack and push their results, and take no parameters from the instruction stream. Thus, unlike in the previous sections, these instruction definitions show stack parameters instead of parameters from the instruction stream.

Instruction: not x
Instruction: not-not x
Instruction: eq? x y
Instruction: not-eq? x y
Instruction: null?
Instruction: not-null?
Instruction: eqv? x y
Instruction: equal? x y
Instruction: pair? x y
Instruction: list? x
Instruction: set-car! pair x
Instruction: set-cdr! pair x
Instruction: cons x y
Instruction: car x
Instruction: cdr x
Instruction: vector-ref x y
Instruction: vector-set x n y
Instruction: struct? x
Instruction: struct-ref x n
Instruction: struct-set x n v
Instruction: struct-vtable x
Instruction: class-of x
Instruction: slot-ref struct n
Instruction: slot-set struct n x

Inlined implementations of their Scheme equivalents.

Note that caddr and friends compile to a series of car and cdr instructions.

Next: , Previous: , Up: Instruction Set   [Contents][Index]