Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ holds a
[proposal](https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md) for
adding exception handling to WebAssembly.

The exception handling proposal depends on the [reference-types](https://github.com/WebAssembly/reference-types) proposal
and on the [multi-value](https://github.com/WebAssembly/multi-value) proposal.

The repository is a clone
of [WebAssembly/spec](https://github.com/WebAssembly/spec), and is rebased on the spec of its dependent proposal [WebAssembly/reference-types](https://github.com/WebAssembly/reference-types).
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).

The remainder of the document is contents of the [README.md](https://github.com/WebAssembly/reference-types/blob/master/README.md)
document of that repository.
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).

# Reference Types Proposal for WebAssembly
## Reference Types Proposal for WebAssembly

[![Build Status](https://travis-ci.org/WebAssembly/reference-types.svg?branch=master)](https://travis-ci.org/WebAssembly/reference-types)

Expand All @@ -24,9 +26,20 @@ It is meant for discussion, prototype specification and implementation of a prop

* See the [modified spec](https://webassembly.github.io/reference-types/core/) for details.

## Multi-value Proposal for WebAssembly

[![Build Status](https://travis-ci.org/WebAssembly/multi-value.svg?branch=master)](https://travis-ci.org/WebAssembly/multi-value)

This repository is a clone of [github.com/WebAssembly/spec/](https://github.com/WebAssembly/spec/).
It is meant for discussion, prototype specification and implementation of a proposal to add support for returning multiple values to WebAssembly.

* See the [overview](proposals/multi-value/Overview.md) for a summary of the proposal.

* See the [modified spec](https://webassembly.github.io/multi-value/) for details.

Original `README` from upstream repository follows...

# spec
## spec

This repository holds a prototypical reference implementation for WebAssembly,
which is currently serving as the official specification. Eventually, we expect
Expand Down
19 changes: 12 additions & 7 deletions proposals/Exceptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ on the second proposal, which uses first-class exception types, mainly based on
the reasoning that it is more expressive and also more extendible to other kinds
of events.

This proposal requires the [reference types
proposal](https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md)
as a prerequisite, since the [`exnref`](#the-exception-reference-data-type) type
should be represented as a subtype of `anyref`.
This proposal requires the following proposals as prerequisites.

- The [reference types proposal](https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md),
since the [`exnref`](#the-exception-reference-data-type) type should be represented as a subtype of `anyref`.

- The [multi value proposal](https://github.com/WebAssembly/multi-value/blob/master/proposals/multi-value/Overview.md),
since otherwise the [`br_on_exn?`](#Exception data extraction) instruction would only work with exceptions which consume one value.
Moreover, by using [multi value](https://github.com/WebAssembly/multi-value/blob/master/proposals/multi-value/Overview.md),
the [`try` blocks](#Try and catch blocks) may use values already in the stack.

---

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

```
try block_type
try blocktype
instruction*
catch
instruction*
Expand Down Expand Up @@ -316,7 +321,7 @@ document](https://github.com/WebAssembly/spec/blob/master/document/core/instruct
The following rules are added to *instructions*:

```
try resulttype instruction* catch instruction* end |
try blocktype instruction* catch instruction* end |
throw except_index |
rethrow |
br_on_exn label except_index
Expand Down Expand Up @@ -487,7 +492,7 @@ throws, and rethrows as follows:

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