-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Don't actually create a full MIR stack frame when not needed #57351
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c0f0f45
Don't actually create a full MIR stack frame when not needed
oli-obk 14e662d
Manually push a stack frame where no valid frame is needed
oli-obk cea282b
Make `mk_eval_cx` private to const eval
oli-obk f174b73
Document the `mk_*_eval_cx` functions
oli-obk cd5a9e0
Explain the arguments of the `mk_*_eval_cx` functions
oli-obk dec79e4
Not seeing the forest because there are too many trees in the way
oli-obk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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.
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.
So this function is only ever called when we don't even want to execute any code? But then why even bother pushing a stack frame at all...? Basically I don't understand why this even works.
That entire
mir
variable is "fake" and takes no input, right? This could be made clearer by having a separate function to construct it.How does this relate to
mk_borrowck_eval_cx
, which creates a "less fake" frame but also for some reason cannot usepush_stack_frame
. Could this function also just directly push to the stack instead?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.
We do call all kinds of methods on the
ecx
that check the current stack frame for e.g.substs
and other info. These methods would fail without a stack frame. I remember talking about this before (not sure with whom), and we decided not to hack some sort of global substitutions into theecx
.Jup, I unified it, good idea. This works much better.
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.
I know.
But somewhere we also run some actual code, and then we need a real stack frame. I guess neither of these two
mk*_eval_cx
functions is called then?Could you please add doc comments to all of these
mk*_eval_cx
functions explaining when they should be called, what the difference between them is, and what can and cannot be done with the context they return (e.g., you can project to fields of a constant etc., but you cannot actually run any code)?