demo · v133
i64 pointer toolbox
When a Wasm memory is 64-bit, pointers are BigInt on the JS side — not Number. This trips a lot of glue code. Here are conversion helpers, bounds checks, and a live decoder for the i64 values the new instructions emit.
WebAssembly Memory64 isn't available in this browser. Chrome 133+ required.
// canonical glue
const mem = new WebAssembly.Memory({ initial: 1, index: "i64" });
const exports = instance.exports;
const ptr = exports.alloc(BigInt(size)); // returns i64 → BigInt
const view = new Uint8Array(mem.buffer, Number(ptr), size);
view.set(payload);
exports.process(ptr, BigInt(size));
the BigInt boundary
JS Numbers lose precision at 253, well below the new 16 GiB ceiling. The glue layer between Wasm exports and JavaScript must be aware: pointer-typed arguments become BigInt, return values are BigInt, and Number()-converting them is only safe when the value is known to fit. The i64 Memory ABI is otherwise transparent.