Skip to content

Commit d5f9ecf

Browse files
aheejinioannad
authored andcommitted
Dependencies in proposal (WebAssembly#99)
This PR adds the dependency to multi-value to the exception handling proposal text and to the README. I wrote an explanation of this dependency on the proposal text, but it's easier to see this once the verification and execution steps of `br_on_exn` and of `try` blocks are written out, as done [here](WebAssembly#87 (comment)) by @rossberg : Validation: ``` ft = t1* -> t2* C, label t2* |- e1* : t1* -> t2* C, label t2* |- e2* : exnref -> t2* ----------------------------------- C |- try ft e1* catch e2* end : ft C_label(l) = C_exn(x) = t* ------------------------------------- C |- br_on_exn l x : exnref -> exnref ``` Execution: ``` v^n (try ft e1* catch e2* end) --> catch_m{e2*} (label_m{} v^n e1* end) end) (iff ft = t1^n -> t2^m) S; F; catch_m{e*} T[v^n (throw a)] end --> S; F; label_m{} (exn a v^n) e* end (iff S_exn(a) = {typ t^n}) F; (exn a v*) (br_on_exn l x) --> F; v* (br l) (iff F_exn(x) = a) ``` Concerning the functionality of `try`-`catch` blocks, note especially the passing of `v^n` values into a `label_m{}`. Concerning the functionality of `br_on_exn`, note especially the execution step resulting in a `br` instruction.
1 parent abeb498 commit d5f9ecf

File tree

2 files changed

+42
-10
lines changed

2 files changed

+42
-10
lines changed

README.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,40 @@
1-
[![Build Status](https://travis-ci.org/WebAssembly/reference-types.svg?branch=master)](https://travis-ci.org/WebAssembly/reference-types)
1+
[![Build Status](https://travis-ci.org/WebAssembly/spec.svg?branch=master)](https://travis-ci.org/WebAssembly/spec)
2+
3+
# Exception handling
4+
5+
This repository
6+
holds a
7+
[proposal](https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md) for
8+
adding exception handling to WebAssembly.
9+
10+
The exception handling proposal depends on the [reference-types](https://github.com/WebAssembly/reference-types) proposal
11+
and on the [multi-value](https://github.com/WebAssembly/multi-value) proposal.
12+
13+
The repository is a clone
14+
of [WebAssembly/spec](https://github.com/WebAssembly/spec), first rebased on the spec of its dependency [reference-types](https://github.com/WebAssembly/reference-types), and then merged with the other dependency [multi-value](https://github.com/WebAssembly/multi-value).
15+
16+
The remainder of the document has contents of the two README files of the dependencies: [reference-types/README.md](https://github.com/WebAssembly/reference-types/blob/master/README.md) and [multi-value/README.md](https://github.com/WebAssembly/multi-value/blob/master/README.md).
17+
>>>>>>> Dependencies in proposal (#99)
218
319
# Reference Types Proposal for WebAssembly
420

521
This repository is a clone of [github.com/WebAssembly/spec/](https://github.com/WebAssembly/spec/).
622
It is meant for discussion, prototype specification and implementation of a proposal to add support for basic reference types to WebAssembly.
723

8-
* See the [overview](proposals/reference-types/Overview.md) for a summary of the proposal.
24+
* See the [overview](https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md) for a summary of the proposal.
25+
26+
* See the [modified spec](https://webassembly.github.io/reference-types/) for details.
27+
28+
# Multi-value Proposal for WebAssembly
29+
30+
[![Build Status](https://travis-ci.org/WebAssembly/multi-value.svg?branch=master)](https://travis-ci.org/WebAssembly/multi-value)
31+
32+
This repository is a clone of [github.com/WebAssembly/spec/](https://github.com/WebAssembly/spec/).
33+
It is meant for discussion, prototype specification and implementation of a proposal to add support for returning multiple values to WebAssembly.
34+
35+
* See the [overview](https://github.com/WebAssembly/multi-value/blob/master/proposals/multi-value/Overview.md) for a summary of the proposal.
936

10-
* See the [modified spec](https://webassembly.github.io/reference-types/core/) for details.
37+
* See the [modified spec](https://webassembly.github.io/multi-value/) for details.
1138

1239
The repository is now based on the [bulk operations proposal](proposals/bulk-memory-operations/Overview.md) and includes all respective changes.
1340

proposals/Exceptions.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@ on the second proposal, which uses first-class exception types, mainly based on
1010
the reasoning that it is more expressive and also more extendible to other kinds
1111
of events.
1212

13-
This proposal requires the [reference types
14-
proposal](https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md)
15-
as a prerequisite, since the [`exnref`](#the-exception-reference-data-type) type
16-
should be represented as a subtype of `anyref`.
13+
This proposal requires the following proposals as prerequisites.
14+
15+
- The [reference types proposal](https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md),
16+
since the [`exnref`](#the-exception-reference-data-type) type should be represented as a subtype of `anyref`.
17+
18+
- The [multi-value proposal](https://github.com/WebAssembly/multi-value/blob/master/proposals/multi-value/Overview.md),
19+
since otherwise the [`br_on_exn`](#exception-data-extraction) instruction would only work with exceptions that contain one value.
20+
Moreover, by using [multi-value](https://github.com/WebAssembly/multi-value/blob/master/proposals/multi-value/Overview.md),
21+
the [`try` blocks](#try-and-catch-blocks) may use values already in the stack, and also push multiple values onto the stack.
1722

1823
---
1924

@@ -152,7 +157,7 @@ instruction. That is, a try block is sequence of instructions having the
152157
following form:
153158

154159
```
155-
try block_type
160+
try blocktype
156161
instruction*
157162
catch
158163
instruction*
@@ -316,7 +321,7 @@ document](https://github.com/WebAssembly/spec/blob/master/document/core/instruct
316321
The following rules are added to *instructions*:
317322

318323
```
319-
try resulttype instruction* catch instruction* end |
324+
try blocktype instruction* catch instruction* end |
320325
throw except_index |
321326
rethrow |
322327
br_on_exn label except_index
@@ -487,7 +492,7 @@ throws, and rethrows as follows:
487492

488493
| Name | Opcode | Immediates | Description |
489494
| ---- | ---- | ---- | ---- |
490-
| `try` | `0x06` | sig : `block_type` | begins a block which can handle thrown exceptions |
495+
| `try` | `0x06` | sig : `blocktype` | begins a block which can handle thrown exceptions |
491496
| `catch` | `0x07` | | begins the catch block of the try block |
492497
| `throw` | `0x08` | index : `varint32` | Creates an exception defined by the exception `index`and then throws it |
493498
| `rethrow` | `0x09` | | Pops the `exnref` on top of the stack and throws it |

0 commit comments

Comments
 (0)