Typed continuations: cont.bind instructions #6365
Merged
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.bind
instruction for partially applying continuations, documented here.In short, these instructions are of the form
(cont.bind $ct_before $ct_after)
where$ct_before
and$ct_after
are related continuation types. They must only differ in the number of arguments, where$ct_before
has 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_before
as 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.