This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
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 implements naive effect forwarding:
When generating code for
resume
, we ensure that when asked to handle an effect not considered by theresume
instruction under consideration, we simplysuspend
and let our own parent handle the unknown effect. Once resuming from that we use a back edge to the code that invokesresume
on the current fiber (i.e., after moving up in the handler chain to find a handler, we move down in the chain back to where the originalsuspend
of the unknown effect happened).Payloads are handled as follows:
VMContext
and left untouched while moving upwards in the handler chain until the right handler is found and accesses the data.resume
orcont.bind
further up in the chain. These payloads are stored in continuation objects directly. Before resuming into our own child, we thus swap the payload pointers of the current continuation object and the child.