Skip to content

Commit c05f73c

Browse files
committed
Context extension notation
1 parent 5c2ab5a commit c05f73c

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

document/core/valid/conventions.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,12 @@ In addition to field access written :math:`C.\K{field}` the following notation i
6969
* When spelling out a context, empty fields are omitted.
7070
Likewise, the |CRETURN| field may be omitted when it is |NORETURN|.
7171

72-
* :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.
72+
* The notation :math:`\K{field}\,A^\ast, C` denotes the same context as :math:`C` but with the elements :math:`A^\ast` prepended to its :math:`\K{field}` component sequence.
7373

7474
.. note::
75-
This notation is defined to *prepend* not *append*.
76-
It is only used in situations where the original :math:`C.\K{field}` is either empty
75+
The notation for context extension is only used in situations where the original :math:`C.\K{field}` is either empty
7776
or :math:`\K{field}` is :math:`\K{labels}`.
78-
In the latter case adding to the front is desired
79-
because the :ref:`label index <syntax-labelidx>` space is indexed relatively, that is, in reverse order of addition.
77+
It is reversed from usual conventions because it *prepends* not *appends*, in accordance with the use of relative indexing to look up a label in the context's label list.
8078

8179

8280
.. _valid-notation-textual:

document/core/valid/instructions.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ Control Instructions
477477

478478
.. math::
479479
\frac{
480-
C,\CLABELS\,[t^?] \vdashinstrseq \instr^\ast : [] \to [t^?]
480+
\CLABELS\,[t^?], C \vdashinstrseq \instr^\ast : [] \to [t^?]
481481
}{
482482
C \vdashinstr \BLOCK~[t^?]~\instr^\ast~\END : [] \to [t^?]
483483
}
@@ -501,7 +501,7 @@ Control Instructions
501501

502502
.. math::
503503
\frac{
504-
C,\CLABELS\,[] \vdashinstrseq \instr^\ast : [] \to [t^?]
504+
\CLABELS\,[], C \vdashinstrseq \instr^\ast : [] \to [t^?]
505505
}{
506506
C \vdashinstr \LOOP~[t^?]~\instr^\ast~\END : [] \to [t^?]
507507
}
@@ -528,9 +528,9 @@ Control Instructions
528528

529529
.. math::
530530
\frac{
531-
C,\CLABELS\,[t^?] \vdashinstrseq \instr_1^\ast : [] \to [t^?]
531+
\CLABELS\,[t^?], C \vdashinstrseq \instr_1^\ast : [] \to [t^?]
532532
\qquad
533-
C,\CLABELS\,[t^?] \vdashinstrseq \instr_2^\ast : [] \to [t^?]
533+
\CLABELS\,[t^?], C \vdashinstrseq \instr_2^\ast : [] \to [t^?]
534534
}{
535535
C \vdashinstr \IF~[t^?]~\instr_1^\ast~\ELSE~\instr_2^\ast~\END : [\I32] \to [t^?]
536536
}
@@ -787,4 +787,7 @@ Constant Expressions
787787
}
788788
789789
.. note::
790+
Currently, constant expressions occurring as initializers of :ref:`globals <syntax-global>` are further constrained in that contained |GETGLOBAL| instructions are only allowed to refer to *imported* globals.
791+
This is enforced in the :ref:`validation rule for modules <valid-module>` by constraining the context :math:`C` accordingly.
792+
790793
The definition of constant expression may be extended in future versions of WebAssembly.

document/core/valid/modules.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Functions :math:`\func` are classified by :ref:`function types <syntax-functype>
4242
\frac{
4343
C.\CTYPES[x] = [t_1^\ast] \to [t_2^?]
4444
\qquad
45-
C,\CLOCALS\,t_1^\ast~t^\ast,\CLABELS~[t_2^?],\CRETURN~[t_2^?] \vdashexpr \expr : [t_2^?]
45+
\CLOCALS\,t_1^\ast~t^\ast,\CLABELS~[t_2^?],\CRETURN~[t_2^?], C \vdashexpr \expr : [t_2^?]
4646
}{
4747
C \vdashfunc \{ \FTYPE~x, \FLOCALS~t^\ast, \FBODY~\expr \} : [t_1^\ast] \to [t_2^?]
4848
}
@@ -454,16 +454,16 @@ Instead, the context :math:`C` for validation of the module's content is constru
454454
* :math:`C.\CTYPES` is :math:`\module.\MTYPES`,
455455

456456
* :math:`C.\CFUNCS` is :math:`\etfuncs(\X{it}^\ast)` concatenated with :math:`\X{ft}^\ast`,
457-
with the import's :ref:`external types <syntax-extentype>` :math:`\X{it}^\ast` and the internal :math:`function types <syntax-functype>` :math:`\X{ft}^\ast` as determined below,
457+
with the import's :ref:`external types <syntax-externtype>` :math:`\X{it}^\ast` and the internal :math:`function types <syntax-functype>` :math:`\X{ft}^\ast` as determined below,
458458

459459
* :math:`C.\CTABLES` is :math:`\ettables(\X{it}^\ast)` concatenated with :math:`\X{tt}^\ast`,
460-
with the import's :ref:`external types <syntax-extentype>` :math:`\X{it}^\ast` and the internal :math:`table types <syntax-tabletype>` :math:`\X{tt}^\ast` as determined below,
460+
with the import's :ref:`external types <syntax-externtype>` :math:`\X{it}^\ast` and the internal :math:`table types <syntax-tabletype>` :math:`\X{tt}^\ast` as determined below,
461461

462462
* :math:`C.\CMEMS` is :math:`\etmems(\X{it}^\ast)` concatenated with :math:`\X{mt}^\ast`,
463-
with the import's :ref:`external types <syntax-extentype>` :math:`\X{it}^\ast` and the internal :math:`memory types <syntax-memtype>` :math:`\X{mt}^\ast` as determined below,
463+
with the import's :ref:`external types <syntax-externtype>` :math:`\X{it}^\ast` and the internal :math:`memory types <syntax-memtype>` :math:`\X{mt}^\ast` as determined below,
464464

465465
* :math:`C.\CGLOBALS` is :math:`\etglobals(\X{it}^\ast)` concatenated with :math:`\X{gt}^\ast`,
466-
with the import's :ref:`external types <syntax-extentype>` :math:`\X{it}^\ast` and the internal :math:`global types <syntax-globaltype>` :math:`\X{gt}^\ast` as determined below,
466+
with the import's :ref:`external types <syntax-externtype>` :math:`\X{it}^\ast` and the internal :math:`global types <syntax-globaltype>` :math:`\X{gt}^\ast` as determined below,
467467

468468
* :math:`C.\CLOCALS` is empty,
469469

0 commit comments

Comments
 (0)