9.3.7.16 Raw Memory Access 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: u8-ref s8:dst s8:ptr s8:idx
Instruction: s8-ref s8:dst s8:ptr s8:idx
Instruction: u16-ref s8:dst s8:ptr s8:idx
Instruction: s16-ref s8:dst s8:ptr s8:idx
Instruction: u32-ref s8:dst s8:ptr s8:idx
Instruction: s32-ref s8:dst s8:ptr s8:idx
Instruction: u64-ref s8:dst s8:ptr s8:idx
Instruction: s64-ref s8:dst s8:ptr s8:idx
Instruction: f32-ref s8:dst s8:ptr s8:idx
Instruction: f64-ref s8:dst s8:ptr s8:idx

Fetch the item at byte offset idx from the raw pointer local ptr, 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: u8-set! s8:ptr s8:idx s8:val
Instruction: s8-set! s8:ptr s8:idx s8:val
Instruction: u16-set! s8:ptr s8:idx s8:val
Instruction: s16-set! s8:ptr s8:idx s8:val
Instruction: u32-set! s8:ptr s8:idx s8:val
Instruction: s32-set! s8:ptr s8:idx s8:val
Instruction: u64-set! s8:ptr s8:idx s8:val
Instruction: s64-set! s8:ptr s8:idx s8:val
Instruction: f32-set! s8:ptr s8:idx s8:val
Instruction: f64-set! s8:ptr s8:idx s8:val

Store val into memory pointed to by raw pointer local ptr, at byte offset idx. Multibyte values are written using native endianness.

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

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