Skip to content

Commit 26f1b78

Browse files
authored
Merge pull request #87 from ngzhian/merge-upstream
Merge upstream
2 parents aff5ae0 + e1759af commit 26f1b78

15 files changed

+130
-89
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
---------------------
2222
"""
2323

24+
FOOTER = """\
25+
26+
.. note::
27+
Multi-byte opcodes are given with the shortest possible encoding in the table.
28+
However, what is following the first byte is actually a :ref:`u32 <binary-uint>` with variable-length encoding
29+
and consequently has multiple possible representations.\
30+
"""
31+
2432
COLUMNS = [
2533
'Instruction',
2634
'Binary Opcode',
@@ -591,3 +599,4 @@ def Row(columns):
591599
print(Row(instr), file=f)
592600

593601
print(DIVIDER, file=f)
602+
print(FOOTER, file=f)

document/core/appendix/index-instructions.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,3 +516,8 @@ Instruction Binary Opcode
516516
:math:`\F64X2.\VCONVERT\K{\_low\_i32x4\_s}` :math:`\hex{FD}~~\hex{FE}~~\hex{01}` :math:`[\V128] \to [\V128]` :ref:`validation <valid-vcvtop>` :ref:`execution <exec-vcvtop>`, :ref:`operator <op-convert_s>`
517517
:math:`\F64X2.\VCONVERT\K{\_low\_i32x4\_u}` :math:`\hex{FD}~~\hex{FF}~~\hex{01}` :math:`[\V128] \to [\V128]` :ref:`validation <valid-vcvtop>` :ref:`execution <exec-vcvtop>`, :ref:`operator <op-convert_u>`
518518
================================================= ==================================== ============================================= ============================================= ==================================================================
519+
520+
.. note::
521+
Multi-byte opcodes are given with the shortest possible encoding in the table.
522+
However, what is following the first byte is actually a :ref:`u32 <binary-uint>` with variable-length encoding
523+
and consequently has multiple possible representations.

document/core/appendix/index-rules.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Construct Judgement
5555
:ref:`Table instance <valid-tableinst>` :math:`S \vdashtableinst \tableinst : \tabletype`
5656
:ref:`Memory instance <valid-meminst>` :math:`S \vdashmeminst \meminst : \memtype`
5757
:ref:`Global instance <valid-globalinst>` :math:`S \vdashglobalinst \globalinst : \globaltype`
58-
:ref:`Element instance <valid-eleminst>` :math:`S \vdasheleminst \eleminst \ok`
58+
:ref:`Element instance <valid-eleminst>` :math:`S \vdasheleminst \eleminst : t`
5959
:ref:`Data instance <valid-datainst>` :math:`S \vdashdatainst \datainst \ok`
6060
:ref:`Export instance <valid-exportinst>` :math:`S \vdashexportinst \exportinst \ok`
6161
:ref:`Module instance <valid-moduleinst>` :math:`S \vdashmoduleinst \moduleinst : C`

document/core/appendix/properties.rst

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Module instances are classified by *module contexts*, which are regular :ref:`co
8787

8888
* Each :ref:`global instance <syntax-globalinst>` :math:`\globalinst_i` in :math:`S.\SGLOBALS` must be :ref:`valid <valid-globalinst>` with some :ref:`global type <syntax-globaltype>` :math:`\globaltype_i`.
8989

90-
* Each :ref:`element instance <syntax-eleminst>` :math:`\eleminst_i` in :math:`S.\SELEMS` must be :ref:`valid <valid-eleminst>`.
90+
* Each :ref:`element instance <syntax-eleminst>` :math:`\eleminst_i` in :math:`S.\SELEMS` must be :ref:`valid <valid-eleminst>` with some :ref:`reference type <syntax-reftype>` :math:`\reftype_i`.
9191

9292
* Each :ref:`data instance <syntax-datainst>` :math:`\datainst_i` in :math:`S.\SDATAS` must be :ref:`valid <valid-datainst>`.
9393

@@ -105,7 +105,7 @@ Module instances are classified by *module contexts*, which are regular :ref:`co
105105
\qquad
106106
(S \vdashglobalinst \globalinst : \globaltype)^\ast
107107
\\
108-
(S \vdasheleminst \eleminst \ok)^\ast
108+
(S \vdasheleminst \eleminst : \reftype)^\ast
109109
\qquad
110110
(S \vdashdatainst \datainst \ok)^\ast
111111
\\
@@ -285,13 +285,13 @@ Module instances are classified by *module contexts*, which are regular :ref:`co
285285

286286
* The :ref:`reference <syntax-ref>` :math:`\reff_i` must be :ref:`valid <valid-ref>` with :ref:`reference type <syntax-reftype>` :math:`t`.
287287

288-
* Then the table instance is valid.
288+
* Then the element instance is valid with :ref:`reference type <syntax-reftype>` :math:`t`.
289289

290290
.. math::
291291
\frac{
292292
(S \vdash \reff : t)^\ast
293293
}{
294-
S \vdasheleminst \{ \EITYPE~t, \EIELEM~\reff^\ast \} \ok
294+
S \vdasheleminst \{ \EITYPE~t, \EIELEM~\reff^\ast \} : t
295295
}
296296
297297
@@ -344,7 +344,7 @@ Module instances are classified by *module contexts*, which are regular :ref:`co
344344

345345
* For each :ref:`global address <syntax-globaladdr>` :math:`\globaladdr_i` in :math:`\moduleinst.\MIGLOBALS`, the :ref:`external value <syntax-externval>` :math:`\EVGLOBAL~\globaladdr_i` must be :ref:`valid <valid-externval-global>` with some :ref:`external type <syntax-externtype>` :math:`\ETGLOBAL~\globaltype_i`.
346346

347-
* For each :ref:`element address <syntax-elemaddr>` :math:`\elemaddr_i` in :math:`\moduleinst.\MIELEMS`, the :ref:`element instance <syntax-eleminst>` :math:`S.\SELEMS[\elemaddr_i]` must be :ref:`valid <valid-eleminst>`.
347+
* For each :ref:`element address <syntax-elemaddr>` :math:`\elemaddr_i` in :math:`\moduleinst.\MIELEMS`, the :ref:`element instance <syntax-eleminst>` :math:`S.\SELEMS[\elemaddr_i]` must be :ref:`valid <valid-eleminst>` with some :ref:`reference type <syntax-reftype>` :math:`\reftype_i`.
348348

349349
* For each :ref:`data address <syntax-dataaddr>` :math:`\dataaddr_i` in :math:`\moduleinst.\MIDATAS`, the :ref:`data instance <syntax-datainst>` :math:`S.\SDATAS[\dataaddr_i]` must be :ref:`valid <valid-datainst>`.
350350

@@ -360,8 +360,12 @@ Module instances are classified by *module contexts*, which are regular :ref:`co
360360

361361
* Let :math:`\globaltype^\ast` be the concatenation of all :math:`\globaltype_i` in order.
362362

363-
* | Then the module instance is valid with :ref:`context <context>`
364-
| :math:`\{\CTYPES~\functype^\ast, \CFUNCS~{\functype'}^\ast, \CTABLES~\tabletype^\ast, \CMEMS~\memtype^\ast, \CGLOBALS~\globaltype^\ast\}`.
363+
* Let :math:`\reftype^\ast` be the concatenation of all :math:`\reftype_i` in order.
364+
365+
* Let :math:`n` be the length of :math:`\moduleinst.\MIDATAS`.
366+
367+
* Then the module instance is valid with :ref:`context <context>`
368+
:math:`\{\CTYPES~\functype^\ast,` :math:`\CFUNCS~{\functype'}^\ast,` :math:`\CTABLES~\tabletype^\ast,` :math:`\CMEMS~\memtype^\ast,` :math:`\CGLOBALS~\globaltype^\ast,` :math:`\CELEMS~\reftype^\ast,` :math:`\CDATAS~{\ok}^n\}`.
365369

366370
.. math::
367371
~\\[-1ex]
@@ -377,9 +381,9 @@ Module instances are classified by *module contexts*, which are regular :ref:`co
377381
\qquad
378382
(S \vdashexternval \EVGLOBAL~\globaladdr : \ETGLOBAL~\globaltype)^\ast
379383
\\
380-
(S \vdasheleminst S.\SELEMS[\elemaddr] \ok)^\ast
384+
(S \vdasheleminst S.\SELEMS[\elemaddr] : \reftype)^\ast
381385
\qquad
382-
(S \vdashdatainst S.\SDATAS[\dataaddr] \ok)^\ast
386+
(S \vdashdatainst S.\SDATAS[\dataaddr] \ok)^n
383387
\\
384388
(S \vdashexportinst \exportinst \ok)^\ast
385389
\qquad
@@ -394,14 +398,16 @@ Module instances are classified by *module contexts*, which are regular :ref:`co
394398
\MIMEMS & \memaddr^\ast, \\
395399
\MIGLOBALS & \globaladdr^\ast, \\
396400
\MIELEMS & \elemaddr^\ast, \\
397-
\MIDATAS & \dataaddr^\ast, \\
401+
\MIDATAS & \dataaddr^n, \\
398402
\MIEXPORTS & \exportinst^\ast ~\} : \{
399403
\begin{array}[t]{@{}l@{~}l@{}}
400404
\CTYPES & \functype^\ast, \\
401405
\CFUNCS & {\functype'}^\ast, \\
402406
\CTABLES & \tabletype^\ast, \\
403407
\CMEMS & \memtype^\ast, \\
404-
\CGLOBALS & \globaltype^\ast ~\}
408+
\CGLOBALS & \globaltype^\ast, \\
409+
\CELEMS & \reftype^\ast, \\
410+
\CDATAS & {\ok}^n ~\}
405411
\end{array}
406412
\end{array}
407413
}

document/core/binary/instructions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ All other vector instructions are plain opcodes without any immediates.
614614
\hex{FD}~~216{:}\Bu32 &\Rightarrow& \I64X2.\VLT\K{\_s} \\ &&|&
615615
\hex{FD}~~217{:}\Bu32 &\Rightarrow& \I64X2.\VGT\K{\_s} \\ &&|&
616616
\hex{FD}~~218{:}\Bu32 &\Rightarrow& \I64X2.\VLE\K{\_s} \\ &&|&
617-
\hex{FD}~~219{:}\Bu32 &\Rightarrow& \I64X2.\VGE\K{\_s} \\ &&|&
617+
\hex{FD}~~219{:}\Bu32 &\Rightarrow& \I64X2.\VGE\K{\_s} \\
618618
\end{array}
619619
620620
.. _binary-vfrelop:

document/core/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
#
8989
# This is also used if you do content translation via gettext catalogs.
9090
# Usually you set "language" from the command line for these cases.
91-
language = None
91+
language = 'en'
9292

9393
# There are two options for replacing |today|: either, you set today to some
9494
# non-false value, then it is used:

document/core/exec/instructions.rst

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2587,37 +2587,27 @@ Control Instructions
25872587
:math:`\IF~\blocktype~\instr_1^\ast~\ELSE~\instr_2^\ast~\END`
25882588
.............................................................
25892589

2590-
1. Assert: due to :ref:`validation <valid-blocktype>`, :math:`\expand_F(\blocktype)` is defined.
2591-
2592-
2. Let :math:`[t_1^m] \to [t_2^n]` be the :ref:`function type <syntax-functype>` :math:`\expand_F(\blocktype)`.
2593-
2594-
3. Let :math:`L` be the label whose arity is :math:`n` and whose continuation is the end of the |IF| instruction.
2595-
2596-
4. Assert: due to :ref:`validation <valid-if>`, a value of :ref:`value type <syntax-valtype>` |I32| is on the top of the stack.
2597-
2598-
5. Pop the value :math:`\I32.\CONST~c` from the stack.
2599-
2600-
6. Assert: due to :ref:`validation <valid-if>`, there are at least :math:`m` values on the top of the stack.
2590+
1. Assert: due to :ref:`validation <valid-if>`, a value of :ref:`value type <syntax-valtype>` |I32| is on the top of the stack.
26012591

2602-
7. Pop the values :math:`\val^m` from the stack.
2592+
2. Pop the value :math:`\I32.\CONST~c` from the stack.
26032593

2604-
8. If :math:`c` is non-zero, then:
2594+
3. If :math:`c` is non-zero, then:
26052595

2606-
a. :ref:`Enter <exec-instr-seq-enter>` the block :math:`\val^m~\instr_1^\ast` with label :math:`L`.
2596+
a. Execute the block instruction :math:`\BLOCK~\X{bt}~\instr_1^\ast~\END`.
26072597

2608-
9. Else:
2598+
4. Else:
26092599

2610-
a. :ref:`Enter <exec-instr-seq-enter>` the block :math:`\val^m~\instr_2^\ast` with label :math:`L`.
2600+
a. Execute the block instruction :math:`\BLOCK~\X{bt}~\instr_2^\ast~\END`.
26112601

26122602
.. math::
26132603
~\\[-1ex]
26142604
\begin{array}{lcl}
2615-
F; \val^m~(\I32.\CONST~c)~\IF~\X{bt}~\instr_1^\ast~\ELSE~\instr_2^\ast~\END &\stepto&
2616-
F; \LABEL_n\{\epsilon\}~\val^m~\instr_1^\ast~\END
2617-
\\&&\quad (\iff c \neq 0 \wedge \expand_F(\X{bt}) = [t_1^m] \to [t_2^n]) \\
2618-
F; \val^m~(\I32.\CONST~c)~\IF~\X{bt}~\instr_1^\ast~\ELSE~\instr_2^\ast~\END &\stepto&
2619-
F; \LABEL_n\{\epsilon\}~\val^m~\instr_2^\ast~\END
2620-
\\&&\quad (\iff c = 0 \wedge \expand_F(\X{bt}) = [t_1^m] \to [t_2^n]) \\
2605+
F; (\I32.\CONST~c)~\IF~\X{bt}~\instr_1^\ast~\ELSE~\instr_2^\ast~\END &\stepto&
2606+
F; \BLOCK~\X{bt}~\instr_1^\ast~\END
2607+
\\&&\quad (\iff c \neq 0) \\
2608+
F; (\I32.\CONST~c)~\IF~\X{bt}~\instr_1^\ast~\ELSE~\instr_2^\ast~\END &\stepto&
2609+
F; \BLOCK~\X{bt}~\instr_2^\ast~\END
2610+
\\&&\quad (\iff c = 0) \\
26212611
\end{array}
26222612
26232613

document/core/exec/numerics.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ When a number is stored into :ref:`memory <syntax-mem>`, it is converted into a
177177
\littleendian(d^8~{d'}^\ast~) &=& \littleendian({d'}^\ast)~\ibits_8^{-1}(d^8) \\
178178
\end{array}
179179
180-
Again these functions are invertable bijections.
180+
Again these functions are invertible bijections.
181181

182182

183183
.. index:: numeric vectors, shape

document/core/syntax/modules.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Conventions
106106

107107
* The meta variables :math:`x, y` range over indices in any of the other index spaces.
108108

109-
* The notation :math:`\F{idx}(A)` denotes the set of indices from index space :math:`\X{idx}` occurring free in :math:`A`. We sometimes reinterpret this set as the :ref:`vector <syntax-vec>` of its elements.
109+
* The notation :math:`\F{idx}(A)` denotes the set of indices from index space :math:`\X{idx}` occurring free in :math:`A`. Sometimes this set is reinterpreted as the :ref:`vector <syntax-vec>` of its elements.
110110

111111
.. note::
112112
For example, if :math:`\instr^\ast` is :math:`(\DATADROP~x) (\MEMORYINIT~y)`, then :math:`\freedataidx(\instr^\ast) = \{x, y\}`, or equivalently, the vector :math:`x~y`.

document/core/valid/conventions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ In addition to field access written :math:`C.\K{field}` the following notation i
7979
* :math:`C,\K{field}\,A^\ast` denotes the same context as :math:`C` but with the elements :math:`A^\ast` prepended to its :math:`\K{field}` component sequence.
8080

8181
.. note::
82-
We use :ref:`indexing notation <notation-index>` like :math:`C.\CLABELS[i]` to look up indices in their respective :ref:`index space <syntax-index>` in the context.
82+
:ref:`Indexing notation <notation-index>` like :math:`C.\CLABELS[i]` is used to look up indices in their respective :ref:`index space <syntax-index>` in the context.
8383
Context extension notation :math:`C,\K{field}\,A` is primarily used to locally extend *relative* index spaces, such as :ref:`label indices <syntax-labelidx>`.
8484
Accordingly, the notation is defined to append at the *front* of the respective sequence, introducing a new relative index :math:`0` and shifting the existing ones.
8585

0 commit comments

Comments
 (0)