Warning: This is the manual of the legacy Guile 2.0 series. You may want to read the manual of the current stable series instead.

Next: , Previous: , Up: Instruction Set   [Contents][Index]


9.3.6.8 Loading Instructions

In addition to VM instructions, an instruction stream may contain variable-length data embedded within it. This data is always preceded by special loading instructions, which interpret the data and advance the instruction pointer to the next VM instruction.

All of these loading instructions have a length parameter, indicating the size of the embedded data, in bytes. The length itself is encoded in 3 bytes.

Instruction: load-number length

Load an arbitrary number from the instruction stream. The number is embedded in the stream as a string.

Instruction: load-string length

Load a string from the instruction stream. The string is assumed to be encoded in the “latin1” locale.

Instruction: load-wide-string length

Load a UTF-32 string from the instruction stream. length is the length in bytes, not in codepoints.

Instruction: load-symbol length

Load a symbol from the instruction stream. The symbol is assumed to be encoded in the “latin1” locale. Symbols backed by wide strings may be loaded via load-wide-string then make-symbol.

Instruction: load-array length

Load a uniform array from the instruction stream. The shape and type of the array are popped off the stack, in that order.

Instruction: load-program

Load bytecode from the instruction stream, and push a compiled procedure.

This instruction pops one value from the stack: the program’s object table, as a vector, or #f in the case that the program has no object table. A program that does not reference toplevel bindings and does not use object-ref does not need an object table.

This instruction is unlike the rest of the loading instructions, because instead of parsing its data, it directly maps the instruction stream onto a C structure, struct scm_objcode. See Bytecode and Objcode, for more information.

The resulting compiled procedure will not have any free variables captured, so it may be loaded only once but used many times to create closures.


Next: , Previous: , Up: Instruction Set   [Contents][Index]