Skip to content

Commit

Permalink
[interpreter/tests] Switch to Option B' (#285)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
rossberg authored Oct 27, 2023
1 parent cfe8638 commit 123ac59
Show file tree
Hide file tree
Showing 68 changed files with 4,803 additions and 1,216 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci-interpreter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ jobs:
- name: Build interpreter
run: cd interpreter && opam exec make
- name: Run tests
run: cd interpreter && opam exec make JS='node --experimental-wasm-return_call' ci
# Node can't handle the new instructions yet
# run: cd interpreter && opam exec make JS='node --experimental-wasm-return_call' ci
run: cd interpreter && opam exec make ci
5 changes: 3 additions & 2 deletions .github/workflows/ci-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ jobs:
run: pip install six && pip install sphinx==5.1.0
- name: Build main spec
run: cd document/core && make main
- name: Run Bikeshed
run: cd document/core && make bikeshed
# Deactivate broken Bikeshed build for the time being
#- name: Run Bikeshed
# run: cd document/core && make bikeshed
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion document/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DIRS = core js-api web-api
DIRS = core js-api web-api legacy/exceptions
FILES = index.html
BUILDDIR = _build

Expand Down
4 changes: 2 additions & 2 deletions document/core/appendix/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ Added tag definitions, imports, and exports, and instructions to throw and catch

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

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

* 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)`.
* New :ref:`control instructions <syntax-instr-control>`: |THROW|, |THROWREF|, and |TRYTABLE|.

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

Expand Down
14 changes: 7 additions & 7 deletions document/core/appendix/index-instructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ def Instruction(name, opcode, type=None, validation=None, execution=None, operat
Instruction(r'\LOOP~\X{bt}', r'\hex{03}', r'[t_1^\ast] \to [t_2^\ast]', r'valid-loop', r'exec-loop'),
Instruction(r'\IF~\X{bt}', r'\hex{04}', r'[t_1^\ast~\I32] \to [t_2^\ast]', r'valid-if', r'exec-if'),
Instruction(r'\ELSE', r'\hex{05}'),
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'),
Instruction(r'\CATCH~x', r'\hex{07}'),
Instruction(None, r'\hex{06}'),
Instruction(None, r'\hex{07}'),
Instruction(r'\THROW~x', r'\hex{08}', r'[t_1^\ast~t_x^\ast] \to [t_2^\ast]', r'valid-throw', r'exec-throw'),
Instruction(r'\RETHROW~n', r'\hex{09}', r'[t_1^\ast] \to [t_2^\ast]', r'valid-rethrow', r'exec-rethrow'),
Instruction(None, r'\hex{0A}'),
Instruction(None, r'\hex{09}'),
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'),
Instruction(r'\END', r'\hex{0B}'),
Instruction(r'\BR~l', r'\hex{0C}', r'[t_1^\ast~t^\ast] \to [t_2^\ast]', r'valid-br', r'exec-br'),
Instruction(r'\BRIF~l', r'\hex{0D}', r'[t^\ast~\I32] \to [t^\ast]', r'valid-br_if', r'exec-br_if'),
Expand All @@ -103,14 +103,14 @@ def Instruction(name, opcode, type=None, validation=None, execution=None, operat
Instruction(None, r'\hex{15}'),
Instruction(None, r'\hex{16}'),
Instruction(None, r'\hex{17}'),
Instruction(r'\DELEGATE~l', r'\hex{18}'),
Instruction(r'\CATCHALL', r'\hex{19}', None, r'valid-try-catch', r'exec-try-catch'),
Instruction(None, r'\hex{18}'),
Instruction(None, r'\hex{19}'),
Instruction(r'\DROP', r'\hex{1A}', r'[t] \to []', r'valid-drop', r'exec-drop'),
Instruction(r'\SELECT', r'\hex{1B}', r'[t~t~\I32] \to [t]', r'valid-select', r'exec-select'),
Instruction(r'\SELECT~t', r'\hex{1C}', r'[t~t~\I32] \to [t]', r'valid-select', r'exec-select'),
Instruction(None, r'\hex{1D}'),
Instruction(None, r'\hex{1E}'),
Instruction(None, r'\hex{1F}'),
Instruction(r'\TRYTABLE~\X{bt}', r'\hex{1F}', r'[t_1^\ast] \to [t_2^\ast]', r'valid-try_table', r'exec-try_table'),
Instruction(r'\LOCALGET~x', r'\hex{20}', r'[] \to [t]', r'valid-local.get', r'exec-local.get'),
Instruction(r'\LOCALSET~x', r'\hex{21}', r'[t] \to []', r'valid-local.set', r'exec-local.set'),
Instruction(r'\LOCALTEE~x', r'\hex{22}', r'[t] \to [t]', r'valid-local.tee', r'exec-local.tee'),
Expand Down
1 change: 1 addition & 0 deletions document/core/appendix/index-rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Construct Judgement
:ref:`External type <valid-externtype>` :math:`\vdashexterntype \externtype \ok`
:ref:`Instruction <valid-instr>` :math:`S;C \vdashinstr \instr : \stacktype`
:ref:`Instruction sequence <valid-instr-seq>` :math:`S;C \vdashinstrseq \instr^\ast : \stacktype`
:ref:`Catch clause <valid-catch>` :math:`C \vdashcatch \catch \ok`
:ref:`Expression <valid-expr>` :math:`C \vdashexpr \expr : \resulttype`
:ref:`Function <valid-func>` :math:`C \vdashfunc \func : \functype`
:ref:`Table <valid-table>` :math:`C \vdashtable \table : \tabletype`
Expand Down
4 changes: 3 additions & 1 deletion document/core/appendix/index-types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Category Constructor
(reserved) :math:`\hex{7A}` .. :math:`\hex{71}`
:ref:`Reference type <syntax-reftype>` |FUNCREF| :math:`\hex{70}` (-16 as |Bs7|)
:ref:`Reference type <syntax-reftype>` |EXTERNREF| :math:`\hex{6F}` (-17 as |Bs7|)
(reserved) :math:`\hex{6E}` .. :math:`\hex{61}`
(reserved) :math:`\hex{6E}` .. :math:`\hex{6A}`
:ref:`Reference type <syntax-reftype>` |EXNREF| :math:`\hex{69}` (-23 as |Bs7|)
(reserved) :math:`\hex{68}` .. :math:`\hex{61}`
:ref:`Function type <syntax-functype>` :math:`[\valtype^\ast] \to [\valtype^\ast]` :math:`\hex{60}` (-32 as |Bs7|)
(reserved) :math:`\hex{5F}` .. :math:`\hex{41}`
:ref:`Result type <syntax-resulttype>` :math:`[\epsilon]` :math:`\hex{40}` (-64 as |Bs7|)
Expand Down
Loading

0 comments on commit 123ac59

Please sign in to comment.