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/immediate u8:dst u8:length u8: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 u12:dst u12:src

Store the length of the vector in src in dst.

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

Fetch the item at position idx in the vector in src, and store it in dst.

Instruction: vector-ref/immediate u8:dst u8:src u8:idx

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

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

Store src into the vector dst at index idx.

Instruction: vector-set!/immediate u8:dst u8:idx u8:src

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

Instruction: struct-vtable u12:dst u12:src

Store the vtable of src into dst.

Instruction: allocate-struct/immediate u8:dst u8:vtable u8: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.

Instruction: struct-ref/immediate u8:dst u8:src u8:idx

Fetch the item at slot idx in the struct in src, and store it in dst. idx is an immediate unsigned 8-bit value.

Instruction: struct-set!/immediate u8:dst u8:idx u8:src

Store src into the struct dst at slot idx. idx is an immediate unsigned 8-bit value.

Instruction: class-of u12:dst u12:type

Store the vtable of src into dst.

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

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

Instruction: string-length u12:dst u12:src

Store the length of the string in src in dst.

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

Fetch the character at position idx in the string in src, and store it in dst.

Instruction: cons u8:dst u8:car u8:cdr

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

Instruction: car u12:dst u12:src

Place the car of src in dst.

Instruction: cdr u12:dst u12:src

Place the cdr of src in dst.

Instruction: set-car! u12:pair u12:car

Set the car of dst to src.

Instruction: set-cdr! u12:pair u12:cdr

Set the cdr of dst to src.

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


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