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
{{ message }}
This repository was archived by the owner on Apr 25, 2025. It is now read-only.
Address additional review of #222, also fixing label types everywhere. (#241)
This addresses additional review comments to PR #222, that were made after it was merged.
The last review comment in the discussion suggests to adjust all validation labels to use label types instead of just result types.
Should address all occurrences of validation labels.
Additionally adds a boolean catch_label to control frames in the validation algorithm,
and some related functionality, fixing the cases for opcodes `catch` and `catch_all`.
* Apply suggestions from code review
Co-authored-by: Andreas Rossberg <[email protected]>
Co-authored-by: Heejin Ahn <[email protected]>
* Reverting changes to typing of CAUGHTadm.
Changes to this rule are now done in PR #244
@@ -685,7 +685,6 @@ To that end, all previous typing judgements :math:`C \vdash \X{prop}` are genera
685
685
686
686
* Then the compound instruction is valid under context :math:`C''` with type :math:`[] \to [t^\ast]`.
687
687
688
-
689
688
.. math::
690
689
\frac{
691
690
S \vdashexternval\EVTAG~\tagaddr : \ETTAG~[t_0^\ast]\to[]
@@ -722,7 +721,7 @@ To that end, all previous typing judgements :math:`C \vdash \X{prop}` are genera
722
721
723
722
* The instruction sequence :math:`\instr_0^\ast` must be :ref:`valid <valid-instr-seq>` with some type :math:`[t_1^n] \to [t_2^*]`.
724
723
725
-
* Let :math:`C'` be the same :ref:`context <context>` as :math:`C`, but with the :ref:`result type <syntax-resulttype>` :math:`[t_1^n]` prepended to the |CLABELS| vector.
724
+
* Let :math:`C'` be the same :ref:`context <context>` as :math:`C`, but with the :ref:`label type <syntax-labeltype>` :math:`[t_1^n]` prepended to the |CLABELS| vector.
726
725
727
726
* Under context :math:`C'`,
728
727
the instruction sequence :math:`\instr^\ast` must be :ref:`valid <valid-instr-seq>` with type :math:`[] \to [t_2^*]`.
Copy file name to clipboardExpand all lines: document/core/valid/instructions.rst
+21-19Lines changed: 21 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -1234,7 +1234,7 @@ Memory Instructions
1234
1234
}
1235
1235
1236
1236
1237
-
.. index:: control instructions, structured control, label, block, branch, block type, label index, function index, type index, tag index, vector, polymorphism, context
1237
+
.. index:: control instructions, structured control, label, block, branch, block type, label index, label type, function index, type index, tag index, vector, polymorphism, context
1238
1238
pair: validation; instruction
1239
1239
single: abstract syntax; instruction
1240
1240
.. _valid-label:
@@ -1281,7 +1281,7 @@ Control Instructions
1281
1281
1282
1282
* The :ref:`block type <syntax-blocktype>` must be :ref:`valid <valid-blocktype>` as some :ref:`function type <syntax-functype>` :math:`[t_1^\ast] \to [t_2^\ast]`.
1283
1283
1284
-
* Let :math:`C'` be the same :ref:`context <context>` as :math:`C`, but with the :ref:`result type <syntax-resulttype>` :math:`[t_2^\ast]` prepended to the |CLABELS| vector.
1284
+
* Let :math:`C'` be the same :ref:`context <context>` as :math:`C`, but with the :ref:`label type <syntax-labeltype>` :math:`[t_2^\ast]` prepended to the |CLABELS| vector.
1285
1285
1286
1286
* Under context :math:`C'`,
1287
1287
the instruction sequence :math:`\instr^\ast` must be :ref:`valid <valid-instr-seq>` with type :math:`[t_1^\ast] \to [t_2^\ast]`.
@@ -1308,7 +1308,7 @@ Control Instructions
1308
1308
1309
1309
* The :ref:`block type <syntax-blocktype>` must be :ref:`valid <valid-blocktype>` as some :ref:`function type <syntax-functype>` :math:`[t_1^\ast] \to [t_2^\ast]`.
1310
1310
1311
-
* Let :math:`C'` be the same :ref:`context <context>` as :math:`C`, but with the :ref:`result type <syntax-resulttype>` :math:`[t_1^\ast]` prepended to the |CLABELS| vector.
1311
+
* Let :math:`C'` be the same :ref:`context <context>` as :math:`C`, but with the :ref:`label type <syntax-labeltype>` :math:`[t_1^\ast]` prepended to the |CLABELS| vector.
1312
1312
1313
1313
* Under context :math:`C'`,
1314
1314
the instruction sequence :math:`\instr^\ast` must be :ref:`valid <valid-instr-seq>` with type :math:`[t_1^\ast] \to [t_2^\ast]`.
@@ -1335,7 +1335,7 @@ Control Instructions
1335
1335
1336
1336
* The :ref:`block type <syntax-blocktype>` must be :ref:`valid <valid-blocktype>` as some :ref:`function type <syntax-functype>` :math:`[t_1^\ast] \to [t_2^\ast]`.
1337
1337
1338
-
* Let :math:`C'` be the same :ref:`context <context>` as :math:`C`, but with the :ref:`result type <syntax-resulttype>` :math:`[t_2^\ast]` prepended to the |CLABELS| vector.
1338
+
* Let :math:`C'` be the same :ref:`context <context>` as :math:`C`, but with the :ref:`label type <syntax-labeltype>` :math:`[t_2^\ast]` prepended to the |CLABELS| vector.
1339
1339
1340
1340
* Under context :math:`C'`,
1341
1341
the instruction sequence :math:`\instr_1^\ast` must be :ref:`valid <valid-instr-seq>` with type :math:`[t_1^\ast] \to [t_2^\ast]`.
@@ -1368,23 +1368,25 @@ Control Instructions
1368
1368
1369
1369
* The :ref:`block type <syntax-blocktype>` must be :ref:`valid <valid-blocktype>` as some :ref:`function type <syntax-functype>` :math:`[t_1^\ast] \to [t_2^\ast]`.
1370
1370
1371
-
* Let :math:`C'` be the same :ref:`context <context>` as :math:`C`, but with the :ref:`result type <syntax-resulttype>` :math:`[t_2^\ast]` prepended to the |CLABELS| vector.
1371
+
* Let :math:`C'` be the same :ref:`context <context>` as :math:`C`, but with the :ref:`label type <syntax-labeltype>` :math:`[t_2^\ast]` prepended to the |CLABELS| vector.
1372
1372
1373
1373
* Under context :math:`C'`,
1374
1374
the instruction sequence :math:`\instr_1^\ast` must be :ref:`valid <valid-instr-seq>` with type :math:`[t_1^\ast] \to [t_2^\ast]`.
1375
1375
1376
-
* Let :math:`C''` be the same :ref:`context <context>` as :math:`C`, but with the :ref:`label <exec-label>` :math:`\LCATCH~[t_2^\ast]` prepended to the |CLABELS| vector.
1376
+
* Let :math:`C''` be the same :ref:`context <context>` as :math:`C`, but with the :ref:`label type <syntax-labeltype>` :math:`\LCATCH~[t_2^\ast]` prepended to the |CLABELS| vector.
1377
1377
1378
-
* For every :math:`(\CATCH~x~\instr_2^\ast)`:
1378
+
* For every :math:`x_i` and :math:`\instr_{2i}^\ast` in :math:`(\CATCH~x~\instr_2^\ast)^\ast`:
1379
1379
1380
-
* The tag :math:`C.\CTAGS[x]` must be defined in the context :math:`C`.
1380
+
* The tag :math:`C.\CTAGS[x_i]` must be defined in the context :math:`C`.
1381
1381
1382
-
* Let :math:`[t^\ast] \to []` be its :ref:`tag type <syntax-tagtype>`.
1382
+
* Let :math:`[t_{3i}^\ast] \to [t_{4i}^\ast]` be the :ref:`tag type <syntax-tagtype>` :math:`C.\CTAGS[x_i]`.
1383
+
1384
+
* The :ref:`result type <syntax-resulttype>` :math:`[t_{4i}^\ast]` must be empty.
1383
1385
1384
1386
* Under context :math:`C''`,
1385
-
the instruction sequence :math:`\instr_2^\ast` must be :ref:`valid <valid-instr-seq>` with type :math:`[t^\ast] \to [t_2^\ast]`.
1387
+
the instruction sequence :math:`\instr_{2i}^\ast` must be :ref:`valid <valid-instr-seq>` with type :math:`[t_{3i}^\ast] \to [t_2^\ast]`.
1386
1388
1387
-
* If there is a :math:`(\CATCHALL~\instr_3^\ast)`, then:
1389
+
* If :math:`(\CATCHALL~\instr_3^\ast)^?` is not empty, then:
1388
1390
1389
1391
* Under context :math:`C''`,
1390
1392
the instruction sequence :math:`\instr_3^\ast` must be :ref:`valid <valid-instr-seq>` with type :math:`[] \to [t_2^\ast]`.
@@ -1471,9 +1473,9 @@ Control Instructions
1471
1473
1472
1474
* The label :math:`C.\CLABELS[l]` must be defined in the context.
1473
1475
1474
-
* Let :math:`(\LCATCH^?~[t^\ast])` be the :ref:`label type <labeltype>` :math:`C.\CLABELS[l]`.
1476
+
* Let :math:`(\LCATCH^?~[t^\ast])` be the :ref:`label type <syntax-labeltype>` :math:`C.\CLABELS[l]`.
1475
1477
1476
-
* The |LCATCH| must be present in the :ref:`label type <labeltype>` :math:`C.\CLABELS[l]`.
1478
+
* The |LCATCH| must be present in the :ref:`label type <syntax-labeltype>` :math:`C.\CLABELS[l]`.
1477
1479
1478
1480
* Then the instruction is valid with type :math:`[t_1^\ast] \to [t_2^\ast]`, for any sequences of :ref:`value types <syntax-valtype>` :math:`t_1^\ast` and :math:`t_2^\ast`.
1479
1481
@@ -1498,19 +1500,19 @@ Control Instructions
1498
1500
1499
1501
* The label :math:`C.\CLABELS[l]` must be defined in the context.
1500
1502
1501
-
* Let :math:`[t^\ast]` be the :ref:`result type <syntax-resulttype>` :math:`C.\CLABELS[l]`.
1503
+
* Let :math:`\LCATCH^?~[t^\ast]` be the :ref:`label type <syntax-labeltype>` :math:`C.\CLABELS[l]`.
1502
1504
1503
1505
* Then the instruction is valid with type :math:`[t_1^\ast~t^\ast] \to [t_2^\ast]`, for any sequences of :ref:`value types <syntax-valtype>` :math:`t_1^\ast` and :math:`t_2^\ast`.
1504
1506
1505
1507
.. math::
1506
1508
\frac{
1507
-
C.\CLABELS[l] = [t^\ast]
1509
+
C.\CLABELS[l] = \LCATCH^?~[t^\ast]
1508
1510
}{
1509
1511
C \vdashinstr\BR~l : [t_1^\ast~t^\ast] \to [t_2^\ast]
1510
1512
}
1511
1513
1512
1514
.. note::
1513
-
The :ref:`label index <syntax-labelidx>` space in the :ref:`context <context>` :math:`C` contains the most recent label first, so that :math:`C.\CLABELS[l]` performs a relative lookup as expected.
1515
+
The :ref:`label index <syntax-labelidx>` space in the :ref:`context <context>` :math:`C` contains the most recent label type first, so that :math:`C.\CLABELS[l]` performs a relative lookup as expected.
1514
1516
1515
1517
The |BR| instruction is :ref:`stack-polymorphic <polymorphism>`.
1516
1518
@@ -1522,19 +1524,19 @@ Control Instructions
1522
1524
1523
1525
* The label :math:`C.\CLABELS[l]` must be defined in the context.
1524
1526
1525
-
* Let :math:`[t^\ast]` be the :ref:`result type <syntax-resulttype>` :math:`C.\CLABELS[l]`.
1527
+
* Let :math:`\LCATCH^?~[t^\ast]` be the :ref:`label type <syntax-labeltype>` :math:`C.\CLABELS[l]`.
1526
1528
1527
1529
* Then the instruction is valid with type :math:`[t^\ast~\I32] \to [t^\ast]`.
1528
1530
1529
1531
.. math::
1530
1532
\frac{
1531
-
C.\CLABELS[l] = [t^\ast]
1533
+
C.\CLABELS[l] = \LCATCH^?~[t^\ast]
1532
1534
}{
1533
1535
C \vdashinstr\BRIF~l : [t^\ast~\I32] \to [t^\ast]
1534
1536
}
1535
1537
1536
1538
.. note::
1537
-
The :ref:`label index <syntax-labelidx>` space in the :ref:`context <context>` :math:`C` contains the most recent label first, so that :math:`C.\CLABELS[l]` performs a relative lookup as expected.
1539
+
The :ref:`label index <syntax-labelidx>` space in the :ref:`context <context>` :math:`C` contains the most recent label type first, so that :math:`C.\CLABELS[l]` performs a relative lookup as expected.
0 commit comments