-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reference interpreter #84
Conversation
Merge typed-func-refs proposal
This patch extends the interpreter with a minimal exception handling facility. It is minimal in the sense that it supports only a single exception which can be thrown and caught.
Co-authored-by: Andreas Rossberg <rossberg@mpi-sws.org>
Co-authored-by: Andreas Rossberg <rossberg@mpi-sws.org>
Co-authored-by: Andreas Rossberg <rossberg@mpi-sws.org>
Co-authored-by: Andreas Rossberg <rossberg@mpi-sws.org>
Co-authored-by: Andreas Rossberg <rossberg@mpi-sws.org>
Co-authored-by: Andreas Rossberg <rossberg@mpi-sws.org>
Co-authored-by: Andreas Rossberg <rossberg@mpi-sws.org>
The opcodes for try/catch/throw are taken from the provisional exception-handling proposal.
Co-authored-by: Andreas Rossberg <rossberg@mpi-sws.org>
Co-authored-by: Andreas Rossberg <rossberg@mpi-sws.org>
Extends test suite too.
Co-authored-by: Andreas Rossberg <rossberg@mpi-sws.org>
Minimal exception handling extension
Implement events
Add cont type and instructions
Merge with upstream
Implement the `switch` instruction
The evaluator erroneously rewrote `resume_throw $x $y (on ..)` into `Plain (Throw $x)`; but `$x` is a type index, not a tag index. However, rewriting it to `Throw $y` is not correct either, as the throw may be injected into another instance, where `$y` may be absent. Therefore, we rewrite it into an administrative instruction `Throwing (tag_instance, args)` instead such that the tag is fully resolved by before being injected into the continuation.
There is a small inconsistency between the reference implementation in #84 and the explainer. In the explainer we write that the type index `$ft` on `cont $ft` should be encoded as an `u32` in the binary format. However, the reference interpreter actually encodes it as `s33`, similarly to how concrete heap types are encoded. I do not have a strong preference for either encoding, but I suppose one can argue that the `s33` approach is more forward compatible in the sense that we can encode additional metadata.
Following on from the discussion we had Monday, I've removed the |
This is ready for review / to be merged once #90 has been merged. |
@tlively and @slindley this patch is ready for review now. PTAL. The patch includes some updates to the legacy proposal documents. I think these should be consolidated under stack-switching/ along side the legacy bag-o-stacks documents (if we decide to keep any of these documents around). But I think that is for another patch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
(mostly rubberstamp)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There is a small inconsistency between the reference implementation in #84 and the explainer. In the explainer we write that the type index `$ft` on `cont $ft` should be encoded as an `u32` in the binary format. However, the reference interpreter actually encodes it as `s33`, similarly to how concrete heap types are encoded.
This patch adds a reference interpreter for the stack switching proposal. It implements all of the proposed instructions.
The patch also includes many updates from WebAssembly/spec, WebAssembly/function-references, WebAssembly/exception-handling, and WebAssembly/gc.
The contents of this patch are comprised of multiple smaller patches which have already been reviewed by @rossberg -- though, if you are keen please take a look.