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


9.3.7.10 Inlined Scheme Instructions

The Scheme compiler can recognize the application of standard Scheme procedures. It tries to inline these small operations to avoid the overhead of creating new stack frames. This allows the compiler to optimize better.

Instruction: make-vector s8:dst s8:length s8:init

Make a vector and write it to dst. The vector will have space for length slots. They will be filled with the value in slot init.

Instruction: make-vector/immediate s8:dst s8:length c8:init

Make a short vector of known size and write it to dst. The vector will have space for length slots, an immediate value. They will be filled with the value in slot init.

Instruction: vector-length s12:dst s12:src

Store the length of the vector in src in dst, as an unboxed unsigned 64-bit integer.

Instruction: vector-ref s8:dst s8:src s8:idx

Fetch the item at position idx in the vector in src, and store it in dst. The idx value should be an unboxed unsigned 64-bit integer.

Instruction: vector-ref/immediate s8:dst s8:src c8:idx

Fill dst with the item idx elements into the vector at src. Useful for building data types using vectors.

Instruction: vector-set! s8:dst s8:idx s8:src

Store src into the vector dst at index idx. The idx value should be an unboxed unsigned 64-bit integer.

Instruction: vector-set!/immediate s8:dst c8:idx s8:src

Store src into the vector dst at index idx. Here idx is an immediate value.

Instruction: struct-vtable s12:dst s12:src

Store the vtable of src into dst.

Instruction: allocate-struct s8:dst s8:vtable s8:nfields

Allocate a new struct with vtable, and place it in dst. The struct will be constructed with space for nfields fields, which should correspond to the field count of the vtable. The idx value should be an unboxed unsigned 64-bit integer.

Instruction: struct-ref s8:dst s8:src s8:idx

Fetch the item at slot idx in the struct in src, and store it in dst. The idx value should be an unboxed unsigned 64-bit integer.

Instruction: struct-set! s8:dst s8:idx s8:src

Store src into the struct dst at slot idx. The idx value should be an unboxed unsigned 64-bit integer.

Instruction: allocate-struct/immediate s8:dst s8:vtable c8:nfields
Instruction: struct-ref/immediate s8:dst s8:src c8:idx
Instruction: struct-set!/immediate s8:dst c8:idx s8:src

Variants of the struct instructions, but in which the nfields or idx fields are immediate values.

Instruction: class-of s12:dst s12:type

Store the vtable of src into dst.

Instruction: make-array s24:dst x8:_ s24:type x8:_ s24:fill x8:_ s24:bounds

Make a new array with type, fill, and bounds, storing it in dst.

Instruction: string-length s12:dst s12:src

Store the length of the string in src in dst, as an unboxed unsigned 64-bit integer.

Instruction: string-ref s8:dst s8:src s8:idx

Fetch the character at position idx in the string in src, and store it in dst. The idx value should be an unboxed unsigned 64-bit integer.

Instruction: cons s8:dst s8:car s8:cdr

Cons car and cdr, and store the result in dst.

Instruction: car s12:dst s12:src

Place the car of src in dst.

Instruction: cdr s12:dst s12:src

Place the cdr of src in dst.

Instruction: set-car! s12:pair s12:car

Set the car of dst to src.

Instruction: set-cdr! s12:pair s12:cdr

Set the cdr of dst to src.

Note that caddr and friends compile to a series of car and cdr instructions.

Instruction: integer->char s12:dst s12:src

Convert the u64 value in src to a Scheme character, and place it in dst.

Instruction: char->integer s12:dst s12:src

Convert the Scheme character in src to an integer, and place it in dst as an unboxed u64 value.


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