Typed continuations: cont.bind instructions#6365
Merged
tlively merged 2 commits intoWebAssembly:mainfrom Mar 4, 2024
Merged
Conversation
tlively
approved these changes
Mar 1, 2024
Member
tlively
left a comment
There was a problem hiding this comment.
LGTM with those underflow checks 👍
| curr->contTypeBefore.getContinuation().type.getSignature().params.size(); | ||
| size_t paramsAfter = | ||
| curr->contTypeAfter.getContinuation().type.getSignature().params.size(); | ||
| size_t numArgs = paramsBefore - paramsAfter; |
Member
There was a problem hiding this comment.
It would be good to ensure that this doesn't underflow.
| curr->contTypeBefore.getContinuation().type.getSignature().params.size(); | ||
| size_t paramsAfter = | ||
| curr->contTypeAfter.getContinuation().type.getSignature().params.size(); | ||
| size_t numArgs = paramsBefore - paramsAfter; |
Contributor
Author
|
Thanks! Should be all done now. |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is part of a series that adds basic support for the typed continuations/wasmfx proposal.
This particular PR adds support for the
cont.bindinstruction for partially applying continuations, documented here.In short, these instructions are of the form
(cont.bind $ct_before $ct_after)where$ct_beforeand$ct_afterare related continuation types. They must only differ in the number of arguments, where$ct_beforehas n additional parameters as compared to$ct_after, for some n ≥ 0.The idea is that
(cont.bind $ct_before $ct_after)then takes a reference to a continuation of type$ct_beforeas well as n operands and returns a (reference to a) continuation of type$ct_after.Thus, the folded textual representation looks like
(cont.bind $ct_before $ct_after arg1 ... argn c).Support for the instruction is implemented in both the old and the new wat parser.
Note that this PR does not implement validation of the new instruction.