Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Dependencies in proposal #99

Merged
merged 7 commits into from
Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from all 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,11 +7,13 @@ 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

Expand All @@ -20,9 +22,20 @@ document of that repository.
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 basic reference types to WebAssembly.

* See the [overview](proposals/reference-types/Overview.md) for a summary of the proposal.
* See the [overview](https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md) for a summary of the proposal.

* See the [modified spec](https://webassembly.github.io/reference-types/) 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](https://github.com/WebAssembly/multi-value/blob/master/proposals/multi-value/Overview.md) for a summary of the proposal.

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

Original `README` from upstream repository follows...

Expand Down
29 changes: 17 additions & 12 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 that contain 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, and also push multiple values onto 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 @@ -414,10 +419,10 @@ appear immediately after the global section.
##### Event section

The `event` section is the named section 'event'. For ease of validation, this
section comes after the [global
section](https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md#global-section)
and before the [export
section](https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md#export-section).
section comes after the [memory
section](https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md#memory-section)
and before the [global
section](https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md#global-section).
So the list of all sections will be:

| Section Name | Code | Description |
Expand All @@ -427,8 +432,8 @@ So the list of all sections will be:
| Function | `3` | Function declarations |
| Table | `4` | Indirect function table and other tables |
| Memory | `5` | Memory attributes |
| Global | `6` | Global declarations |
| Event | `13` | Event declarations |
| Global | `6` | Global declarations |
| Export | `7` | Exports |
| Start | `8` | Start function declaration |
| Element | `9` | Elements section |
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