Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
sbc100 committed Jan 31, 2023
2 parents 11f6045 + 45f9845 commit dd72ab9
Show file tree
Hide file tree
Showing 28 changed files with 199 additions and 168 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- run: pip install bikeshed && bikeshed update
- run: pip install six
- run: sudo apt-get update -y && sudo apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
- run: pip install sphinx==4.0.0
- run: pip install sphinx==5.1.0
- run: cd document/core && make all
- uses: actions/upload-artifact@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion document/core/appendix/embedding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Failure of an interface operation is indicated by an auxiliary syntactic class:

.. math::
\begin{array}{llll}
\production{(error)} & \error &::=& \ERROR \\
\production{error} & \error &::=& \ERROR \\
\end{array}
In addition to the error conditions specified explicitly in this section, implementations may also return errors when specific :ref:`implementation limitations <impl>` are reached.
Expand Down
8 changes: 4 additions & 4 deletions document/core/appendix/gen-index-instructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,10 @@ def Instruction(name, opcode, type=None, validation=None, execution=None, operat
Instruction(r'\V128.\LOAD\K{16\_lane}~\memarg~\laneidx', r'\hex{FD}~~\hex{55}', r'[\I32~\V128] \to [\V128]', r'valid-load-lane', r'exec-load-lane'),
Instruction(r'\V128.\LOAD\K{32\_lane}~\memarg~\laneidx', r'\hex{FD}~~\hex{56}', r'[\I32~\V128] \to [\V128]', r'valid-load-lane', r'exec-load-lane'),
Instruction(r'\V128.\LOAD\K{64\_lane}~\memarg~\laneidx', r'\hex{FD}~~\hex{57}', r'[\I32~\V128] \to [\V128]', r'valid-load-lane', r'exec-load-lane'),
Instruction(r'\V128.\STORE\K{8\_lane}~\memarg~\laneidx', r'\hex{FD}~~\hex{58}', r'[\I32~\V128] \to [\V128]', r'valid-store-lane', r'exec-store-lane'),
Instruction(r'\V128.\STORE\K{16\_lane}~\memarg~\laneidx', r'\hex{FD}~~\hex{59}', r'[\I32~\V128] \to [\V128]', r'valid-store-lane', r'exec-store-lane'),
Instruction(r'\V128.\STORE\K{32\_lane}~\memarg~\laneidx', r'\hex{FD}~~\hex{5A}', r'[\I32~\V128] \to [\V128]', r'valid-store-lane', r'exec-store-lane'),
Instruction(r'\V128.\STORE\K{64\_lane}~\memarg~\laneidx', r'\hex{FD}~~\hex{5B}', r'[\I32~\V128] \to [\V128]', r'valid-store-lane', r'exec-store-lane'),
Instruction(r'\V128.\STORE\K{8\_lane}~\memarg~\laneidx', r'\hex{FD}~~\hex{58}', r'[\I32~\V128] \to []', r'valid-store-lane', r'exec-store-lane'),
Instruction(r'\V128.\STORE\K{16\_lane}~\memarg~\laneidx', r'\hex{FD}~~\hex{59}', r'[\I32~\V128] \to []', r'valid-store-lane', r'exec-store-lane'),
Instruction(r'\V128.\STORE\K{32\_lane}~\memarg~\laneidx', r'\hex{FD}~~\hex{5A}', r'[\I32~\V128] \to []', r'valid-store-lane', r'exec-store-lane'),
Instruction(r'\V128.\STORE\K{64\_lane}~\memarg~\laneidx', r'\hex{FD}~~\hex{5B}', r'[\I32~\V128] \to []', r'valid-store-lane', r'exec-store-lane'),
Instruction(r'\V128.\LOAD\K{32\_zero}~\memarg~\laneidx', r'\hex{FD}~~\hex{5C}', r'[\I32] \to [\V128]', r'valid-load-zero', r'exec-load-zero'),
Instruction(r'\V128.\LOAD\K{64\_zero}~\memarg~\laneidx', r'\hex{FD}~~\hex{5D}', r'[\I32] \to [\V128]', r'valid-load-zero', r'exec-load-zero'),
Instruction(r'\F32X4.\VDEMOTE\K{\_f64x2\_zero}', r'\hex{FD}~~\hex{5E}', r'[\V128] \to [\V128]', r'valid-vcvtop', r'exec-vcvtop', r'op-demote'),
Expand Down
8 changes: 4 additions & 4 deletions document/core/appendix/index-instructions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,10 @@ Instruction Binary Opcode
:math:`\V128.\LOAD\K{16\_lane}~\memarg~\laneidx` :math:`\hex{FD}~~\hex{55}` :math:`[\I32~\V128] \to [\V128]` :ref:`validation <valid-load-lane>` :ref:`execution <exec-load-lane>`
:math:`\V128.\LOAD\K{32\_lane}~\memarg~\laneidx` :math:`\hex{FD}~~\hex{56}` :math:`[\I32~\V128] \to [\V128]` :ref:`validation <valid-load-lane>` :ref:`execution <exec-load-lane>`
:math:`\V128.\LOAD\K{64\_lane}~\memarg~\laneidx` :math:`\hex{FD}~~\hex{57}` :math:`[\I32~\V128] \to [\V128]` :ref:`validation <valid-load-lane>` :ref:`execution <exec-load-lane>`
:math:`\V128.\STORE\K{8\_lane}~\memarg~\laneidx` :math:`\hex{FD}~~\hex{58}` :math:`[\I32~\V128] \to [\V128]` :ref:`validation <valid-store-lane>` :ref:`execution <exec-store-lane>`
:math:`\V128.\STORE\K{16\_lane}~\memarg~\laneidx` :math:`\hex{FD}~~\hex{59}` :math:`[\I32~\V128] \to [\V128]` :ref:`validation <valid-store-lane>` :ref:`execution <exec-store-lane>`
:math:`\V128.\STORE\K{32\_lane}~\memarg~\laneidx` :math:`\hex{FD}~~\hex{5A}` :math:`[\I32~\V128] \to [\V128]` :ref:`validation <valid-store-lane>` :ref:`execution <exec-store-lane>`
:math:`\V128.\STORE\K{64\_lane}~\memarg~\laneidx` :math:`\hex{FD}~~\hex{5B}` :math:`[\I32~\V128] \to [\V128]` :ref:`validation <valid-store-lane>` :ref:`execution <exec-store-lane>`
:math:`\V128.\STORE\K{8\_lane}~\memarg~\laneidx` :math:`\hex{FD}~~\hex{58}` :math:`[\I32~\V128] \to []` :ref:`validation <valid-store-lane>` :ref:`execution <exec-store-lane>`
:math:`\V128.\STORE\K{16\_lane}~\memarg~\laneidx` :math:`\hex{FD}~~\hex{59}` :math:`[\I32~\V128] \to []` :ref:`validation <valid-store-lane>` :ref:`execution <exec-store-lane>`
:math:`\V128.\STORE\K{32\_lane}~\memarg~\laneidx` :math:`\hex{FD}~~\hex{5A}` :math:`[\I32~\V128] \to []` :ref:`validation <valid-store-lane>` :ref:`execution <exec-store-lane>`
:math:`\V128.\STORE\K{64\_lane}~\memarg~\laneidx` :math:`\hex{FD}~~\hex{5B}` :math:`[\I32~\V128] \to []` :ref:`validation <valid-store-lane>` :ref:`execution <exec-store-lane>`
:math:`\V128.\LOAD\K{32\_zero}~\memarg~\laneidx` :math:`\hex{FD}~~\hex{5C}` :math:`[\I32] \to [\V128]` :ref:`validation <valid-load-zero>` :ref:`execution <exec-load-zero>`
:math:`\V128.\LOAD\K{64\_zero}~\memarg~\laneidx` :math:`\hex{FD}~~\hex{5D}` :math:`[\I32] \to [\V128]` :ref:`validation <valid-load-zero>` :ref:`execution <exec-load-zero>`
:math:`\F32X4.\VDEMOTE\K{\_f64x2\_zero}` :math:`\hex{FD}~~\hex{5E}` :math:`[\V128] \to [\V128]` :ref:`validation <valid-vcvtop>` :ref:`execution <exec-vcvtop>`, :ref:`operator <op-demote>`
Expand Down
2 changes: 1 addition & 1 deletion document/core/appendix/properties.rst
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ Module instances are classified by *module contexts*, which are regular :ref:`co
:ref:`Memory Instances <syntax-meminst>` :math:`\{ \MITYPE~\limits, \MIDATA~b^\ast \}`
......................................................................................

* The :ref:`memory type <syntax-memtype>` :math:`\{\LMIN~n, \LMAX~m^?\}` must be :ref:`valid <valid-memtype>`.
* The :ref:`memory type <syntax-memtype>` :math:`\limits` must be :ref:`valid <valid-memtype>`.

* The length of :math:`b^\ast` must equal :math:`\limits.\LMIN` multiplied by the :ref:`page size <page-size>` :math:`64\,\F{Ki}`.

Expand Down
60 changes: 30 additions & 30 deletions document/core/exec/instructions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ Most vector instructions are defined in terms of generic numeric operators appli
.. math::
\begin{array}{l}
\begin{array}{lcl@{\qquad}l}
(\V128\K{.}\VCONST~c_1)~(\V128\K{.}\VCONST~c_2)~\V128\K{.}\SWIZZLE &\stepto& (\V128\K{.}\VCONST~c')
(\V128\K{.}\VCONST~c_1)~(\V128\K{.}\VCONST~c_2)~\I8X16\K{.}\SWIZZLE &\stepto& (\V128\K{.}\VCONST~c')
\end{array}
\\ \qquad
\begin{array}[t]{@{}r@{~}l@{}}
Expand Down Expand Up @@ -431,7 +431,7 @@ Most vector instructions are defined in terms of generic numeric operators appli
.. math::
\begin{array}{l}
\begin{array}{lcl@{\qquad}l}
(\V128\K{.}\VCONST~c_1)~(\V128\K{.}\VCONST~c_2)~\V128\K{.}\SHUFFLE~x^\ast &\stepto& (\V128\K{.}\VCONST~c)
(\V128\K{.}\VCONST~c_1)~(\V128\K{.}\VCONST~c_2)~\I8X16\K{.}\SHUFFLE~x^\ast &\stepto& (\V128\K{.}\VCONST~c)
\end{array}
\\ \qquad
\begin{array}[t]{@{}r@{~}l@{}}
Expand Down Expand Up @@ -1256,7 +1256,7 @@ Table Instructions
.. math::
\begin{array}{l}
\begin{array}{lcl@{\qquad}l}
S; F; \TABLESIZE~x &\stepto& S; F; (\I32.\CONST~\X{sz})
S; F; (\TABLESIZE~x) &\stepto& S; F; (\I32.\CONST~\X{sz})
\end{array}
\\ \qquad
(\iff |S.\STABLES[F.\AMODULE.\MITABLES[x]].\TIELEM| = \X{sz}) \\
Expand Down Expand Up @@ -1288,19 +1288,21 @@ Table Instructions

10. Pop the value :math:`\val` from the stack.

11. Either, try :ref:`growing <grow-table>` :math:`\X{table}` by :math:`n` entries with initialization value :math:`\val`:
11. Let :math:`\X{err}` be the |i32| value :math:`2^{32}-1`, for which :math:`\signed_{32}(\X{err})` is :math:`-1`.

12. Either, try :ref:`growing <grow-table>` :math:`\X{table}` by :math:`n` entries with initialization value :math:`\val`:

a. If it succeeds, push the value :math:`\I32.\CONST~\X{sz}` to the stack.

b. Else, push the value :math:`\I32.\CONST~(-1)` to the stack.
b. Else, push the value :math:`\I32.\CONST~\X{err}` to the stack.

12. Or, push the value :math:`\I32.\CONST~(-1)` to the stack.
13. Or, push the value :math:`\I32.\CONST~\X{err}` to the stack.

.. math::
~\\[-1ex]
\begin{array}{l}
\begin{array}{lcl@{\qquad}l}
S; F; \val~(\I32.\CONST~n)~\TABLEGROW~x &\stepto& S'; F; (\I32.\CONST~\X{sz})
S; F; \val~(\I32.\CONST~n)~(\TABLEGROW~x) &\stepto& S'; F; (\I32.\CONST~\X{sz})
\end{array}
\\ \qquad
\begin{array}[t]{@{}r@{~}l@{}}
Expand All @@ -1310,7 +1312,7 @@ Table Instructions
\end{array}
\\[1ex]
\begin{array}{lcl@{\qquad}l}
S; F; (\I32.\CONST~n)~\TABLEGROW~x &\stepto& S; F; (\I32.\CONST~{-1})
S; F; (\I32.\CONST~n)~(\TABLEGROW~x) &\stepto& S; F; (\I32.\CONST~\signed_{32}^{-1}(-1))
\end{array}
\end{array}
Expand Down Expand Up @@ -1511,7 +1513,7 @@ Table Instructions
\quad\stepto
\\ \qquad S; F;
\begin{array}[t]{@{}l@{}}
(\I32.\CONST~d+n-1)~(\I32.\CONST~s+n-1)~(\TABLEGET~y)~(\TABLESET~x) \\
(\I32.\CONST~d+n)~(\I32.\CONST~s+n)~(\TABLEGET~y)~(\TABLESET~x) \\
(\I32.\CONST~d)~(\I32.\CONST~s)~(\I32.\CONST~n)~(\TABLECOPY~x~y) \\
\end{array}
\\ \qquad
Expand Down Expand Up @@ -1722,7 +1724,7 @@ Memory Instructions
\end{array}
\\[1ex]
\begin{array}{lcl@{\qquad}l}
S; F; (\I32.\CONST~k)~(t.\LOAD({N}\K{\_}\sx)^?~\memarg) &\stepto& S; F; \TRAP
S; F; (\I32.\CONST~i)~(t.\LOAD({N}\K{\_}\sx)^?~\memarg) &\stepto& S; F; \TRAP
\end{array}
\\ \qquad
(\otherwise) \\
Expand Down Expand Up @@ -1783,7 +1785,7 @@ Memory Instructions
\end{array}
\\[1ex]
\begin{array}{lcl@{\qquad}l}
S; F; (\I32.\CONST~k)~(\V128.\LOAD{M}\K{x}N\K{\_}\sx~\memarg) &\stepto& S; F; \TRAP
S; F; (\I32.\CONST~i)~(\V128.\LOAD{M}\K{x}N\K{\_}\sx~\memarg) &\stepto& S; F; \TRAP
\end{array}
\\ \qquad
(\otherwise) \\
Expand Down Expand Up @@ -1840,7 +1842,7 @@ Memory Instructions
\end{array}
\\[1ex]
\begin{array}{lcl@{\qquad}l}
S; F; (\I32.\CONST~k)~(\V128.\LOAD{N}\K{\_splat}~\memarg) &\stepto& S; F; \TRAP
S; F; (\I32.\CONST~i)~(\V128.\LOAD{N}\K{\_splat}~\memarg) &\stepto& S; F; \TRAP
\end{array}
\\ \qquad
(\otherwise) \\
Expand Down Expand Up @@ -1895,7 +1897,7 @@ Memory Instructions
\end{array}
\\[1ex]
\begin{array}{lcl@{\qquad}l}
S; F; (\I32.\CONST~k)~(\V128.\LOAD{N}\K{\_zero}~\memarg) &\stepto& S; F; \TRAP
S; F; (\I32.\CONST~i)~(\V128.\LOAD{N}\K{\_zero}~\memarg) &\stepto& S; F; \TRAP
\end{array}
\\ \qquad
(\otherwise) \\
Expand Down Expand Up @@ -1957,7 +1959,7 @@ Memory Instructions
\end{array}
\\[1ex]
\begin{array}{lcl@{\qquad}l}
S; F; (\I32.\CONST~k)~(\V128.\CONST~v)~(\V128.\LOAD{N}\K{\_lane}~\memarg~x) &\stepto& S; F; \TRAP
S; F; (\I32.\CONST~i)~(\V128.\CONST~v)~(\V128.\LOAD{N}\K{\_lane}~\memarg~x) &\stepto& S; F; \TRAP
\end{array}
\\ \qquad
(\otherwise) \\
Expand Down Expand Up @@ -2034,7 +2036,7 @@ Memory Instructions
\end{array}
\\[1ex]
\begin{array}{lcl@{\qquad}l}
S; F; (\I32.\CONST~k)~(t.\CONST~c)~(t.\STORE{N}^?~\memarg) &\stepto& S; F; \TRAP
S; F; (\I32.\CONST~i)~(t.\CONST~c)~(t.\STORE{N}^?~\memarg) &\stepto& S; F; \TRAP
\end{array}
\\ \qquad
(\otherwise) \\
Expand Down Expand Up @@ -2091,7 +2093,7 @@ Memory Instructions
\end{array}
\\[1ex]
\begin{array}{lcl@{\qquad}l}
S; F; (\I32.\CONST~k)~(\V128.\CONST~c)~(\V128.\STORE{N}\K{\_lane}~\memarg~x) &\stepto& S; F; \TRAP
S; F; (\I32.\CONST~i)~(\V128.\CONST~c)~(\V128.\STORE{N}\K{\_lane}~\memarg~x) &\stepto& S; F; \TRAP
\end{array}
\\ \qquad
(\otherwise) \\
Expand Down Expand Up @@ -2368,8 +2370,8 @@ Memory Instructions
\quad\stepto
\\ \qquad S; F;
\begin{array}[t]{@{}l@{}}
(\I32.\CONST~d+n-1) \\
(\I32.\CONST~s+n-1)~(\I32\K{.}\LOAD\K{8\_u}~\{ \OFFSET~0, \ALIGN~0 \}) \\
(\I32.\CONST~d+n) \\
(\I32.\CONST~s+n)~(\I32\K{.}\LOAD\K{8\_u}~\{ \OFFSET~0, \ALIGN~0 \}) \\
(\I32\K{.}\STORE\K{8}~\{ \OFFSET~0, \ALIGN~0 \}) \\
(\I32.\CONST~d)~(\I32.\CONST~s)~(\I32.\CONST~n)~\MEMORYCOPY \\
\end{array}
Expand Down Expand Up @@ -2679,7 +2681,7 @@ Control Instructions
:math:`\BRTABLE~l^\ast~l_N`
...........................

1. Assert: due to :ref:`validation <valid-if>`, a value of :ref:`value type <syntax-valtype>` |I32| is on the top of the stack.
1. Assert: due to :ref:`validation <valid-br_table>`, a value of :ref:`value type <syntax-valtype>` |I32| is on the top of the stack.

2. Pop the value :math:`\I32.\CONST~i` from the stack.

Expand Down Expand Up @@ -2858,22 +2860,22 @@ Exiting :math:`\instr^\ast` with label :math:`L`

When the end of a block is reached without a jump or trap aborting it, then the following steps are performed.

1. Let :math:`m` be the number of values on the top of the stack.
1. Let :math:`n` be the number of values on the top of the stack.

2. Pop the values :math:`\val^m` from the stack.
2. Pop the values :math:`\val^n` from the stack.

3. Assert: due to :ref:`validation <valid-instr-seq>`, the label :math:`L` is now on the top of the stack.
3. Assert: due to :ref:`validation <valid-instr-seq>`, the label :math:`L` is now on the top of the stack and has arity :math:`n`.

4. Pop the label from the stack.

5. Push :math:`\val^m` back to the stack.
5. Push :math:`\val^n` back to the stack.

6. Jump to the position after the |END| of the :ref:`structured control instruction <syntax-instr-control>` associated with the label :math:`L`.

.. math::
~\\[-1ex]
\begin{array}{lcl@{\qquad}l}
\LABEL_n\{\instr^\ast\}~\val^m~\END &\stepto& \val^m
\LABEL_n\{\instr^\ast\}~\val^n~\END &\stepto& \val^n
\end{array}
.. note::
Expand Down Expand Up @@ -2910,15 +2912,13 @@ Invocation of :ref:`function address <syntax-funcaddr>` :math:`a`

7. Pop the values :math:`\val^n` from the stack.

8. Let :math:`\val_0^\ast` be the list of zero values of types :math:`t^\ast`.

9. Let :math:`F` be the :ref:`frame <syntax-frame>` :math:`\{ \AMODULE~f.\FIMODULE, \ALOCALS~\val^n~(\default_t)^\ast \}`.
8. Let :math:`F` be the :ref:`frame <syntax-frame>` :math:`\{ \AMODULE~f.\FIMODULE, \ALOCALS~\val^n~(\default_t)^\ast \}`.

10. Push the activation of :math:`F` with arity :math:`m` to the stack.
9. Push the activation of :math:`F` with arity :math:`m` to the stack.

11. Let :math:`L` be the :ref:`label <syntax-label>` whose arity is :math:`m` and whose continuation is the end of the function.
10. Let :math:`L` be the :ref:`label <syntax-label>` whose arity is :math:`m` and whose continuation is the end of the function.

12. :ref:`Enter <exec-instr-seq-enter>` the instruction sequence :math:`\instr^\ast` with label :math:`L`.
11. :ref:`Enter <exec-instr-seq-enter>` the instruction sequence :math:`\instr^\ast` with label :math:`L`.

.. math::
~\\[-1ex]
Expand Down
12 changes: 8 additions & 4 deletions document/core/exec/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,11 @@ It is up to the :ref:`embedder <embedder>` to define how such conditions are rep

f. :ref:`Execute <exec-elem.drop>` the instruction :math:`\ELEMDROP~i`.

15. 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:
15. For each :ref:`element segment <syntax-elem>` :math:`\elem_i` in :math:`\module.\MELEMS` whose :ref:`mode <syntax-elemmode>` is of the form :math:`\EDECLARATIVE`, do:

a. :ref:`Execute <exec-elem.drop>` the instruction :math:`\ELEMDROP~i`.

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:

a. Assert: :math:`\memidx_i` is :math:`0`.

Expand All @@ -685,15 +689,15 @@ It is up to the :ref:`embedder <embedder>` to define how such conditions are rep

g. :ref:`Execute <exec-data.drop>` the instruction :math:`\DATADROP~i`.

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

a. Let :math:`\start` be the :ref:`start function <syntax-start>` :math:`\module.\MSTART`.

b. :ref:`Execute <exec-call>` the instruction :math:`\CALL~\start.\SFUNC`.

17. Assert: due to :ref:`validation <valid-module>`, the frame :math:`F` is now on the top of the stack.
18. Assert: due to :ref:`validation <valid-module>`, the frame :math:`F` is now on the top of the stack.

18. Pop the frame :math:`F` from the stack.
19. Pop the frame :math:`F` from the stack.


.. math::
Expand Down
Loading

0 comments on commit dd72ab9

Please sign in to comment.