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.
Miscellaneous fixes to formal overview document. (#231)
In particular:
- We dropped `kind` property of labels, and went for labels of the form `catch^? [t*]` after all.
- Changed some `^n` to `*` where appropriate.
- Removed occurrences of "we ..." formulations.
Copy file name to clipboardExpand all lines: proposals/exception-handling/Exceptions-formal-overview.md
+7-8Lines changed: 7 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -38,10 +38,9 @@ mod ::= 'module' ... tag*
38
38
39
39
### Validation Contexts: Tagtypes and modified Labels
40
40
41
-
To verify that the `rethrow l` instruction refers to a label surrounding the instructions of a catch block (call this a catch-label), we introduce a `kind` attribute to labels in the validation context, which is set to `catch` when the label is a catch-label and empty otherwise.
41
+
To verify that the `rethrow l` instruction refers to a label surrounding the instructions of a catch block (call this a catch-label), an optional `catch` specifier is introduced to labels in the validation context.
42
42
43
43
```
44
-
labelkind ::= 'catch'
45
44
labeltype ::= 'catch'? resulttype
46
45
```
47
46
@@ -67,7 +66,7 @@ C.tags[x] = [t*]→[]
67
66
C ⊢ throw x : [t1* t*]→[t2*]
68
67
69
68
70
-
C.labels[l].kind = catch
69
+
C.labels[l] = catch [t*]
71
70
----------------------------
72
71
C ⊢ rethrow l : [t1*]→[t2*]
73
72
@@ -116,12 +115,12 @@ m ::= {..., 'tags' tagaddr*}
So far block contexts are only used in the reduction of `br l` and `return`, and only include labels or values on the stack on the left side of the hole `[_]`. If we want to be able to break jumping over try-catch and try-delegate blocks, we must allow for the new administrative control instructions to appear after labels in block contexts.
123
+
So far block contexts are only used in the reduction of `br l` and `return`, and only include labels or values on the stack on the left side of the hole `[_]`. To be able to break jumping over try-catch and try-delegate blocks, the new administrative control instructions must be allowed to appear after labels in block contexts.
125
124
126
125
```
127
126
B^0 ::= val* '[_]' instr* | val* C^0 instr*
@@ -189,9 +188,9 @@ label_m{} B^l[ delegate{l} T[val^n (throw a)] end ] end
189
188
↪ val^n (throw a)
190
189
```
191
190
192
-
Note that the last reduction step above is similar to the reduction of `br l`[1], if we look at the entire `delegate{l}...end` as the`br l`, but also doing a throw after it breaks.
191
+
Note that the last reduction step above is similar to the reduction of `br l`[1], the entire `delegate{l}...end`is seen as a`br l` immediately followed by a throw.
193
192
194
-
There is a subtle difference though. The instruction `br l` searches for the `l+1`th surrounding block and breaks out after that block. Because `delegate{l}` is always wrapped in its own `label_n{} ... end`[2], with the same lookup as for `br l`we end up breaking inside the `l+1`th surrounding block, and throwing there. So if that `l+1`th surrounding block is a try, we end up throwing in its "try code", and thus correctly getting delegated to that try's catches.
193
+
There is a subtle difference though. The instruction `br l` searches for the `l+1`th surrounding block and breaks out after that block. Because `delegate{l}` is always wrapped in its own `label_n{} ... end`[2], with the same lookup as for `br l`the instruction ends up breaking inside the `l+1`th surrounding block, and throwing there. So if that `l+1`th surrounding block is a try, the exception is thrown in the "try code", and thus correctly getting delegated to that try's catches.
195
194
196
195
-[1][The execution step for `br l`](https://webassembly.github.io/spec/core/exec/instructions.html#xref-syntax-instructions-syntax-instr-control-mathsf-br-l)
197
196
-[2] The label that always wraps `delegate{l}...end` can be thought of as "level -1" and cannot be referred to by the delegate's label index `l`.
0 commit comments