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: Dynamic Environment Instructions, Previous: Branch Instructions, Up: Instruction Set [Contents][Index]
The following instructions load literal data into a program. There are two kinds.
The first set of instructions loads immediate values. These instructions encode the immediate directly into the instruction stream.
Make an immediate whose low bits are low-bits, and whose top bits are 0.
Make an immediate whose low bits are low-bits, and whose top bits are 0.
Make an immediate with high-bits and low-bits.
Non-immediate constant literals are referenced either directly or
indirectly. For example, Guile knows at compile-time what the layout of
a string will be like, and arranges to embed that object directly in the
compiled image. A reference to a string will use
make-non-immediate
to treat a pointer into the compilation unit
as a SCM
value directly.
Load a pointer to statically allocated memory into dst. The object’s memory is will be found offset 32-bit words away from the current instruction pointer. Whether the object is mutable or immutable depends on where it was allocated by the compiler, and loaded by the loader.
Some objects must be unique across the whole system. This is the case
for symbols and keywords. For these objects, Guile arranges to
initialize them when the compilation unit is loaded, storing them into a
slot in the image. References go indirectly through that slot.
static-ref
is used in this case.
Load a scm value into dst. The scm value will be fetched from memory, offset 32-bit words away from the current instruction pointer. offset is a signed value.
Fields of non-immediates may need to be fixed up at load time, because
we do not know in advance at what address they will be loaded. This is
the case, for example, for a pair containing a non-immediate in one of
its fields. static-ref
and static-patch!
are used in
these situations.
Store a scm value into memory, offset 32-bit words away from the current instruction pointer. offset is a signed value.
Patch a pointer at dst-offset to point to src-offset. Both offsets are signed 32-bit values, indicating a memory address as a number of 32-bit words away from the current instruction pointer.
Many kinds of literals can be loaded with the above instructions, once the compiler has prepared the statically allocated data. This is the case for vectors, strings, uniform vectors, pairs, and procedures with no free variables. Other kinds of data might need special initializers; those instructions follow.
Parse a string in src to a number, and store in dst.
Parse a string in src to a symbol, and store in dst.
Make a keyword from the symbol in src, and store it in dst.
Load the contiguous typed array located at offset 32-bit words away from the instruction pointer, and store into dst. len is a byte length. offset is signed.
Next: Dynamic Environment Instructions, Previous: Branch Instructions, Up: Instruction Set [Contents][Index]