Skip to content

Commit 7bb80a0

Browse files
committed
Fix memory index in data instantiation
1 parent 9a2cab4 commit 7bb80a0

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

document/core/exec/modules.rst

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -659,19 +659,17 @@ It is up to the :ref:`embedder <embedder>` to define how such conditions are rep
659659

660660
14. For each :ref:`data segment <syntax-data>` :math:`\data_i` in :math:`\module.\MDATAS` whose :ref:`mode <syntax-datamode>` is of the form :math:`\DACTIVE~\{ \DMEM~\memidx_i, \DOFFSET~\X{dinstr}^\ast_i~\END \}`, do:
661661

662-
a. Assert: :math:`\memidx_i` is :math:`0`.
662+
a. Let :math:`n` be the length of the vector :math:`\data_i.\DINIT`.
663663

664-
b. Let :math:`n` be the length of the vector :math:`\data_i.\DINIT`.
664+
b. :ref:`Execute <exec-instr-seq>` the instruction sequence :math:`\X{dinstr}^\ast_i`.
665665

666-
c. :ref:`Execute <exec-instr-seq>` the instruction sequence :math:`\X{dinstr}^\ast_i`.
667-
668-
d. :ref:`Execute <exec-const>` the instruction :math:`\I32.\CONST~0`.
666+
c. :ref:`Execute <exec-const>` the instruction :math:`\I32.\CONST~0`.
669667

670-
e. :ref:`Execute <exec-const>` the instruction :math:`\I32.\CONST~n`.
668+
d. :ref:`Execute <exec-const>` the instruction :math:`\I32.\CONST~n`.
671669

672-
f. :ref:`Execute <exec-memory.init>` the instruction :math:`\MEMORYINIT~i`.
670+
e. :ref:`Execute <exec-memory.init>` the instruction :math:`\MEMORYINIT~i`.
673671

674-
g. :ref:`Execute <exec-data.drop>` the instruction :math:`\DATADROP~i`.
672+
f. :ref:`Execute <exec-data.drop>` the instruction :math:`\DATADROP~i`.
675673

676674
15. If the :ref:`start function <syntax-start>` :math:`\module.\MSTART` is not empty, then:
677675

@@ -721,8 +719,8 @@ where:
721719
\F{runelem}_i(\{\ETYPE~\X{et}, \EINIT~\expr^n, \EMODE~\EDECLARATIVE\}) \quad=\\ \qquad
722720
(\ELEMDROP~i) \\[1ex]
723721
\F{rundata}_i(\{\DINIT~b^n, \DMODE~\DPASSIVE\}) \quad=\\ \qquad \epsilon \\
724-
\F{rundata}_i(\{\DINIT~b^n, \DMODE~\DACTIVE \{\DMEM~0, \DOFFSET~\instr^\ast~\END\}\}) \quad=\\ \qquad
725-
\instr^\ast~(\I32.\CONST~0)~(\I32.\CONST~n)~(\MEMORYINIT~i)~(\DATADROP~i) \\
722+
\F{rundata}_i(\{\DINIT~b^n, \DMODE~\DACTIVE \{\DMEM~x, \DOFFSET~\instr^\ast~\END\}\}) \quad=\\ \qquad
723+
\instr^\ast~(\I32.\CONST~0)~(\I32.\CONST~n)~(\MEMORYINIT~x~i)~(\DATADROP~i) \\
726724
\end{array}
727725
728726
.. note::

0 commit comments

Comments
 (0)