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: Procedure Call and Return Instructions, Previous: Lexical Environment Instructions, Up: Instruction Set [Contents][Index]
These instructions access values in the top-level environment: bindings that were not lexically apparent at the time that the code in question was compiled.
The location in which a toplevel binding is stored can be looked up once and cached for later. The binding itself may change over time, but its location will stay constant.
Store the current module in dst.
Resolve sym in the current module, and place the resulting variable in dst. An error will be signalled if no variable is found. If bound? is true, an error will be signalled if the variable is unbound.
Look up a binding for sym in the current module, creating it if necessary. Store that variable to dst.
Load a value. The value will be fetched from memory, var-offset
32-bit words away from the current instruction pointer.
var-offset is a signed value. Up to here, toplevel-box
is
like static-ref
.
Then, if the loaded value is a variable, it is placed in dst, and control flow continues.
Otherwise, we have to resolve the variable. In that case we load the module from mod-offset, just as we loaded the variable. Usually the module gets set when the closure is created. sym-offset specifies the name, as an offset to a symbol.
We use the module and the symbol to resolve the variable, placing it in dst, and caching the resolved variable so that we will hit the cache next time. If bound? is true, an error will be signalled if the variable is unbound.
Like toplevel-box
, except mod-offset points at a module
identifier instead of the module itself. A module identifier is a
module name, as a list, prefixed by a boolean. If the prefix is true,
then the variable is resolved relative to the module’s public interface
instead of its private interface.
Next: Procedure Call and Return Instructions, Previous: Lexical Environment Instructions, Up: Instruction Set [Contents][Index]