Extra args for continuations should be computed after restore_continuation_context#2848
Merged
mshinwell merged 3 commits intooxcaml:mainfrom Aug 7, 2024
Merged
Conversation
0a07f6e to
f947bff
Compare
f947bff to
ad3117b
Compare
mshinwell
approved these changes
Aug 7, 2024
lukemaurer
pushed a commit
that referenced
this pull request
Oct 23, 2024
…r restore_continuation_context (#2848) Co-authored-by: Mark Shinwell <mshinwell@pm.me>
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.
IMPORTANT: I think this PR fixes an error in lambda_to_flambda, but I am not sure about that and it needs a careful review.
Currently when generating an
apply_contin lambda_to_flambda, we first compute the extra args before callingrestore_continuation_context, which can change the continuation being called and thus the extra args that are needed. It seems to me it should be the other way around, but there could be subtleties I'm missing.Unfortunately, the only way I know to trigger the bug is to use a WIP version of unboxed products, in which the strange treatment we currently have of those (passing them to every continuation like mutable variables) has not been undone, which is available here: Ekdohibs@0abdaa8 .
With that commit and
-extension layouts_betaoptions, this program (found by @ccasin) crashes flambda due to continuations with incorrect number of arguments, while it works with this commit on top:I tried to produce a similar version with mutable variables, but have not succeeded yet.