You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 15, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: document/core/binary/instructions.rst
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -117,7 +117,7 @@ Variable Instructions
117
117
Memory Instructions
118
118
~~~~~~~~~~~~~~~~~~~
119
119
120
-
Each variant of :ref:`memory instruction <syntax-instr-memory>` is encoded with a different byte code. Loads and stores are followed by the encoding of their |memarg| immediate.
120
+
Each variant of :ref:`memory instruction <syntax-instr-memory>` is encoded with a different byte code. Loads and stores are followed by the encoding of their |memarg| immediate, which includes the :ref:`memory index <binary-memidx>` if bit 6 of the flags field containing alignment is set; the memory index defaults to 0 otherwise.
121
121
122
122
.. _binary-memarg:
123
123
.. _binary-load:
@@ -128,9 +128,12 @@ Each variant of :ref:`memory instruction <syntax-instr-memory>` is encoded with
In future versions of WebAssembly, the additional zero bytes occurring in the encoding of the |MEMORYSIZE| and |MEMORYGROW| instructions may be used to index additional memories.
Memory is accessed with |LOAD| and |STORE| instructions for the different :ref:`value types <syntax-valtype>`.
249
-
They all take a *memory immediate* |memarg| that contains an address *offset* and the expected *alignment* (expressed as the exponent of a power of 2).
249
+
They all take a :ref:`memory index <syntax-memidx>` and a *memory immediate* |memarg| that contains an address *offset* and the expected *alignment* (expressed as the exponent of a power of 2).
250
250
Integer loads and stores can optionally specify a *storage size* that is smaller than the :ref:`bit width <syntax-valtype>` of the respective value type.
251
251
In the case of loads, a sign extension mode |sx| is then required to select appropriate behavior.
252
252
@@ -258,14 +258,9 @@ A :ref:`trap <trap>` results if any of the accessed memory bytes lies outside th
258
258
Future version of WebAssembly might provide memory instructions with 64 bit address ranges.
259
259
260
260
The |MEMORYSIZE| instruction returns the current size of a memory.
261
-
The |MEMORYGROW| instruction grows memory by a given delta and returns the previous size, or :math:`-1` if enough memory cannot be allocated.
261
+
The |MEMORYGROW| instruction grows a memory by a given delta and returns the previous size, or :math:`-1` if enough memory cannot be allocated.
262
262
Both instructions operate in units of :ref:`page size <page-size>`.
263
263
264
-
.. note::
265
-
In the current version of WebAssembly,
266
-
all memory instructions implicitly operate on :ref:`memory <syntax-mem>` :ref:`index <syntax-memidx>` :math:`0`.
267
-
This restriction may be lifted in future versions.
268
-
269
264
270
265
.. index:: ! control instruction, ! structured control, ! label, ! block, ! branch, ! unwinding, result type, label index, function index, type index, vector, trap, function, table, function type
0 commit comments