You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: document/core/valid/instructions.rst
+19-6Lines changed: 19 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,7 @@ and the provided output stack with result values of types :math:`t_2^\ast` that
21
21
Stack types are akin to :ref:`function types <syntax-functype>`,
22
22
except that they allow individual operands to be classified as :math:`\bot` (*bottom*), indicating that the type is unconstrained.
23
23
As an auxiliary notion, an operand type :math:`t_1` *matches* another operand type :math:`t_2`, if :math:`t_1` is either :math:`\bot` or equal to :math:`t_2`.
24
+
This is extended to stack types in a point-wise manner.
24
25
25
26
.. _match-opdtype:
26
27
@@ -35,6 +36,13 @@ As an auxiliary notion, an operand type :math:`t_1` *matches* another operand ty
35
36
\vdash\bot\leq t
36
37
}
37
38
39
+
.. math::
40
+
\frac{
41
+
(\vdash t \leq t')^\ast
42
+
}{
43
+
\vdash [t^\ast] \leq [{t'}^\ast]
44
+
}
45
+
38
46
.. note::
39
47
For example, the instruction :math:`\I32.\ADD` has type :math:`[\I32~\I32] \to [\I32]`,
40
48
consuming two |I32| values and producing one.
@@ -949,23 +957,28 @@ Control Instructions
949
957
:math:`\BRTABLE~l^\ast~l_N`
950
958
...........................
951
959
960
+
952
961
* The label :math:`C.\CLABELS[l_N]` must be defined in the context.
953
962
954
963
* Let :math:`[t^\ast]` be the :ref:`result type <syntax-resulttype>` :math:`C.\CLABELS[l_N]`.
955
964
956
965
* For all :math:`l_i` in :math:`l^\ast`,
957
966
the label :math:`C.\CLABELS[l_i]` must be defined in the context.
958
967
959
-
* For all :math:`l_i` in :math:`l^\ast`,
960
-
:math:`C.\CLABELS[l_i]` must be :math:`[t^\ast]`.
968
+
* There must be a :ref:`result type <syntax-resulttype>` :math:`[t^\ast]`, such that:
969
+
970
+
* For each :ref:`operand type <syntax-opdtype>` :math:`t_j` in :math:`t^\ast` and corresponding type :math:`t'_{Nj}` in :math:`C.\CLABELS[l_N]`, :math:`t_j` :ref:`matches <match-opdtype>` :math:`t'_{Nj}`.
971
+
972
+
* For all :math:`l_i` in :math:`l^\ast`,
973
+
and for each :ref:`operand type <syntax-opdtype>` :math:`t_j` in :math:`t^\ast` and corresponding type :math:`t'_{ij}` in :math:`C.\CLABELS[l_i]`, :math:`t_j` :ref:`matches <match-opdtype>` :math:`t'_{ij}`.
961
974
962
975
* Then the instruction is valid with type :math:`[t_1^\ast~t^\ast~\I32] \to [t_2^\ast]`, for any sequences of :ref:`value types <syntax-valtype>` :math:`t_1^\ast` and :math:`t_2^\ast`.
963
976
964
977
.. math::
965
978
\frac{
966
-
(C.\CLABELS[l] = [t^\ast])^\ast
979
+
(\vdash[t^\ast] \leq C.\CLABELS[l])^\ast
967
980
\qquad
968
-
C.\CLABELS[l_N] = [t^\ast]
981
+
\vdash[t^\ast] \leq C.\CLABELS[l_N]
969
982
}{
970
983
C \vdashinstr\BRTABLE~l^\ast~l_N : [t_1^\ast~t^\ast~\I32] \to [t_2^\ast]
0 commit comments