Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit 87c964f

Browse files
committed
Merge upstream.
2 parents a2f24ee + 036365a commit 87c964f

28 files changed

+220
-141
lines changed

.github/workflows/main.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ jobs:
1919
with:
2020
ocaml-compiler: 4.12.x
2121
- run: opam install --yes ocamlbuild.0.14.0
22-
- run: cd interpreter && opam exec make all
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v1
24+
with:
25+
node-version: 18.x
26+
- run: cd interpreter && opam exec make JS=node all
2327

2428
ref-interpreter-js-library:
2529
runs-on: ubuntu-latest
@@ -60,6 +64,9 @@ jobs:
6064
- uses: actions/checkout@v2
6165
with:
6266
submodules: "recursive"
67+
- uses: actions/setup-node@v3
68+
with:
69+
node-version: 16
6370
- run: pip install bikeshed && bikeshed update
6471
- run: pip install six
6572
- run: sudo apt-get update -y && sudo apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended

document/core/appendix/gen-index-instructions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,10 @@ def Instruction(name, opcode, type=None, validation=None, execution=None, operat
427427
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'),
428428
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'),
429429
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'),
430-
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'),
431-
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'),
432-
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'),
433-
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'),
430+
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'),
431+
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'),
432+
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'),
433+
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'),
434434
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'),
435435
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'),
436436
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'),

document/core/appendix/index-instructions.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,10 @@ Instruction Binary Opcode
367367
: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>`
368368
: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>`
369369
: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>`
370-
: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>`
371-
: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>`
372-
: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>`
373-
: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>`
370+
: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>`
371+
: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>`
372+
: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>`
373+
: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>`
374374
: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>`
375375
: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>`
376376
: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>`

document/core/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@
297297
'pointsize': '10pt',
298298

299299
# Additional stuff for the LaTeX preamble.
300-
'preamble': '',
300+
# Don't type-set cross references with emphasis.
301+
'preamble': '\\renewcommand\\sphinxcrossref[1]{#1}\n',
301302

302303
# Latex figure (float) alignment
303304
'figure_align': 'htbp',

document/core/exec/instructions.rst

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ Most vector instructions are defined in terms of generic numeric operators appli
394394
.. math::
395395
\begin{array}{l}
396396
\begin{array}{lcl@{\qquad}l}
397-
(\V128\K{.}\VCONST~c_1)~(\V128\K{.}\VCONST~c_2)~\V128\K{.}\SWIZZLE &\stepto& (\V128\K{.}\VCONST~c')
397+
(\V128\K{.}\VCONST~c_1)~(\V128\K{.}\VCONST~c_2)~\I8X16\K{.}\SWIZZLE &\stepto& (\V128\K{.}\VCONST~c')
398398
\end{array}
399399
\\ \qquad
400400
\begin{array}[t]{@{}r@{~}l@{}}
@@ -431,7 +431,7 @@ Most vector instructions are defined in terms of generic numeric operators appli
431431
.. math::
432432
\begin{array}{l}
433433
\begin{array}{lcl@{\qquad}l}
434-
(\V128\K{.}\VCONST~c_1)~(\V128\K{.}\VCONST~c_2)~\V128\K{.}\SHUFFLE~x^\ast &\stepto& (\V128\K{.}\VCONST~c)
434+
(\V128\K{.}\VCONST~c_1)~(\V128\K{.}\VCONST~c_2)~\I8X16\K{.}\SHUFFLE~x^\ast &\stepto& (\V128\K{.}\VCONST~c)
435435
\end{array}
436436
\\ \qquad
437437
\begin{array}[t]{@{}r@{~}l@{}}
@@ -1312,7 +1312,7 @@ Table Instructions
13121312
\end{array}
13131313
\\[1ex]
13141314
\begin{array}{lcl@{\qquad}l}
1315-
S; F; (\I32.\CONST~n)~(\TABLEGROW~x) &\stepto& S; F; (\I32.\CONST~\signed_{32}^{-1}(-1))
1315+
S; F; \val~(\I32.\CONST~n)~(\TABLEGROW~x) &\stepto& S; F; (\I32.\CONST~\signed_{32}^{-1}(-1))
13161316
\end{array}
13171317
\end{array}
13181318
@@ -2244,7 +2244,7 @@ Memory Instructions
22442244
S; F; (\I32.\CONST~d)~\val~(\I32.\CONST~n)~\MEMORYFILL
22452245
\quad\stepto\quad S; F; \TRAP
22462246
\\ \qquad
2247-
(\iff d + n > |S.\SMEMS[F.\AMODULE.\MIMEMS[x]].\MIDATA|)
2247+
(\iff d + n > |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA|)
22482248
\\[1ex]
22492249
S; F; (\I32.\CONST~d)~\val~(\I32.\CONST~0)~\MEMORYFILL
22502250
\quad\stepto\quad S; F; \epsilon
@@ -2451,7 +2451,7 @@ Memory Instructions
24512451
\\ \qquad
24522452
\begin{array}[t]{@{}r@{~}l@{}}
24532453
(\iff & s + n > |S.\SDATAS[F.\AMODULE.\MIDATAS[x]].\DIDATA| \\
2454-
\vee & d + n > |S.\SMEMS[F.\AMODULE.\MIMEMS[x]].\MIDATA|) \\[1ex]
2454+
\vee & d + n > |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA|) \\[1ex]
24552455
\end{array}
24562456
\\[1ex]
24572457
S; F; (\I32.\CONST~d)~(\I32.\CONST~s)~(\I32.\CONST~0)~(\MEMORYINIT~x)
@@ -3143,15 +3143,13 @@ Invocation of :ref:`function address <syntax-funcaddr>` :math:`a`
31433143

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

3146-
8. Let :math:`\val_0^\ast` be the list of zero values of types :math:`t^\ast`.
3147-
3148-
9. Let :math:`F` be the :ref:`frame <syntax-frame>` :math:`\{ \AMODULE~f.\FIMODULE, \ALOCALS~\val^n~(\default_t)^\ast \}`.
3146+
8. Let :math:`F` be the :ref:`frame <syntax-frame>` :math:`\{ \AMODULE~f.\FIMODULE, \ALOCALS~\val^n~(\default_t)^\ast \}`.
31493147

3150-
10. Push the activation of :math:`F` with arity :math:`m` to the stack.
3148+
9. Push the activation of :math:`F` with arity :math:`m` to the stack.
31513149

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

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

31563154
.. math::
31573155
~\\[-1ex]

document/core/exec/modules.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,7 @@ and list of :ref:`reference <syntax-ref>` vectors for the module's :ref:`element
495495

496496
a. Let :math:`\limits_i~t_i` be the :ref:`table type <syntax-tabletype>` :math:`\table_i.\TTYPE`.
497497

498-
b. Let :math:`\tableaddr_i` be the :ref:`table address <syntax-tableaddr>` resulting from :ref:`allocating <alloc-table>` :math:`\table_i.\TTYPE`
499-
with initialization value :math:`\REFNULL~t_i`.
498+
b. Let :math:`\tableaddr_i` be the :ref:`table address <syntax-tableaddr>` resulting from :ref:`allocating <alloc-table>` :math:`\table_i.\TTYPE` with initialization value :math:`\REFNULL~t_i`.
500499

501500
4. For each :ref:`memory <syntax-mem>` :math:`\mem_i` in :math:`\module.\MMEMS`, do:
502501

document/core/exec/runtime.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,17 +510,15 @@ Intuitively, :math:`\instr^\ast` is the *continuation* to execute when the branc
510510
511511
When branching, the empty continuation ends the targeted block, such that execution can proceed with consecutive instructions.
512512

513-
Activations and Frames
514-
......................
513+
Activation Frames
514+
.................
515515

516516
Activation frames carry the return arity :math:`n` of the respective function,
517517
hold the values of its :ref:`locals <syntax-local>` (including arguments) in the order corresponding to their static :ref:`local indices <syntax-localidx>`,
518518
and a reference to the function's own :ref:`module instance <syntax-moduleinst>`:
519519

520520
.. math::
521521
\begin{array}{llll}
522-
\production{activation} & \X{activation} &::=&
523-
\FRAME_n\{\frame\} \\
524522
\production{frame} & \frame &::=&
525523
\{ \ALOCALS~\val^\ast, \AMODULE~\moduleinst \} \\
526524
\end{array}

document/core/static/custom.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ div.admonition p.admonition-title {
4444
div.math {
4545
background-color: #F0F0F0;
4646
padding: 3px 0 3px 0;
47+
overflow-x: auto;
48+
overflow-y: hidden;
4749
}
4850

4951
div.relations {

document/core/syntax/conventions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Grammar Notation
2020

2121
The following conventions are adopted in defining grammar rules for abstract syntax.
2222

23-
* Terminal symbols (atoms) are written in sans-serif font: :math:`\K{i32}, \K{end}`.
23+
* Terminal symbols (atoms) are written in sans-serif font or in symbolic form: :math:`\K{i32}, \K{end}, {\to}, [, ]`.
2424

2525
* Nonterminal symbols are written in italic font: :math:`\X{valtype}, \X{instr}`.
2626

document/core/syntax/instructions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ These operations closely match respective operations available in hardware.
4545
\production{signedness} & \sx &::=&
4646
\K{u} ~|~ \K{s} \\
4747
\production{instruction} & \instr &::=&
48-
\K{i}\X{nn}\K{.}\CONST~\xref{syntax/values}{syntax-int}{\iX{\X{nn}}} ~|~
48+
\K{i}\X{nn}\K{.}\CONST~\xref{syntax/values}{syntax-int}{\uX{\X{nn}}} ~|~
4949
\K{f}\X{nn}\K{.}\CONST~\xref{syntax/values}{syntax-float}{\fX{\X{nn}}} \\&&|&
5050
\K{i}\X{nn}\K{.}\iunop ~|~
5151
\K{f}\X{nn}\K{.}\funop \\&&|&

document/core/text/instructions.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ The following grammar handles the corresponding update to the :ref:`identifier c
3434
\production{label} & \Tlabel_I &::=&
3535
v{:}\Tid &\Rightarrow& \{\ILABELS~v\} \compose I
3636
& (\iff v \notin I.\ILABELS) \\ &&|&
37+
v{:}\Tid &\Rightarrow& \{\ILABELS~v\} \compose (I \with \ILABELS[i] = \epsilon)
38+
& (\iff I.\ILABELS[i] = v) \\ &&|&
3739
\epsilon &\Rightarrow& \{\ILABELS~(\epsilon)\} \compose I \\
3840
\end{array}
3941
@@ -42,6 +44,9 @@ The following grammar handles the corresponding update to the :ref:`identifier c
4244
This effectively shifts all existing labels up by one,
4345
mirroring the fact that control instructions are indexed relatively not absolutely.
4446

47+
If a label with the same name already exists,
48+
then it is shadowed and the earlier label becomes inaccessible.
49+
4550

4651
.. index:: control instructions, structured control, label, block, branch, result type, label index, function index, type index, vector, polymorphism, tag index, exception instructions
4752
pair: text format; instruction
@@ -175,7 +180,7 @@ Reference Instructions
175180
\production{instruction} & \Tplaininstr_I &::=& \dots \\ &&|&
176181
\text{ref.null}~~t{:}\Theaptype &\Rightarrow& \REFNULL~t \\ &&|&
177182
\text{ref.is\_null} &\Rightarrow& \REFISNULL \\ &&|&
178-
\text{ref.func}~~x{:}\Tfuncidx &\Rightarrow& \REFFUNC~x \\ &&|&
183+
\text{ref.func}~~x{:}\Tfuncidx &\Rightarrow& \REFFUNC~x \\
179184
\end{array}
180185
181186
@@ -901,7 +906,7 @@ Vector constant instructions have a mandatory :ref:`shape <syntax-vec-shape>` de
901906
\text{f64x2.convert\_low\_i32x4\_s} &\Rightarrow& \F64X2.\VCONVERT\K{\_low\_i32x4\_s}\\ &&|&
902907
\text{f64x2.convert\_low\_i32x4\_u} &\Rightarrow& \F64X2.\VCONVERT\K{\_low\_i32x4\_u}\\ &&|&
903908
\text{f32x4.demote\_f64x2\_zero} &\Rightarrow& \F32X4.\VDEMOTE\K{\_f64x2\_zero}\\ &&|&
904-
\text{f64x2.promote\_low\_f32x4} &\Rightarrow& \F64X2.\VPROMOTE\K{\_low\_f32x4}\\ &&|&
909+
\text{f64x2.promote\_low\_f32x4} &\Rightarrow& \F64X2.\VPROMOTE\K{\_low\_f32x4}\\
905910
\end{array}
906911
907912

document/core/text/lexical.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The character stream in the source text is divided, from left to right, into a s
4848
\text{(} ~|~ \text{)} ~|~ \Treserved \\
4949
\production{keyword} & \Tkeyword &::=&
5050
(\text{a} ~|~ \dots ~|~ \text{z})~\Tidchar^\ast
51-
\qquad (\mbox{if occurring as a literal terminal in the grammar}) \\
51+
\qquad (\iff~\mbox{occurring as a literal terminal in the grammar}) \\
5252
\production{reserved} & \Treserved &::=&
5353
(\Tidchar ~|~ \Tstring)^+ \\
5454
\end{array}

document/core/text/modules.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ If inline declarations are given, then their types must match the referenced :re
112112
\end{array} \\
113113
\end{array}
114114
115-
The synthesized attribute of a |Ttypeuse| is a pair consisting of both the used :ref:`type index <syntax-typeidx>` and the updated :ref:`identifier context <text-context>` including possible parameter identifiers.
115+
The synthesized attribute of a |Ttypeuse| is a pair consisting of both the used :ref:`type index <syntax-typeidx>` and the local :ref:`identifier context <text-context>` containing possible parameter identifiers.
116116
The following auxiliary function extracts optional identifiers from parameters:
117117

118118
.. math::
@@ -206,7 +206,7 @@ Function definitions can bind a symbolic :ref:`function identifier <text-id>`, a
206206
\text{(}~\text{func}~~\Tid^?~~x,I'{:}\Ttypeuse_I~~
207207
(t{:}\Tlocal)^\ast~~(\X{in}{:}\Tinstr_{I''})^\ast~\text{)} \\ &&& \qquad
208208
\Rightarrow\quad \{ \FTYPE~x, \FLOCALS~t^\ast, \FBODY~\X{in}^\ast~\END \} \\ &&& \qquad\qquad\qquad
209-
(\iff I'' = I' \compose \{\ILOCALS~\F{id}(\Tlocal)^\ast\} \idcwellformed) \\[1ex]
209+
(\iff I'' = I \compose I' \compose \{\ILOCALS~\F{id}(\Tlocal)^\ast\} \idcwellformed) \\[1ex]
210210
\production{local} & \Tlocal &::=&
211211
\text{(}~\text{local}~~\Tid^?~~t{:}\Tvaltype~\text{)}
212212
\quad\Rightarrow\quad t \\

0 commit comments

Comments
 (0)