@@ -12,8 +12,8 @@ of events.
12
12
13
13
This proposal requires the [ reference types
14
14
proposal] ( https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md )
15
- as a prerequisite, since the [ ` except_ref ` ] ( #the-exception-reference-data-type )
16
- type should be represented as a subtype of ` anyref ` .
15
+ as a prerequisite, since the [ ` exnref ` ] ( #the-exception-reference-data-type ) type
16
+ should be represented as a subtype of ` anyref ` .
17
17
18
18
---
19
19
@@ -140,7 +140,7 @@ Exception indices are used by:
140
140
141
141
### The exception reference data type
142
142
143
- Data types are extended to have a new ` except_ref ` type, that refers to an
143
+ Data types are extended to have a new ` exnref ` type, that refers to an
144
144
exception. The representation of an exception is left to the implementation.
145
145
146
146
### Try and catch blocks
@@ -200,7 +200,7 @@ are not in the body of the try block.
200
200
201
201
Once a catching try block is found for the thrown exception, the operand stack
202
202
is popped back to the size the operand stack had when the try block was entered,
203
- and then an except_ref referring to the caught exception is pushed back onto the
203
+ and then an ` exnref ` referring to the caught exception is pushed back onto the
204
204
operand stack.
205
205
206
206
If control is transferred to the body of a catch block, and the last instruction
@@ -214,10 +214,10 @@ Note that a caught exception can be rethrown using the `rethrow` instruction.
214
214
215
215
### Rethrowing an exception
216
216
217
- The ` rethrow ` instruction takes the exception associated with the ` except_ref `
218
- on top of the stack, and rethrows the exception. A rethrow has the same effect
219
- as a throw, other than an exception is not created. Rather, the referenced
220
- exception on top of the stack is popped and then thrown.
217
+ The ` rethrow ` instruction takes the exception associated with the ` exnref ` on
218
+ top of the stack, and rethrows the exception. A rethrow has the same effect as a
219
+ throw, other than an exception is not created. Rather, the referenced exception
220
+ on top of the stack is popped and then thrown.
221
221
222
222
### Exception data extraction
223
223
@@ -228,23 +228,22 @@ tag of an exception on top of the stack, in the form of:
228
228
br_on_exn label except_index
229
229
```
230
230
231
- The ` br_on_exn ` instruction checks the exception tag of an ` except_ref ` on top
232
- of the stack if it matches the given exception index. If it does, it branches
233
- out to the label referenced by the instruction (In the binary form, the label
234
- will be converted to a relative depth immediate, like other branch
235
- instructions), and while doing that, pops the ` except_ref ` value from the stack
236
- and instead pushes the exception's argument values on top of the stack. In order
237
- to use these popped values, the block signature of the branch target has to
238
- match the exception types - because it receives the exception arguments as
239
- branch operands. If the exception tag does not match, the ` except_ref ` value
240
- remains on the stack. For example, when an ` except_ref ` contains an exception of
241
- type (i32 i64), the target block signature should be (i32 i64) as well, as in
242
- the following example:
231
+ The ` br_on_exn ` instruction checks the exception tag of an ` exnref ` on top of
232
+ the stack if it matches the given exception index. If it does, it branches out
233
+ to the label referenced by the instruction (In the binary form, the label will
234
+ be converted to a relative depth immediate, like other branch instructions), and
235
+ while doing that, pops the ` exnref ` value from the stack and instead pushes the
236
+ exception's argument values on top of the stack. In order to use these popped
237
+ values, the block signature of the branch target has to match the exception
238
+ types - because it receives the exception arguments as branch operands. If the
239
+ exception tag does not match, the ` exnref ` value remains on the stack. For
240
+ example, when an ` exnref ` contains an exception of type (i32 i64), the target
241
+ block signature should be (i32 i64) as well, as in the following example:
243
242
244
243
```
245
244
block $l (result i32 i64)
246
245
...
247
- ;; except_ref $e is on the stack at this point
246
+ ;; exnref $e is on the stack at this point
248
247
br_on_exn $l ;; branch to $l with $e's arguments
249
248
...
250
249
end
@@ -331,20 +330,20 @@ document](https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md).
331
330
332
331
### Data Types
333
332
334
- #### except_ref
333
+ #### exnref
335
334
336
335
An exception reference points to an exception.
337
336
338
337
### Language Types
339
338
340
339
| Opcode | Type constructor |
341
340
| --------| ------------------|
342
- | -0x18 | ` except_ref ` |
341
+ | -0x18 | ` exnref ` |
343
342
344
343
#### value_type
345
344
346
- A ` varint7 ` indicating a ` value_type ` is extended to include ` except_ref ` as
347
- encoded above.
345
+ A ` varint7 ` indicating a ` value_type ` is extended to include ` exnref ` as encoded
346
+ above.
348
347
349
348
#### Other Types
350
349
@@ -465,8 +464,8 @@ throws, and rethrows as follows:
465
464
| ` try ` | ` 0x06 ` | sig : ` block_type ` | begins a block which can handle thrown exceptions |
466
465
| ` catch ` | ` 0x07 ` | | begins the catch block of the try block |
467
466
| ` throw ` | ` 0x08 ` | index : ` varint32 ` | Creates an exception defined by the exception ` index ` and then throws it |
468
- | ` rethrow ` | ` 0x09 ` | | Pops the ` except_ref ` on top of the stack and throws it |
469
- | ` br_on_exn ` | ` 0x0a ` | relative_depth : ` varuint32 ` , index : ` varuint32 ` | Branches to the given label and extracts data within ` except_ref ` on top of stack if it was created using the corresponding exception ` index ` |
467
+ | ` rethrow ` | ` 0x09 ` | | Pops the ` exnref ` on top of the stack and throws it |
468
+ | ` br_on_exn ` | ` 0x0a ` | relative_depth : ` varuint32 ` , index : ` varuint32 ` | Branches to the given label and extracts data within ` exnref ` on top of stack if it was created using the corresponding exception ` index ` |
470
469
471
470
The * sig* fields of ` block ` , ` if ` , and ` try ` operators are block signatures
472
471
which describe their use of the operand stack.
0 commit comments