WebAssembly linear memory is an indexed sequence of bytes accessed by WebAssembly memory instructions. Its runtime representation records its type and current byte sequence. The length is a multiple of the WebAssembly page size, bytes, or . Declared limits give an initial minimum and optionally a maximum size in pages.[ref]
WebAssembly Core Specification by the W3C WebAssembly Community Group. Execution, Runtime Structure, Memory Instances; Syntax, Types, Memory Types
A load must fit its entire access into the current WebAssembly linear memory. For an instruction offset of zero, a four-byte
i32.load in a one-page memory succeeds at address : its last accessed byte has address . At address , it would need a byte at address and therefore traps. In general, effective address and width must satisfy , where is the current length; the check includes the instruction's immediate offset.[ref]WebAssembly Core Specification by the W3C WebAssembly Community Group. Execution, Memory Instructions, numeric load algorithm, steps 3–6
This boundary example also distinguishes alignment from bounds. Ordinary unaligned loads are permitted; their alignment annotation is an optimization hint. A successful bounds check establishes that the accessed bytes lie inside this memory. It does not establish that the program selected its intended object.[ref]
WebAssembly Core Specification by the W3C WebAssembly Community Group. Execution, Memory Instructions, alignment note
Articles by others on the same topic
There are currently no matching articles.