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-callx24:_

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

Instruction: foreign-callc12: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-callc24: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-continuationc24: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-applyx24:_

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-refs12:dst c12:idx

Load a builtin stub by index into dst.

Instruction: apply-non-programx24:_

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.