Skip to content

Commit 62aa16e

Browse files
authored
[spec] Fix minor errors and inconsistencies (#1564)
1 parent 1fb0f3e commit 62aa16e

File tree

4 files changed

+59
-57
lines changed

4 files changed

+59
-57
lines changed

document/core/appendix/properties.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ Module instances are classified by *module contexts*, which are regular :ref:`co
237237
:ref:`Memory Instances <syntax-meminst>` :math:`\{ \MITYPE~\limits, \MIDATA~b^\ast \}`
238238
......................................................................................
239239

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

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

document/core/exec/instructions.rst

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,7 @@ Table Instructions
12561256
.. math::
12571257
\begin{array}{l}
12581258
\begin{array}{lcl@{\qquad}l}
1259-
S; F; \TABLESIZE~x &\stepto& S; F; (\I32.\CONST~\X{sz})
1259+
S; F; (\TABLESIZE~x) &\stepto& S; F; (\I32.\CONST~\X{sz})
12601260
\end{array}
12611261
\\ \qquad
12621262
(\iff |S.\STABLES[F.\AMODULE.\MITABLES[x]].\TIELEM| = \X{sz}) \\
@@ -1288,19 +1288,21 @@ Table Instructions
12881288

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

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

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

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

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

12991301
.. math::
13001302
~\\[-1ex]
13011303
\begin{array}{l}
13021304
\begin{array}{lcl@{\qquad}l}
1303-
S; F; \val~(\I32.\CONST~n)~\TABLEGROW~x &\stepto& S'; F; (\I32.\CONST~\X{sz})
1305+
S; F; \val~(\I32.\CONST~n)~(\TABLEGROW~x) &\stepto& S'; F; (\I32.\CONST~\X{sz})
13041306
\end{array}
13051307
\\ \qquad
13061308
\begin{array}[t]{@{}r@{~}l@{}}
@@ -1310,7 +1312,7 @@ Table Instructions
13101312
\end{array}
13111313
\\[1ex]
13121314
\begin{array}{lcl@{\qquad}l}
1313-
S; F; (\I32.\CONST~n)~\TABLEGROW~x &\stepto& S; F; (\I32.\CONST~{-1})
1315+
S; F; (\I32.\CONST~n)~(\TABLEGROW~x) &\stepto& S; F; (\I32.\CONST~\signed_{32}^{-1}(-1))
13141316
\end{array}
13151317
\end{array}
13161318
@@ -1511,7 +1513,7 @@ Table Instructions
15111513
\quad\stepto
15121514
\\ \qquad S; F;
15131515
\begin{array}[t]{@{}l@{}}
1514-
(\I32.\CONST~d+n-1)~(\I32.\CONST~s+n-1)~(\TABLEGET~y)~(\TABLESET~x) \\
1516+
(\I32.\CONST~d+n)~(\I32.\CONST~s+n)~(\TABLEGET~y)~(\TABLESET~x) \\
15151517
(\I32.\CONST~d)~(\I32.\CONST~s)~(\I32.\CONST~n)~(\TABLECOPY~x~y) \\
15161518
\end{array}
15171519
\\ \qquad
@@ -1722,7 +1724,7 @@ Memory Instructions
17221724
\end{array}
17231725
\\[1ex]
17241726
\begin{array}{lcl@{\qquad}l}
1725-
S; F; (\I32.\CONST~k)~(t.\LOAD({N}\K{\_}\sx)^?~\memarg) &\stepto& S; F; \TRAP
1727+
S; F; (\I32.\CONST~i)~(t.\LOAD({N}\K{\_}\sx)^?~\memarg) &\stepto& S; F; \TRAP
17261728
\end{array}
17271729
\\ \qquad
17281730
(\otherwise) \\
@@ -1783,7 +1785,7 @@ Memory Instructions
17831785
\end{array}
17841786
\\[1ex]
17851787
\begin{array}{lcl@{\qquad}l}
1786-
S; F; (\I32.\CONST~k)~(\V128.\LOAD{M}\K{x}N\K{\_}\sx~\memarg) &\stepto& S; F; \TRAP
1788+
S; F; (\I32.\CONST~i)~(\V128.\LOAD{M}\K{x}N\K{\_}\sx~\memarg) &\stepto& S; F; \TRAP
17871789
\end{array}
17881790
\\ \qquad
17891791
(\otherwise) \\
@@ -1840,7 +1842,7 @@ Memory Instructions
18401842
\end{array}
18411843
\\[1ex]
18421844
\begin{array}{lcl@{\qquad}l}
1843-
S; F; (\I32.\CONST~k)~(\V128.\LOAD{N}\K{\_splat}~\memarg) &\stepto& S; F; \TRAP
1845+
S; F; (\I32.\CONST~i)~(\V128.\LOAD{N}\K{\_splat}~\memarg) &\stepto& S; F; \TRAP
18441846
\end{array}
18451847
\\ \qquad
18461848
(\otherwise) \\
@@ -1895,7 +1897,7 @@ Memory Instructions
18951897
\end{array}
18961898
\\[1ex]
18971899
\begin{array}{lcl@{\qquad}l}
1898-
S; F; (\I32.\CONST~k)~(\V128.\LOAD{N}\K{\_zero}~\memarg) &\stepto& S; F; \TRAP
1900+
S; F; (\I32.\CONST~i)~(\V128.\LOAD{N}\K{\_zero}~\memarg) &\stepto& S; F; \TRAP
18991901
\end{array}
19001902
\\ \qquad
19011903
(\otherwise) \\
@@ -1957,7 +1959,7 @@ Memory Instructions
19571959
\end{array}
19581960
\\[1ex]
19591961
\begin{array}{lcl@{\qquad}l}
1960-
S; F; (\I32.\CONST~k)~(\V128.\CONST~v)~(\V128.\LOAD{N}\K{\_lane}~\memarg~x) &\stepto& S; F; \TRAP
1962+
S; F; (\I32.\CONST~i)~(\V128.\CONST~v)~(\V128.\LOAD{N}\K{\_lane}~\memarg~x) &\stepto& S; F; \TRAP
19611963
\end{array}
19621964
\\ \qquad
19631965
(\otherwise) \\
@@ -2034,7 +2036,7 @@ Memory Instructions
20342036
\end{array}
20352037
\\[1ex]
20362038
\begin{array}{lcl@{\qquad}l}
2037-
S; F; (\I32.\CONST~k)~(t.\CONST~c)~(t.\STORE{N}^?~\memarg) &\stepto& S; F; \TRAP
2039+
S; F; (\I32.\CONST~i)~(t.\CONST~c)~(t.\STORE{N}^?~\memarg) &\stepto& S; F; \TRAP
20382040
\end{array}
20392041
\\ \qquad
20402042
(\otherwise) \\
@@ -2091,7 +2093,7 @@ Memory Instructions
20912093
\end{array}
20922094
\\[1ex]
20932095
\begin{array}{lcl@{\qquad}l}
2094-
S; F; (\I32.\CONST~k)~(\V128.\CONST~c)~(\V128.\STORE{N}\K{\_lane}~\memarg~x) &\stepto& S; F; \TRAP
2096+
S; F; (\I32.\CONST~i)~(\V128.\CONST~c)~(\V128.\STORE{N}\K{\_lane}~\memarg~x) &\stepto& S; F; \TRAP
20952097
\end{array}
20962098
\\ \qquad
20972099
(\otherwise) \\
@@ -2368,8 +2370,8 @@ Memory Instructions
23682370
\quad\stepto
23692371
\\ \qquad S; F;
23702372
\begin{array}[t]{@{}l@{}}
2371-
(\I32.\CONST~d+n-1) \\
2372-
(\I32.\CONST~s+n-1)~(\I32\K{.}\LOAD\K{8\_u}~\{ \OFFSET~0, \ALIGN~0 \}) \\
2373+
(\I32.\CONST~d+n) \\
2374+
(\I32.\CONST~s+n)~(\I32\K{.}\LOAD\K{8\_u}~\{ \OFFSET~0, \ALIGN~0 \}) \\
23732375
(\I32\K{.}\STORE\K{8}~\{ \OFFSET~0, \ALIGN~0 \}) \\
23742376
(\I32.\CONST~d)~(\I32.\CONST~s)~(\I32.\CONST~n)~\MEMORYCOPY \\
23752377
\end{array}
@@ -2679,7 +2681,7 @@ Control Instructions
26792681
:math:`\BRTABLE~l^\ast~l_N`
26802682
...........................
26812683

2682-
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.
2684+
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.
26832685

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

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

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

2861-
1. Let :math:`m` be the number of values on the top of the stack.
2863+
1. Let :math:`n` be the number of values on the top of the stack.
28622864

2863-
2. Pop the values :math:`\val^m` from the stack.
2865+
2. Pop the values :math:`\val^n` from the stack.
28642866

2865-
3. Assert: due to :ref:`validation <valid-instr-seq>`, the label :math:`L` is now on the top of the stack.
2867+
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`.
28662868

28672869
4. Pop the label from the stack.
28682870

2869-
5. Push :math:`\val^m` back to the stack.
2871+
5. Push :math:`\val^n` back to the stack.
28702872

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

28732875
.. math::
28742876
~\\[-1ex]
28752877
\begin{array}{lcl@{\qquad}l}
2876-
\LABEL_n\{\instr^\ast\}~\val^m~\END &\stepto& \val^m
2878+
\LABEL_n\{\instr^\ast\}~\val^n~\END &\stepto& \val^n
28772879
\end{array}
28782880
28792881
.. note::

document/core/exec/runtime.rst

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ or *external references* pointing to an uninterpreted form of :ref:`extern addre
3030

3131
.. math::
3232
\begin{array}{llcl}
33-
\production{(number)} & \num &::=&
33+
\production{number} & \num &::=&
3434
\I32.\CONST~\i32 \\&&|&
3535
\I64.\CONST~\i64 \\&&|&
3636
\F32.\CONST~\f32 \\&&|&
3737
\F64.\CONST~\f64 \\
38-
\production{(vector)} & \vecc &::=&
38+
\production{vector} & \vecc &::=&
3939
\V128.\CONST~\i128 \\
40-
\production{(reference)} & \reff &::=&
40+
\production{reference} & \reff &::=&
4141
\REFNULL~t \\&&|&
4242
\REFFUNCADDR~\funcaddr \\&&|&
4343
\REFEXTERNADDR~\externaddr \\
44-
\production{(value)} & \val &::=&
44+
\production{value} & \val &::=&
4545
\num ~|~ \vecc ~|~ \reff \\
4646
\end{array}
4747
@@ -79,7 +79,7 @@ It is either a sequence of :ref:`values <syntax-val>` or a :ref:`trap <syntax-tr
7979

8080
.. math::
8181
\begin{array}{llcl}
82-
\production{(result)} & \result &::=&
82+
\production{result} & \result &::=&
8383
\val^\ast \\&&|&
8484
\TRAP
8585
\end{array}
@@ -101,7 +101,7 @@ Syntactically, the store is defined as a :ref:`record <notation-record>` listing
101101

102102
.. math::
103103
\begin{array}{llll}
104-
\production{(store)} & \store &::=& \{~
104+
\production{store} & \store &::=& \{~
105105
\begin{array}[t]{l@{~}ll}
106106
\SFUNCS & \funcinst^\ast, \\
107107
\STABLES & \tableinst^\ast, \\
@@ -157,21 +157,21 @@ In addition, an :ref:`embedder <embedder>` may supply an uninterpreted set of *h
157157

158158
.. math::
159159
\begin{array}{llll}
160-
\production{(address)} & \addr &::=&
160+
\production{address} & \addr &::=&
161161
0 ~|~ 1 ~|~ 2 ~|~ \dots \\
162-
\production{(function address)} & \funcaddr &::=&
162+
\production{function address} & \funcaddr &::=&
163163
\addr \\
164-
\production{(table address)} & \tableaddr &::=&
164+
\production{table address} & \tableaddr &::=&
165165
\addr \\
166-
\production{(memory address)} & \memaddr &::=&
166+
\production{memory address} & \memaddr &::=&
167167
\addr \\
168-
\production{(global address)} & \globaladdr &::=&
168+
\production{global address} & \globaladdr &::=&
169169
\addr \\
170-
\production{(element address)} & \elemaddr &::=&
170+
\production{element address} & \elemaddr &::=&
171171
\addr \\
172-
\production{(data address)} & \dataaddr &::=&
172+
\production{data address} & \dataaddr &::=&
173173
\addr \\
174-
\production{(extern address)} & \externaddr &::=&
174+
\production{extern address} & \externaddr &::=&
175175
\addr \\
176176
\end{array}
177177
@@ -204,7 +204,7 @@ and collects runtime representations of all entities that are imported, defined,
204204

205205
.. math::
206206
\begin{array}{llll}
207-
\production{(module instance)} & \moduleinst &::=& \{
207+
\production{module instance} & \moduleinst &::=& \{
208208
\begin{array}[t]{l@{~}ll}
209209
\MITYPES & \functype^\ast, \\
210210
\MIFUNCS & \funcaddr^\ast, \\
@@ -238,10 +238,10 @@ The module instance is used to resolve references to other definitions during ex
238238

239239
.. math::
240240
\begin{array}{llll}
241-
\production{(function instance)} & \funcinst &::=&
241+
\production{function instance} & \funcinst &::=&
242242
\{ \FITYPE~\functype, \FIMODULE~\moduleinst, \FICODE~\func \} \\ &&|&
243243
\{ \FITYPE~\functype, \FIHOSTCODE~\hostfunc \} \\
244-
\production{(host function)} & \hostfunc &::=& \dots \\
244+
\production{host function} & \hostfunc &::=& \dots \\
245245
\end{array}
246246
247247
A *host function* is a function expressed outside WebAssembly but passed to a :ref:`module <syntax-module>` as an :ref:`import <syntax-import>`.
@@ -268,7 +268,7 @@ It records its :ref:`type <syntax-tabletype>` and holds a vector of :ref:`refere
268268

269269
.. math::
270270
\begin{array}{llll}
271-
\production{(table instance)} & \tableinst &::=&
271+
\production{table instance} & \tableinst &::=&
272272
\{ \TITYPE~\tabletype, \TIELEM~\vec(\reff) \} \\
273273
\end{array}
274274
@@ -292,7 +292,7 @@ It records its :ref:`type <syntax-memtype>` and holds a vector of :ref:`bytes <s
292292

293293
.. math::
294294
\begin{array}{llll}
295-
\production{(memory instance)} & \meminst &::=&
295+
\production{memory instance} & \meminst &::=&
296296
\{ \MITYPE~\memtype, \MIDATA~\vec(\byte) \} \\
297297
\end{array}
298298
@@ -316,7 +316,7 @@ It records its :ref:`type <syntax-globaltype>` and holds an individual :ref:`val
316316

317317
.. math::
318318
\begin{array}{llll}
319-
\production{(global instance)} & \globalinst &::=&
319+
\production{global instance} & \globalinst &::=&
320320
\{ \GITYPE~\globaltype, \GIVALUE~\val \} \\
321321
\end{array}
322322
@@ -338,7 +338,7 @@ It holds a vector of references and their common :ref:`type <syntax-reftype>`.
338338

339339
.. math::
340340
\begin{array}{llll}
341-
\production{(element instance)} & \eleminst &::=&
341+
\production{element instance} & \eleminst &::=&
342342
\{ \EITYPE~\reftype, \EIELEM~\vec(\reff) \} \\
343343
\end{array}
344344
@@ -356,7 +356,7 @@ It holds a vector of :ref:`bytes <syntax-byte>`.
356356

357357
.. math::
358358
\begin{array}{llll}
359-
\production{(data instance)} & \datainst &::=&
359+
\production{data instance} & \datainst &::=&
360360
\{ \DIDATA~\vec(\byte) \} \\
361361
\end{array}
362362
@@ -374,7 +374,7 @@ It defines the export's :ref:`name <syntax-name>` and the associated :ref:`exter
374374

375375
.. math::
376376
\begin{array}{llll}
377-
\production{(export instance)} & \exportinst &::=&
377+
\production{export instance} & \exportinst &::=&
378378
\{ \EINAME~\name, \EIVALUE~\externval \} \\
379379
\end{array}
380380
@@ -392,7 +392,7 @@ It is an :ref:`address <syntax-addr>` denoting either a :ref:`function instance
392392

393393
.. math::
394394
\begin{array}{llcl}
395-
\production{(external value)} & \externval &::=&
395+
\production{external value} & \externval &::=&
396396
\EVFUNC~\funcaddr \\&&|&
397397
\EVTABLE~\tableaddr \\&&|&
398398
\EVMEM~\memaddr \\&&|&
@@ -456,7 +456,7 @@ Labels carry an argument arity :math:`n` and their associated branch *target*, w
456456

457457
.. math::
458458
\begin{array}{llll}
459-
\production{(label)} & \label &::=&
459+
\production{label} & \label &::=&
460460
\LABEL_n\{\instr^\ast\} \\
461461
\end{array}
462462
@@ -485,9 +485,9 @@ and a reference to the function's own :ref:`module instance <syntax-moduleinst>`
485485

486486
.. math::
487487
\begin{array}{llll}
488-
\production{(activation)} & \X{activation} &::=&
488+
\production{activation} & \X{activation} &::=&
489489
\FRAME_n\{\frame\} \\
490-
\production{(frame)} & \frame &::=&
490+
\production{frame} & \frame &::=&
491491
\{ \ALOCALS~\val^\ast, \AMODULE~\moduleinst \} \\
492492
\end{array}
493493
@@ -529,7 +529,7 @@ In order to express the reduction of :ref:`traps <trap>`, :ref:`calls <syntax-ca
529529

530530
.. math::
531531
\begin{array}{llcl}
532-
\production{(administrative instruction)} & \instr &::=&
532+
\production{administrative instruction} & \instr &::=&
533533
\dots \\ &&|&
534534
\TRAP \\ &&|&
535535
\REFFUNCADDR~\funcaddr \\ &&|&
@@ -590,9 +590,9 @@ In order to specify the reduction of :ref:`branches <syntax-instr-control>`, the
590590

591591
.. math::
592592
\begin{array}{llll}
593-
\production{(block contexts)} & \XB^0 &::=&
593+
\production{block contexts} & \XB^0 &::=&
594594
\val^\ast~[\_]~\instr^\ast \\
595-
\production{(block contexts)} & \XB^{k+1} &::=&
595+
\production{block contexts} & \XB^{k+1} &::=&
596596
\val^\ast~\LABEL_n\{\instr^\ast\}~\XB^k~\END~\instr^\ast \\
597597
\end{array}
598598
@@ -624,9 +624,9 @@ that operates relative to a current :ref:`frame <syntax-frame>` referring to the
624624

625625
.. math::
626626
\begin{array}{llcl}
627-
\production{(configuration)} & \config &::=&
627+
\production{configuration} & \config &::=&
628628
\store; \thread \\
629-
\production{(thread)} & \thread &::=&
629+
\production{thread} & \thread &::=&
630630
\frame; \instr^\ast \\
631631
\end{array}
632632
@@ -645,7 +645,7 @@ Finally, the following definition of *evaluation context* and associated structu
645645

646646
.. math::
647647
\begin{array}{llll}
648-
\production{(evaluation contexts)} & E &::=&
648+
\production{evaluation contexts} & E &::=&
649649
[\_] ~|~
650650
\val^\ast~E~\instr^\ast ~|~
651651
\LABEL_n\{\instr^\ast\}~E~\END \\

0 commit comments

Comments
 (0)