Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit 123ac59

Browse files
authored
[interpreter/tests] Switch to Option B' (#285)
* Reintroduce exnref * Fix type_of * Simplify parser * Implement 1b * Change opcodes for catch/catch_all to avoid conflict * Put catch clauses first * Remove obsolete Delegating cases * Change exn type opcode to -0x17 * Switch to B' variant * [interpreter] Add boilerplate for ref.exn result patterns * [ci] Deactivate node run, since it can't handle try_table yet * Try -> TryTable in AST * [spec] Update spec for option B' (#283) * Deactivate Bikeshed * [spec/tests] Specification of legacy exceptions + tests (#284) * [legacy] Create specification doc for legacy exception handling * [test] Create infra for legacy tests
1 parent cfe8638 commit 123ac59

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+4803
-1216
lines changed

.github/workflows/ci-interpreter.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,6 @@ jobs:
3131
- name: Build interpreter
3232
run: cd interpreter && opam exec make
3333
- name: Run tests
34-
run: cd interpreter && opam exec make JS='node --experimental-wasm-return_call' ci
34+
# Node can't handle the new instructions yet
35+
# run: cd interpreter && opam exec make JS='node --experimental-wasm-return_call' ci
36+
run: cd interpreter && opam exec make ci

.github/workflows/ci-spec.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ jobs:
3232
run: pip install six && pip install sphinx==5.1.0
3333
- name: Build main spec
3434
run: cd document/core && make main
35-
- name: Run Bikeshed
36-
run: cd document/core && make bikeshed
35+
# Deactivate broken Bikeshed build for the time being
36+
#- name: Run Bikeshed
37+
# run: cd document/core && make bikeshed
3738
- name: Upload artifact
3839
uses: actions/upload-artifact@v2
3940
with:

document/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
DIRS = core js-api web-api
1+
DIRS = core js-api web-api legacy/exceptions
22
FILES = index.html
33
BUILDDIR = _build
44

document/core/appendix/changes.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ Added tag definitions, imports, and exports, and instructions to throw and catch
147147

148148
* Modules may :ref:`define <syntax-tagtype>`, :ref:`import <syntax-import>`, and :ref:`export <syntax-export>` tags.
149149

150-
* New exception throwing :ref:`control instructions <syntax-instr-control>`: :math:`\THROW` and :math:`\RETHROW`.
150+
* New :ref:`reference type <syntax-reftype>` |EXNREF|.
151151

152-
* New handler :ref:`control instructions <syntax-instr-control>`: :math:`(\TRY~\X{bt}~\instr_1^\ast~(\CATCH~x~\instr_2^\ast)^\ast~(\CATCHALL~\instr_3^\ast)^?\END)` and :math:`(\TRY~\X{bt}~\instr^\ast~\DELEGATE~l)`.
152+
* New :ref:`control instructions <syntax-instr-control>`: |THROW|, |THROWREF|, and |TRYTABLE|.
153153

154154
* New :ref:`tag section <binary-tagsec>` in binary format.
155155

document/core/appendix/index-instructions.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ def Instruction(name, opcode, type=None, validation=None, execution=None, operat
8585
Instruction(r'\LOOP~\X{bt}', r'\hex{03}', r'[t_1^\ast] \to [t_2^\ast]', r'valid-loop', r'exec-loop'),
8686
Instruction(r'\IF~\X{bt}', r'\hex{04}', r'[t_1^\ast~\I32] \to [t_2^\ast]', r'valid-if', r'exec-if'),
8787
Instruction(r'\ELSE', r'\hex{05}'),
88-
Instruction(r'\TRY~\X{bt}', r'\hex{06}', r'[t_1^\ast] \to [t_2^\ast]', r'valid-try-catch', r'exec-try-catch', None, r'valid-try-delegate', r'exec-try-delegate'),
89-
Instruction(r'\CATCH~x', r'\hex{07}'),
88+
Instruction(None, r'\hex{06}'),
89+
Instruction(None, r'\hex{07}'),
9090
Instruction(r'\THROW~x', r'\hex{08}', r'[t_1^\ast~t_x^\ast] \to [t_2^\ast]', r'valid-throw', r'exec-throw'),
91-
Instruction(r'\RETHROW~n', r'\hex{09}', r'[t_1^\ast] \to [t_2^\ast]', r'valid-rethrow', r'exec-rethrow'),
92-
Instruction(None, r'\hex{0A}'),
91+
Instruction(None, r'\hex{09}'),
92+
Instruction(r'\THROWREF', r'\hex{0A}', r'[t_1^\ast~(\REF~\NULL~\EXN)] \to [t_2^\ast]', r'valid-throw_ref', r'exec-throw_ref'),
9393
Instruction(r'\END', r'\hex{0B}'),
9494
Instruction(r'\BR~l', r'\hex{0C}', r'[t_1^\ast~t^\ast] \to [t_2^\ast]', r'valid-br', r'exec-br'),
9595
Instruction(r'\BRIF~l', r'\hex{0D}', r'[t^\ast~\I32] \to [t^\ast]', r'valid-br_if', r'exec-br_if'),
@@ -103,14 +103,14 @@ def Instruction(name, opcode, type=None, validation=None, execution=None, operat
103103
Instruction(None, r'\hex{15}'),
104104
Instruction(None, r'\hex{16}'),
105105
Instruction(None, r'\hex{17}'),
106-
Instruction(r'\DELEGATE~l', r'\hex{18}'),
107-
Instruction(r'\CATCHALL', r'\hex{19}', None, r'valid-try-catch', r'exec-try-catch'),
106+
Instruction(None, r'\hex{18}'),
107+
Instruction(None, r'\hex{19}'),
108108
Instruction(r'\DROP', r'\hex{1A}', r'[t] \to []', r'valid-drop', r'exec-drop'),
109109
Instruction(r'\SELECT', r'\hex{1B}', r'[t~t~\I32] \to [t]', r'valid-select', r'exec-select'),
110110
Instruction(r'\SELECT~t', r'\hex{1C}', r'[t~t~\I32] \to [t]', r'valid-select', r'exec-select'),
111111
Instruction(None, r'\hex{1D}'),
112112
Instruction(None, r'\hex{1E}'),
113-
Instruction(None, r'\hex{1F}'),
113+
Instruction(r'\TRYTABLE~\X{bt}', r'\hex{1F}', r'[t_1^\ast] \to [t_2^\ast]', r'valid-try_table', r'exec-try_table'),
114114
Instruction(r'\LOCALGET~x', r'\hex{20}', r'[] \to [t]', r'valid-local.get', r'exec-local.get'),
115115
Instruction(r'\LOCALSET~x', r'\hex{21}', r'[t] \to []', r'valid-local.set', r'exec-local.set'),
116116
Instruction(r'\LOCALTEE~x', r'\hex{22}', r'[t] \to [t]', r'valid-local.tee', r'exec-local.tee'),

document/core/appendix/index-rules.rst

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Construct Judgement
2323
:ref:`External type <valid-externtype>` :math:`\vdashexterntype \externtype \ok`
2424
:ref:`Instruction <valid-instr>` :math:`S;C \vdashinstr \instr : \stacktype`
2525
:ref:`Instruction sequence <valid-instr-seq>` :math:`S;C \vdashinstrseq \instr^\ast : \stacktype`
26+
:ref:`Catch clause <valid-catch>` :math:`C \vdashcatch \catch \ok`
2627
:ref:`Expression <valid-expr>` :math:`C \vdashexpr \expr : \resulttype`
2728
:ref:`Function <valid-func>` :math:`C \vdashfunc \func : \functype`
2829
:ref:`Table <valid-table>` :math:`C \vdashtable \table : \tabletype`

document/core/appendix/index-types.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ Category Constructor
1616
(reserved) :math:`\hex{7A}` .. :math:`\hex{71}`
1717
:ref:`Reference type <syntax-reftype>` |FUNCREF| :math:`\hex{70}` (-16 as |Bs7|)
1818
:ref:`Reference type <syntax-reftype>` |EXTERNREF| :math:`\hex{6F}` (-17 as |Bs7|)
19-
(reserved) :math:`\hex{6E}` .. :math:`\hex{61}`
19+
(reserved) :math:`\hex{6E}` .. :math:`\hex{6A}`
20+
:ref:`Reference type <syntax-reftype>` |EXNREF| :math:`\hex{69}` (-23 as |Bs7|)
21+
(reserved) :math:`\hex{68}` .. :math:`\hex{61}`
2022
:ref:`Function type <syntax-functype>` :math:`[\valtype^\ast] \to [\valtype^\ast]` :math:`\hex{60}` (-32 as |Bs7|)
2123
(reserved) :math:`\hex{5F}` .. :math:`\hex{41}`
2224
:ref:`Result type <syntax-resulttype>` :math:`[\epsilon]` :math:`\hex{40}` (-64 as |Bs7|)

0 commit comments

Comments
 (0)