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: Top-Level Environment Instructions, Up: Instruction Set [Contents][Index]
These instructions access and mutate the lexical environment of a compiled procedure—its free and bound variables. See Stack Layout, for more information on the format of stack frames.
Copy a value from one local slot to another.
As discussed previously, procedure arguments and local variables are
allocated to local slots. Guile’s compiler tries to avoid shuffling
variables around to different slots, which often makes mov
instructions redundant. However there are some cases in which shuffling
is necessary, and in those cases, mov
is the thing to use.
Copy a value from one local slot to another, but addressing slots
relative to the fp
instead of the sp
. This is used when
shuffling values into place after multiple-value returns.
Make a new closure, and write it to dst. The code for the closure
will be found at offset words from the current ip
.
offset is a signed 32-bit integer. Space for nfree free
variables will be allocated.
The size of a closure is currently two words, plus one word per free variable.
Load free variable idx from the closure src into local slot dst.
Set free variable idx from the closure dst to src.
This instruction is usually used when initializing a closure’s free variables, but not to mutate free variables, as variables that are assigned are boxed.
Recall that variables that are assigned are usually allocated in boxes, so that continuations and closures can capture their identity and not their value at one point in time. Variables are also used in the implementation of top-level bindings; see the next section for more information.
Create a new variable holding src, and place it in dst.
Unpack the variable at src into dst, asserting that the variable is actually bound.
Set the contents of the variable at dst to set.
Next: Top-Level Environment Instructions, Up: Instruction Set [Contents][Index]