Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mistakes #1470

Merged
merged 17 commits into from
May 10, 2022
16 changes: 8 additions & 8 deletions document/core/appendix/embedding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Some operations state *pre-conditions* about their arguments or *post-conditions
It is the embedder's responsibility to meet the pre-conditions.
If it does, the post conditions are guaranteed by the semantics.

In addition to pre- and post-conditions explicitly stated with each operation, the specification adopts the following conventions for :ref:`runtime objects <syntax-runtime>` (:math:`store`, :math:`\moduleinst`, :math:`\externval`, :ref:`addresses <syntax-addr>`):
In addition to pre- and post-conditions explicitly stated with each operation, the specification adopts the following conventions for :ref:`runtime objects <syntax-runtime>` (:math:`\store`, :math:`\moduleinst`, :math:`\externval`, :ref:`addresses <syntax-addr>`):

* Every runtime object passed as a parameter must be :ref:`valid <valid-store>` per an implicit pre-condition.

Expand Down Expand Up @@ -258,7 +258,7 @@ Functions
:math:`\F{func\_alloc}(\store, \functype, \hostfunc) : (\store, \funcaddr)`
...........................................................................

1. Pre-condition: :math:`\functype` is :math:`valid <valid-functype>`.
1. Pre-condition: :math:`\functype` is :ref:`valid <valid-functype>`.

2. Let :math:`\funcaddr` be the result of :ref:`allocating a host function <alloc-func>` in :math:`\store` with :ref:`function type <syntax-functype>` :math:`\functype` and host function code :math:`\hostfunc`.

Expand Down Expand Up @@ -326,7 +326,7 @@ Tables
:math:`\F{table\_alloc}(\store, \tabletype) : (\store, \tableaddr, \reff)`
..........................................................................

1. Pre-condition: :math:`\tabletype` is :math:`valid <valid-tabletype>`.
1. Pre-condition: :math:`\tabletype` is :ref:`valid <valid-tabletype>`.

2. Let :math:`\tableaddr` be the result of :ref:`allocating a table <alloc-table>` in :math:`\store` with :ref:`table type <syntax-tabletype>` :math:`\tabletype` and initialization value :math:`\reff`.

Expand All @@ -345,7 +345,7 @@ Tables

1. Return :math:`S.\STABLES[a].\TITYPE`.

2. Post-condition: the returned :ref:`table type <syntax-tabletype>` is :math:`valid <valid-tabletype>`.
2. Post-condition: the returned :ref:`table type <syntax-tabletype>` is :ref:`valid <valid-tabletype>`.

.. math::
\begin{array}{lclll}
Expand Down Expand Up @@ -438,7 +438,7 @@ Memories
:math:`\F{mem\_alloc}(\store, \memtype) : (\store, \memaddr)`
................................................................

1. Pre-condition: :math:`\memtype` is :math:`valid <valid-memtype>`.
1. Pre-condition: :math:`\memtype` is :ref:`valid <valid-memtype>`.

2. Let :math:`\memaddr` be the result of :ref:`allocating a memory <alloc-mem>` in :math:`\store` with :ref:`memory type <syntax-memtype>` :math:`\memtype`.

Expand All @@ -457,7 +457,7 @@ Memories

1. Return :math:`S.\SMEMS[a].\MITYPE`.

2. Post-condition: the returned :ref:`memory type <syntax-memtype>` is :math:`valid <valid-memtype>`.
2. Post-condition: the returned :ref:`memory type <syntax-memtype>` is :ref:`valid <valid-memtype>`.

.. math::
\begin{array}{lclll}
Expand Down Expand Up @@ -551,7 +551,7 @@ Globals
:math:`\F{global\_alloc}(\store, \globaltype, \val) : (\store, \globaladdr)`
............................................................................

1. Pre-condition: :math:`\globaltype` is :math:`valid <valid-globaltype>`.
1. Pre-condition: :math:`\globaltype` is :ref:`valid <valid-globaltype>`.

2. Let :math:`\globaladdr` be the result of :ref:`allocating a global <alloc-global>` in :math:`\store` with :ref:`global type <syntax-globaltype>` :math:`\globaltype` and initialization value :math:`\val`.

Expand All @@ -570,7 +570,7 @@ Globals

1. Return :math:`S.\SGLOBALS[a].\GITYPE`.

2. Post-condition: the returned :ref:`global type <syntax-globaltype>` is :math:`valid <valid-globaltype>`.
2. Post-condition: the returned :ref:`global type <syntax-globaltype>` is :ref:`valid <valid-globaltype>`.

.. math::
\begin{array}{lclll}
Expand Down
4 changes: 2 additions & 2 deletions document/core/appendix/properties.rst
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ Finally, :ref:`frames <syntax-frame>` are classified with *frame contexts*, whic

* Each :ref:`value <syntax-val>` :math:`\val_i` in :math:`\val^\ast` must be :ref:`valid <valid-val>` with some :ref:`value type <syntax-valtype>` :math:`t_i`.

* Let :math:`t^\ast` the concatenation of all :math:`t_i` in order.
* Let :math:`t^\ast` be the concatenation of all :math:`t_i` in order.

* Let :math:`C'` be the same :ref:`context <context>` as :math:`C`, but with the :ref:`value types <syntax-valtype>` :math:`t^\ast` prepended to the |CLOCALS| vector.

Expand Down Expand Up @@ -543,7 +543,7 @@ To that end, all previous typing judgements :math:`C \vdash \X{prop}` are genera
:math:`\REFFUNCADDR~\funcaddr`
..............................

* The :ref:`external function value <syntax-externval>` :math:`\EVFUNC~\funcaddr` must be :ref:`valid <valid-externval-func>` with :ref:`external function type <syntax-externtype>` :math:`\ETFUNC \functype`.
* The :ref:`external function value <syntax-externval>` :math:`\EVFUNC~\funcaddr` must be :ref:`valid <valid-externval-func>` with :ref:`external function type <syntax-externtype>` :math:`\ETFUNC~\functype`.

* Then the instruction is valid with type :math:`[] \to [\FUNCREF]`.

Expand Down
2 changes: 1 addition & 1 deletion document/core/binary/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ Furthermore, it must be present if any :ref:`data index <syntax-dataidx>` occurs
where for each :math:`t_i^\ast, e_i` in :math:`\X{code}^n`,

.. math::
\func^n[i] = \{ \FTYPE~\typeidx^n[i], \FLOCALS~t_i^\ast, \FBODY~e_i \} ) \\
\func^n[i] = \{ \FTYPE~\typeidx^n[i], \FLOCALS~t_i^\ast, \FBODY~e_i \} \\

.. note::
The version of the WebAssembly binary format may increase in the future
Expand Down
2 changes: 1 addition & 1 deletion document/core/exec/conventions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ and a sequence of |CONST| instructions can be interpreted as an operand "stack"
(\I32.\CONST~n_1)~(\I32.\CONST~n_2)~\I32.\ADD \quad\stepto\quad (\I32.\CONST~(n_1 + n_2) \mod 2^{32})

Per this rule, two |CONST| instructions and the |ADD| instruction itself are removed from the instruction stream and replaced with one new |CONST| instruction.
This can be interpreted as popping two value off the stack and pushing the result.
This can be interpreted as popping two values off the stack and pushing the result.

When no result is produced, an instruction reduces to the empty sequence:

Expand Down
50 changes: 25 additions & 25 deletions document/core/exec/instructions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ Most vector instructions are defined in terms of generic numeric operators appli
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & i^\ast = \lanes_{i8x16}(c_2) \\
\wedge & c^\ast = \lanes_{i8x16}(c_1)~0^{240} \\
\wedge & c' = \lanes^{-1}_{i8x16}(c^\ast[ i^\ast[0] ] \dots c^\ast[ i^\ast[15] ])
\wedge & c' = \lanes^{-1}_{i8x16}(c^\ast[ i^\ast[0] ] \dots c^\ast[ i^\ast[15] ]))
\end{array}
\end{array}

Expand Down Expand Up @@ -436,7 +436,7 @@ Most vector instructions are defined in terms of generic numeric operators appli
\\ \qquad
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & i^\ast = \lanes_{i8x16}(c_1)~\lanes_{i8x16}(c_2) \\
\wedge & c = \lanes^{-1}_{i8x16}(i^\ast[x^\ast[0]] \dots i^\ast[x^\ast[15]])
\wedge & c = \lanes^{-1}_{i8x16}(i^\ast[x^\ast[0]] \dots i^\ast[x^\ast[15]]))
\end{array}
\end{array}

Expand Down Expand Up @@ -494,7 +494,7 @@ Most vector instructions are defined in terms of generic numeric operators appli
\\ \qquad
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & t_2 = \unpacked(t_1\K{x}N) \\
\wedge & c_2 = \extend^{sx^?}_{t_1,t_2}(\lanes_{t_1\K{x}N}(c_1)[x])
\wedge & c_2 = \extend^{sx^?}_{t_1,t_2}(\lanes_{t_1\K{x}N}(c_1)[x]))
\end{array}
\end{array}

Expand Down Expand Up @@ -529,8 +529,8 @@ Most vector instructions are defined in terms of generic numeric operators appli
\end{array}
\\ \qquad
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & i^\ast = \lanes_{\shape}(c_2)) \\
\wedge & c = \lanes^{-1}_{\shape}(i^\ast \with [x] = c_1)
(\iff & i^\ast = \lanes_{\shape}(c_2) \\
\wedge & c = \lanes^{-1}_{\shape}(i^\ast \with [x] = c_1))
\end{array}
\end{array}

Expand Down Expand Up @@ -673,7 +673,7 @@ Most vector instructions are defined in terms of generic numeric operators appli
\\ \qquad
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & i_1^\ast = \lanes_{\shape}(c) \\
\wedge & i = \bool(\bigwedge(i_1 \neq 0)^\ast)
\wedge & i = \bool(\bigwedge(i_1 \neq 0)^\ast))
\end{array}
\end{array}

Expand Down Expand Up @@ -735,7 +735,7 @@ Most vector instructions are defined in terms of generic numeric operators appli
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & d_1^M = \narrow^{\sx}_{|t_1|,|t_2|}( \lanes_{t_1\K{x}M}(c_1)) \\
\wedge & d_2^M = \narrow^{\sx}_{|t_1|,|t_2|}( \lanes_{t_1\K{x}M}(c_2)) \\
\wedge & c = \lanes^{-1}_{t_2\K{x}N}(d_1^M~d_2^M)
\wedge & c = \lanes^{-1}_{t_2\K{x}N}(d_1^M~d_2^M))
\end{array}
\end{array}

Expand All @@ -762,7 +762,7 @@ Most vector instructions are defined in terms of generic numeric operators appli
\end{array}
\\ \qquad
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & c = \lanes^{-1}_{t_2\K{x}N}(\vcvtop^{\sx}_{|t_1|,|t_2|}(\lanes_{t_1\K{x}M}(c_1)))
(\iff & c = \lanes^{-1}_{t_2\K{x}N}(\vcvtop^{\sx}_{|t_1|,|t_2|}(\lanes_{t_1\K{x}M}(c_1))))
\end{array}
\end{array}

Expand Down Expand Up @@ -795,7 +795,7 @@ Most vector instructions are defined in terms of generic numeric operators appli
\end{array}
\\ \qquad
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & c = \lanes^{-1}_{t_2\K{x}N}(\vcvtop^{\sx^?}_{|t_1|,|t_2|}(\lanes_{t_1\K{x}M}(c_1)[\half(0, N) \slice N]))
(\iff & c = \lanes^{-1}_{t_2\K{x}N}(\vcvtop^{\sx^?}_{|t_1|,|t_2|}(\lanes_{t_1\K{x}M}(c_1)[\half(0, N) \slice N])))
\end{array}
\end{array}

Expand Down Expand Up @@ -830,7 +830,7 @@ where:
\end{array}
\\ \qquad
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & c = \lanes^{-1}_{t_2\K{x}N}(\vcvtop^{\sx}_{|t_1|,|t_2|}(\lanes_{t_1\K{x}M}(c_1))~0^M)
(\iff & c = \lanes^{-1}_{t_2\K{x}N}(\vcvtop^{\sx}_{|t_1|,|t_2|}(\lanes_{t_1\K{x}M}(c_1))~0^M))
\end{array}
\end{array}

Expand All @@ -840,7 +840,7 @@ where:
:math:`\K{i32x4.}\DOT\K{\_i16x8\_s}`
....................................

1. Assert: due to :ref:`validation <valid-vec-dot>`, two values of :ref:`value type <syntax-valtype>` |V128| is on the top of the stack.
1. Assert: due to :ref:`validation <valid-vec-dot>`, two values of :ref:`value type <syntax-valtype>` |V128| are on the top of the stack.

2. Pop the value :math:`\V128.\VCONST~c_2` from the stack.

Expand All @@ -863,7 +863,7 @@ where:
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & (i_1~i_2)^\ast = \imul_{32}(\extends_{16,32}(\lanes_{\I16X8}(c_1)), \extends_{16,32}(\lanes_{\I16X8}(c_2))) \\
\wedge & j^\ast = \iadd_{32}(i_1, i_2)^\ast \\
\wedge & c = \lanes^{-1}_{\I32X4}(j^\ast)
\wedge & c = \lanes^{-1}_{\I32X4}(j^\ast))
\end{array}
\end{array}

Expand All @@ -873,7 +873,7 @@ where:
:math:`t_2\K{x}N\K{.}\EXTMUL\K{\_}\half\K{\_}t_1\K{x}M\K{\_}\sx`
................................................................

1. Assert: due to :ref:`validation <valid-vec-extmul>`, two values of :ref:`value type <syntax-valtype>` |V128| is on the top of the stack.
1. Assert: due to :ref:`validation <valid-vec-extmul>`, two values of :ref:`value type <syntax-valtype>` |V128| are on the top of the stack.

2. Pop the value :math:`\V128.\VCONST~c_2` from the stack.

Expand Down Expand Up @@ -903,7 +903,7 @@ where:
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & i^\ast = \lanes_{t_1\K{x}M}(c_1)[\half(0, N) \slice N] \\
\wedge & j^\ast = \lanes_{t_1\K{x}M}(c_2)[\half(0, N) \slice N] \\
\wedge & c = \lanes^{-1}_{t_2\K{x}N}(\imul_{t_2\K{x}N}(\extend^{\sx}_{|t_1|,|t_2|}(i^\ast), \extend^{\sx}_{|t_1|,|t_2|}(j^\ast)))
\wedge & c = \lanes^{-1}_{t_2\K{x}N}(\imul_{t_2\K{x}N}(\extend^{\sx}_{|t_1|,|t_2|}(i^\ast), \extend^{\sx}_{|t_1|,|t_2|}(j^\ast))))
\end{array}

where:
Expand Down Expand Up @@ -941,7 +941,7 @@ where:
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & (i_1~i_2)^\ast = \extend^{\sx}_{|t_1|,|t_2|}(\lanes_{t_1\K{x}M}(c_1)) \\
\wedge & j^\ast = \iadd_{N}(i_1, i_2)^\ast \\
\wedge & c = \lanes^{-1}_{t_2\K{x}N}(j^\ast)
\wedge & c = \lanes^{-1}_{t_2\K{x}N}(j^\ast))
\end{array}
\end{array}

Expand Down Expand Up @@ -1777,9 +1777,9 @@ Memory Instructions
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & \X{ea} = i + \memarg.\OFFSET \\
\wedge & \X{ea} + M \cdot N / 8 \leq |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA| \\
\wedge & \bytes_{\iM}(m_k) = S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} + k \cdot M/8 \slice M/8]) \\
\wedge & \bytes_{\iM}(m_k) = S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} + k \cdot M/8 \slice M/8] \\
\wedge & W = M \cdot 2 \\
\wedge & c = \lanes^{-1}_{\X{i}W\K{x}N}(\extend^{\sx}_{M,W}(m_0) \dots \extend^{\sx}_{M,W}(m_{N-1}))
\wedge & c = \lanes^{-1}_{\X{i}W\K{x}N}(\extend^{\sx}_{M,W}(m_0) \dots \extend^{\sx}_{M,W}(m_{N-1})))
\end{array}
\\[1ex]
\begin{array}{lcl@{\qquad}l}
Expand Down Expand Up @@ -1835,8 +1835,8 @@ Memory Instructions
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & \X{ea} = i + \memarg.\OFFSET \\
\wedge & \X{ea} + N/8 \leq |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA| \\
\wedge & \bytes_{\iN}(n) = S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8]) \\
\wedge & c = \lanes^{-1}_{\iN\K{x}L}(n^L)
\wedge & \bytes_{\iN}(n) = S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8] \\
\wedge & c = \lanes^{-1}_{\iN\K{x}L}(n^L))
\end{array}
\\[1ex]
\begin{array}{lcl@{\qquad}l}
Expand Down Expand Up @@ -1890,8 +1890,8 @@ Memory Instructions
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & \X{ea} = i + \memarg.\OFFSET \\
\wedge & \X{ea} + N/8 \leq |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA| \\
\wedge & \bytes_{\iN}(n) = S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8]) \\
\wedge & c = \extendu_{N,128}(n)
\wedge & \bytes_{\iN}(n) = S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8] \\
\wedge & c = \extendu_{N,128}(n))
\end{array}
\\[1ex]
\begin{array}{lcl@{\qquad}l}
Expand Down Expand Up @@ -1951,9 +1951,9 @@ Memory Instructions
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & \X{ea} = i + \memarg.\OFFSET \\
\wedge & \X{ea} + N/8 \leq |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA| \\
\wedge & \bytes_{\iN}(r) = S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8]) \\
\wedge & \bytes_{\iN}(r) = S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8] \\
\wedge & L = 128/N \\
\wedge & c = \lanes^{-1}_{\K{i}N\K{x}L}(\lanes_{\K{i}N\K{x}L}(v) \with [x] = r)
\wedge & c = \lanes^{-1}_{\K{i}N\K{x}L}(\lanes_{\K{i}N\K{x}L}(v) \with [x] = r))
\end{array}
\\[1ex]
\begin{array}{lcl@{\qquad}l}
Expand Down Expand Up @@ -2030,7 +2030,7 @@ Memory Instructions
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & \X{ea} = i + \memarg.\OFFSET \\
\wedge & \X{ea} + N/8 \leq |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA| \\
\wedge & S' = S \with \SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8] = \bytes_{\iN}(\wrap_{|t|,N}(c)) \\[1ex]
\wedge & S' = S \with \SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8] = \bytes_{\iN}(\wrap_{|t|,N}(c))) \\[1ex]
\end{array}
\\[1ex]
\begin{array}{lcl@{\qquad}l}
Expand Down Expand Up @@ -2087,7 +2087,7 @@ Memory Instructions
(\iff & \X{ea} = i + \memarg.\OFFSET \\
\wedge & \X{ea} + N \leq |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA| \\
\wedge & L = 128/N \\
\wedge & S' = S \with \SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8] = \bytes_{\iN}(\lanes_{\K{i}N\K{x}L}(c)[x])
\wedge & S' = S \with \SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8] = \bytes_{\iN}(\lanes_{\K{i}N\K{x}L}(c)[x]))
\end{array}
\\[1ex]
\begin{array}{lcl@{\qquad}l}
Expand Down
6 changes: 3 additions & 3 deletions document/core/exec/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ Growing :ref:`tables <syntax-tableinst>`
\wedge & \X{len} < 2^{32} \\
\wedge & \limits~t = \tableinst.\TITYPE \\
\wedge & \limits' = \limits \with \LMIN = \X{len} \\
\wedge & \vdashlimits \limits' \ok \\
\wedge & \vdashlimits \limits' \ok) \\
\end{array} \\
\end{array}

Expand Down Expand Up @@ -424,7 +424,7 @@ Growing :ref:`memories <syntax-meminst>`
\wedge & \X{len} \leq 2^{16} \\
\wedge & \limits = \meminst.\MITYPE \\
\wedge & \limits' = \limits \with \LMIN = \X{len} \\
\wedge & \vdashlimits \limits' \ok \\
\wedge & \vdashlimits \limits' \ok) \\
\end{array} \\
\end{array}

Expand Down Expand Up @@ -462,7 +462,7 @@ and list of :ref:`reference <syntax-ref>` vectors for the module's :ref:`element

6. For each :ref:`element segment <syntax-elem>` :math:`\elem_i` in :math:`\module.\MELEMS`, do:

a. Let :math:`\elemaddr_i` be the :ref:`element address <syntax-elemaddr>` resulting from :ref:`allocating <alloc-elem>` a :ref:`element instance <syntax-eleminst>` of :ref:`reference type <syntax-reftype>` :math:`\elem_i.\ETYPE` with contents :math:`(\reff^\ast)^\ast[i]`.
a. Let :math:`\elemaddr_i` be the :ref:`element address <syntax-elemaddr>` resulting from :ref:`allocating <alloc-elem>` an :ref:`element instance <syntax-eleminst>` of :ref:`reference type <syntax-reftype>` :math:`\elem_i.\ETYPE` with contents :math:`(\reff^\ast)^\ast[i]`.

7. For each :ref:`data segment <syntax-data>` :math:`\data_i` in :math:`\module.\MDATAS`, do:

Expand Down
Loading