Skip to content

Commit 4d503df

Browse files
committed
Fix memory index in data instantiation
1 parent 2fcf26d commit 4d503df

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
@@ -674,19 +674,17 @@ It is up to the :ref:`embedder <embedder>` to define how such conditions are rep
674674

675675
16. 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:
676676

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

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

681-
c. :ref:`Execute <exec-instr-seq>` the instruction sequence :math:`\X{dinstr}^\ast_i`.
682-
683-
d. :ref:`Execute <exec-const>` the instruction :math:`\I32.\CONST~0`.
681+
c. :ref:`Execute <exec-const>` the instruction :math:`\I32.\CONST~0`.
684682

685-
e. :ref:`Execute <exec-const>` the instruction :math:`\I32.\CONST~n`.
683+
d. :ref:`Execute <exec-const>` the instruction :math:`\I32.\CONST~n`.
686684

687-
f. :ref:`Execute <exec-memory.init>` the instruction :math:`\MEMORYINIT~i`.
685+
e. :ref:`Execute <exec-memory.init>` the instruction :math:`\MEMORYINIT~i`.
688686

689-
g. :ref:`Execute <exec-data.drop>` the instruction :math:`\DATADROP~i`.
687+
f. :ref:`Execute <exec-data.drop>` the instruction :math:`\DATADROP~i`.
690688

691689
17. If the :ref:`start function <syntax-start>` :math:`\module.\MSTART` is not empty, then:
692690

@@ -737,8 +735,8 @@ where:
737735
\F{runelem}_i(\{\ETYPE~\X{et}, \EINIT~\reff^n, \EMODE~\EDECLARATIVE\}) \quad=\\ \qquad
738736
(\ELEMDROP~i) \\[1ex]
739737
\F{rundata}_i(\{\DINIT~b^n, \DMODE~\DPASSIVE\}) \quad=\quad \epsilon \\
740-
\F{rundata}_i(\{\DINIT~b^n, \DMODE~\DACTIVE \{\DMEM~0, \DOFFSET~\instr^\ast~\END\}\}) \quad=\\ \qquad
741-
\instr^\ast~(\I32.\CONST~0)~(\I32.\CONST~n)~(\MEMORYINIT~i)~(\DATADROP~i) \\
738+
\F{rundata}_i(\{\DINIT~b^n, \DMODE~\DACTIVE \{\DMEM~x, \DOFFSET~\instr^\ast~\END\}\}) \quad=\\ \qquad
739+
\instr^\ast~(\I32.\CONST~0)~(\I32.\CONST~n)~(\MEMORYINIT~x~i)~(\DATADROP~i) \\
742740
\end{array}
743741
744742
.. note::

0 commit comments

Comments
 (0)