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

Merge two proposals in a single doc - #61

Merged
aheejin merged 3 commits into
masterfrom
merge_proposals
Oct 24, 2018
Merged

aheejin merged 3 commits into
masterfrom
merge_proposals

Conversation

@aheejin

@aheejin aheejin commented Oct 17, 2018

Copy link
Copy Markdown
Member

So far there have been two proposals, we have not decided on which to
use for the instruction part. We have agreed to use the second proposal
for the module and binary model (new event section and its format).

This patch tries to update the spec to the status quo: this describes
both proposals for the instruction part, and present the single
agreed-on proposal for the module/binary part.

I plan to add some more stuff to the proposal, such as some
modifications to rethrow and the restriction on the order of the event
section, but it will come after this patch.

  • Little bit of backstory:
    The initial motivation for the second proposal, which proposes a
    first-class exception ref type, was to ease some of toolchain
    implementation problems. The problems do not exist anymore for some
    other reason, but some people want to keep the second proposal on table
    because possible benefits it may bring, for example, better
    expressiveness. So we update this proposal to reflect the status quo and
    not to confuse people. We will eventually unify this to a single
    proposal.

So far there have been two proposals, we have not decided on which to
use for the instruction part. We have agreed to use the second proposal
for the module and binary model (new event section and its format).

This patch tries to update the spec to the status quo: this describes
both proposals for the instruction part, and present the single
agreed-on proposal for the module/binary part.

I plan to add some more stuff to the proposal, such as some
modifications to `rethrow` and the restriction on the order of the event
section, but it will come after this patch.

- Little bit of backstory:
The initial motivation for the second proposal, which proposes a
first-class exception ref type, was to ease some of toolchain
implementation problems. The problems do not exist anymore for some
other reason, but some people want to keep the second proposal on table
because possible benefits it may bring, for example, better
expressiveness. So we update this proposal to reflect the status quo and
not to confuse people. We will eventually unify this to a single
proposal.
@aheejin

aheejin commented Oct 17, 2018

Copy link
Copy Markdown
Member Author

@mstarzinger I don't seem to be able to add you as a reviewer. Maybe because your ID does not belong to WebAssembly team in github?

@rossberg rossberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this change consists mostly of copy & pasting the previous proposal docs into one. It would be helpful to rework that and remove all the redundancy between the descriptions of the two variants, and thereby make the difference clearer.

My understanding is that the 2nd variant only differs as follows: (1) a reference type of first-class exception packages is added, (2) the monolithic try instruction is split into separate try and handle instructions, and (3) rethrow takes an exn operand instead of an index immediate. Everything else is (or could be) pretty much the same. Is that correct? It would help to have this spelled out more explicitly.

Comment thread proposals/Exceptions.md Resolved
Comment thread proposals/Exceptions.md Outdated
exception. Similarly, the `except_index` of the `throw` instruction is the tag for
the constructed exception. See [exception index space](#exception-index-space)
for further clarification of exception tags.
The `except_index` of the `catch` instruction is the exception tag for the

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: "is the exception tag" -> "denotes the exception tag"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread proposals/Exceptions.md Outdated
the constructed exception. See [exception index space](#exception-index-space)
for further clarification of exception tags.
The `except_index` of the `catch` instruction is the exception tag for the
caught exception. Similarly, the `except_index` of the `throw` instruction is

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread proposals/Exceptions.md Outdated
such as reference counting, to perform the garbage collection in the embedder.

To do this, WebAssembly exceptions are immutable once created, to avoid cyclic
data structures that cannot be garbage collected. It also means that exceptions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: "that cannot be garbage collected" -> "that cannot easily be reference-counted"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread proposals/Exceptions.md
* The embedder does not know the layout of data in linear memory, so it can't
find places where exception references are stored.

Hence, while an exception reference is a new first class type, this proposal

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps include a link to the reference-types proposal here and clarify the intention that exceptions are added as an additional reference type.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@aheejin

aheejin commented Oct 21, 2018

Copy link
Copy Markdown
Member Author

The first proposal and the second one offer different instructions w/ different functionalities.

The instructions are
1st: try / catch / catch_all / rethrow
2nd: try / catch / if_except / else / rethrow
And 2nd's catch is different from that of 1st's; it is more like catch_all of 1st proposal. And the semantics of rethrow is also different too. And most importantly, the 2nd proposal includes the first-class exception ref type. So you are right that the instruction parts are mostly copy and paste from the old proposals, I thought there was very little that could be combined. I extracted the common binary / module changes part at the bottom, which is not relevant to the instruction changes.

@mstarzinger mstarzinger left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from my side. Only some small nits.

Comment thread proposals/Exceptions.md Outdated
| `if` | `0x04` | sig : `block_type` | begin if expression |
| `else` | `0x05` | | begin else expression of if or try |
| `try` | `0x06` | sig : `block_type` | begins a block which can handle thrown exceptions |
| `catch` | `0x07` | tag : `varuint32` | begins a block when the exception `tag` is thrown |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "thrown" -> "caught"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread proposals/Exceptions.md Outdated

```
try resulttype instruction* catch instruction* end |
except except_index |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "except except_index" line confused me on my read-through the first time around. Is this still accurate or can we drop this line?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can drop this line. Thanks for the catch.

Comment thread proposals/Exceptions.md Outdated
#### High-level structure

A new `event` section is introduced and is named `event`. If included, it must
appear after immediately after the global section.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: One redundant "after" (the first one).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread proposals/Exceptions.md Outdated

The `exception` section is the named section 'exception'. The exception section
declares exception types using exception type signatures.
The `section` section is the named section 'event'. The event section declares a

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "section section" -> "event section"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@aheejin
aheejin merged commit 7148890 into master Oct 24, 2018
@aheejin
aheejin deleted the merge_proposals branch October 24, 2018 07:15
ioannad pushed a commit to ioannad/exception-handling that referenced this pull request Jun 6, 2020
Similar to the MVP, a 0-byte access at the end of the region is legal.
ioannad pushed a commit to ioannad/exception-handling that referenced this pull request Feb 23, 2021
* Merge two proposals in a single doc

So far there have been two proposals, we have not decided on which to
use for the instruction part. We have agreed to use the second proposal
for the module and binary model (new event section and its format).

This patch tries to update the spec to the status quo: this describes
both proposals for the instruction part, and present the single
agreed-on proposal for the module/binary part.

I plan to add some more stuff to the proposal, such as some
modifications to `rethrow` and the restriction on the order of the event
section, but it will come after this patch.

- Little bit of backstory:
The initial motivation for the second proposal, which proposes a
first-class exception ref type, was to ease some of toolchain
implementation problems. The problems do not exist anymore for some
other reason, but some people want to keep the second proposal on table
because possible benefits it may bring, for example, better
expressiveness. So we update this proposal to reflect the status quo and
not to confuse people. We will eventually unify this to a single
proposal.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants