std/memory
std/memory
Section titled “std/memory”std/wasm/memory — memory load / store / size / grow instruction encoders for the WebAssembly Core 1.0 binary format. Spec: https://webassembly.github.io/spec/core/binary/instructions.html#memory-instructions Fifth slice of Phase 1 of docs/TOOLCHAIN-SELF-HOSTING.md. After the numeric opcodes (single-byte, no immediate), memory ops are the second-largest opcode family. Every load / store carries a memarg immediate — an alignment hint plus a base offset, both uleb-encoded. memory.size / memory.grow each take a one-byte reserved “memory index” immediate (always 0 in wasm 1.0, since the multi-memory proposal hadn’t landed). The “load_8_s” / “load_16_u” etc. variants only exist for the integer widths — float types have no narrow-load form because IEEE-754 doesn’t decompose that way. The bulk-memory ops the production backend actually emits — memory.copy and memory.fill, both under the 0xFC multi-byte opcode prefix — are covered at the bottom of this file. The rest of the bulk-memory family (memory.init / data.drop) and the saturating-truncate ops aren’t included; the backend’s memcpy / memset helpers only reach for copy + fill.
inst_i32_load
Section titled “inst_i32_load”pub function inst_i32_load(buf: u8[], align: u32, offset: u32): u8[]inst_i64_load
Section titled “inst_i64_load”pub function inst_i64_load(buf: u8[], align: u32, offset: u32): u8[]inst_f32_load
Section titled “inst_f32_load”pub function inst_f32_load(buf: u8[], align: u32, offset: u32): u8[]inst_f64_load
Section titled “inst_f64_load”pub function inst_f64_load(buf: u8[], align: u32, offset: u32): u8[]inst_i32_load8_s
Section titled “inst_i32_load8_s”pub function inst_i32_load8_s(buf: u8[], align: u32, offset: u32): u8[]inst_i32_load8_u
Section titled “inst_i32_load8_u”pub function inst_i32_load8_u(buf: u8[], align: u32, offset: u32): u8[]inst_i32_load16_s
Section titled “inst_i32_load16_s”pub function inst_i32_load16_s(buf: u8[], align: u32, offset: u32): u8[]inst_i32_load16_u
Section titled “inst_i32_load16_u”pub function inst_i32_load16_u(buf: u8[], align: u32, offset: u32): u8[]inst_i64_load8_s
Section titled “inst_i64_load8_s”pub function inst_i64_load8_s(buf: u8[], align: u32, offset: u32): u8[]inst_i64_load8_u
Section titled “inst_i64_load8_u”pub function inst_i64_load8_u(buf: u8[], align: u32, offset: u32): u8[]inst_i64_load16_s
Section titled “inst_i64_load16_s”pub function inst_i64_load16_s(buf: u8[], align: u32, offset: u32): u8[]inst_i64_load16_u
Section titled “inst_i64_load16_u”pub function inst_i64_load16_u(buf: u8[], align: u32, offset: u32): u8[]inst_i64_load32_s
Section titled “inst_i64_load32_s”pub function inst_i64_load32_s(buf: u8[], align: u32, offset: u32): u8[]inst_i64_load32_u
Section titled “inst_i64_load32_u”pub function inst_i64_load32_u(buf: u8[], align: u32, offset: u32): u8[]inst_i32_store
Section titled “inst_i32_store”pub function inst_i32_store(buf: u8[], align: u32, offset: u32): u8[]inst_i64_store
Section titled “inst_i64_store”pub function inst_i64_store(buf: u8[], align: u32, offset: u32): u8[]inst_f32_store
Section titled “inst_f32_store”pub function inst_f32_store(buf: u8[], align: u32, offset: u32): u8[]inst_f64_store
Section titled “inst_f64_store”pub function inst_f64_store(buf: u8[], align: u32, offset: u32): u8[]inst_i32_store8
Section titled “inst_i32_store8”pub function inst_i32_store8(buf: u8[], align: u32, offset: u32): u8[]inst_i32_store16
Section titled “inst_i32_store16”pub function inst_i32_store16(buf: u8[], align: u32, offset: u32): u8[]inst_i64_store8
Section titled “inst_i64_store8”pub function inst_i64_store8(buf: u8[], align: u32, offset: u32): u8[]inst_i64_store16
Section titled “inst_i64_store16”pub function inst_i64_store16(buf: u8[], align: u32, offset: u32): u8[]inst_i64_store32
Section titled “inst_i64_store32”pub function inst_i64_store32(buf: u8[], align: u32, offset: u32): u8[]inst_memory_size
Section titled “inst_memory_size”pub function inst_memory_size(buf: u8[]): u8[]inst_memory_grow
Section titled “inst_memory_grow”pub function inst_memory_grow(buf: u8[]): u8[]inst_memory_copy
Section titled “inst_memory_copy”pub function inst_memory_copy(buf: u8[]): u8[]inst_memory_fill
Section titled “inst_memory_fill”pub function inst_memory_fill(buf: u8[]): u8[]