Next: Memory Access Instructions, Previous: Intrinsic Call 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, sign-extended.
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 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.
Sometimes you need to load up a code pointer into a register; for this,
use load-label
.
Load a label offset words away from the current ip
and
write it to dst. offset is a signed 32-bit integer.
Finally, Guile supports a number of unboxed data types, with their associate constant loaders.
Load a double-precision floating-point value formed by joining high-bits and low-bits, and write it to dst.
Load an unsigned 64-bit integer formed by joining high-bits and low-bits, and write it to dst.
Load a signed 64-bit integer formed by joining high-bits and low-bits, and write it to dst.
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-set!
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.
Next: Memory Access Instructions, Previous: Intrinsic Call Instructions, Up: Instruction Set [Contents][Index]