Warning: This is the manual of the legacy Guile 2.2 series. You may want to read the manual of the current stable series instead.

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


9.3.7.5 Trampoline Instructions

Though most applicable objects in Guile are procedures implemented in bytecode, not all are. There are primitives, continuations, and other procedure-like objects that have their own calling convention. Instead of adding special cases to the call instruction, Guile wraps these other applicable objects in VM trampoline procedures, then provides special support for these objects in bytecode.

Trampoline procedures are typically generated by Guile at runtime, for example in response to a call to scm_c_make_gsubr. As such, a compiler probably shouldn’t emit code with these instructions. However, it’s still interesting to know how these things work, so we document these trampoline instructions here.

Instruction: subr-call x24:_

Call a subr, passing all locals in this frame as arguments. Return from the calling frame.

Instruction: foreign-call c12:cif-idx c12:ptr-idx

Call a foreign function. Fetch the cif and foreign pointer from cif-idx and ptr-idx, both free variables. Return from the calling frame. Arguments are taken from the stack.

Instruction: continuation-call c24:contregs

Return to a continuation, nonlocally. The arguments to the continuation are taken from the stack. contregs is a free variable containing the reified continuation.

Instruction: compose-continuation c24:cont

Compose a partial continution with the current continuation. The arguments to the continuation are taken from the stack. cont is a free variable containing the reified continuation.

Instruction: tail-apply x24:_

Tail-apply the procedure in local slot 0 to the rest of the arguments. This instruction is part of the implementation of apply, and is not generated by the compiler.

Instruction: builtin-ref s12:dst c12:idx

Load a builtin stub by index into dst.

Instruction: apply-non-program x24:_

An instruction used only by a special trampoline that the VM uses to apply non-programs. Using that trampoline allows profilers and backtrace utilities to avoid seeing the instruction pointer from the calling frame.


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