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

Commit a905e9b

Browse files
authored
[spec] Update spec for option B' (#283)
1 parent 5b7a8e1 commit a905e9b

20 files changed

+521
-611
lines changed

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)