Skip to content

Commit

Permalink
Rethrow/br_on_exn traps when given nullref (WebAssembly#97)
Browse files Browse the repository at this point in the history
Following the discussions in WebAssembly#90, it seems desirable and less
error-prone to make `rethrow` and `br_on_exn` trap in case the value on
top of the stack is of `nullref` type.

Closes WebAssembly#90.
  • Loading branch information
aheejin authored Jan 10, 2020
1 parent 1d553de commit 451063d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions proposals/Exceptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ Note that a caught exception can be rethrown using the `rethrow` instruction.
The `rethrow` instruction takes the exception associated with the `exnref` on
top of the stack, and rethrows the exception. A rethrow has the same effect as a
throw, other than an exception is not created. Rather, the referenced exception
on top of the stack is popped and then thrown.
on top of the stack is popped and then thrown. The `rethrow` instruction traps
if the value on the top of the stack is null.

### Exception data extraction

Expand Down Expand Up @@ -271,7 +272,8 @@ end $end
```

If the query fails, the control flow falls through, and no values are pushed
onto the stack.
onto the stack. The `br_on_exn` instruction traps if the value on the top of the
stack is null.

### Stack traces

Expand Down

0 comments on commit 451063d

Please sign in to comment.