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: , Previous: , Up: Instruction Set   [Contents][Index]


9.3.7.13 Inlined Bytevector Instructions

Bytevector operations correspond closely to what the current hardware can do, so it makes sense to inline them to VM instructions, providing a clear path for eventual native compilation. Without this, Scheme programs would need other primitives for accessing raw bytes – but these primitives are as good as any.

Instruction: bv-length s12:dst s12:src

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

Instruction: bv-u8-ref s8:dst s8:src s8:idx
Instruction: bv-s8-ref s8:dst s8:src s8:idx
Instruction: bv-u16-ref s8:dst s8:src s8:idx
Instruction: bv-s16-ref s8:dst s8:src s8:idx
Instruction: bv-u32-ref s8:dst s8:src s8:idx
Instruction: bv-s32-ref s8:dst s8:src s8:idx
Instruction: bv-u64-ref s8:dst s8:src s8:idx
Instruction: bv-s64-ref s8:dst s8:src s8:idx
Instruction: bv-f32-ref s8:dst s8:src s8:idx
Instruction: bv-f64-ref s8:dst s8:src s8:idx

Fetch the item at byte offset idx in the bytevector src, and store it in dst. All accesses use native endianness.

The idx value should be an unboxed unsigned 64-bit integer.

The results are all written to the stack as unboxed values, either as signed 64-bit integers, unsigned 64-bit integers, or IEEE double floating point numbers.

Instruction: bv-u8-set! s8:dst s8:idx s8:src
Instruction: bv-s8-set! s8:dst s8:idx s8:src
Instruction: bv-u16-set! s8:dst s8:idx s8:src
Instruction: bv-s16-set! s8:dst s8:idx s8:src
Instruction: bv-u32-set! s8:dst s8:idx s8:src
Instruction: bv-s32-set! s8:dst s8:idx s8:src
Instruction: bv-u64-set! s8:dst s8:idx s8:src
Instruction: bv-s64-set! s8:dst s8:idx s8:src
Instruction: bv-f32-set! s8:dst s8:idx s8:src
Instruction: bv-f64-set! s8:dst s8:idx s8:src

Store src into the bytevector dst at byte offset idx. Multibyte values are written using native endianness.

The idx value should be an unboxed unsigned 64-bit integer.

The src values are all unboxed, either as signed 64-bit integers, unsigned 64-bit integers, or IEEE double floating point numbers.


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