-
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
Harden the pre-tyctxt query system against accidental recomputation #105603
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @petrochenkov (or someone else) soon. Please see the contribution instructions for more information. |
The Miri subtree was changed cc @rust-lang/miri |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit d3de0c4 with merge 8148db11639606c756aa0a0fce2b93954d27c19e... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (8148db11639606c756aa0a0fce2b93954d27c19e): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. |
@rustbot ready |
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.
This PR looks like an improvement over the status quo, but Queries
is pretty hairy in general ... the whole take()
and peek_mut()
stuff has never made much sense to me; and why don't we compute the queries on NotComputedYet
instead of panicking?
The main issue is that in order to compute the queries we need access to the I am fairly confident that all of this will get simpler with #105462 as most (all?) of these should become real TyCtxt queries |
fbce585
to
48a581a
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (74edcc98681086c093ce31fc904515c465558ee3): comparison URL. Overall result: ❌ regressions - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
|
48a581a
to
cf3b18b
Compare
r=me after squashing commits. |
cf3b18b
to
58782a8
Compare
@bors r=petrochenkov |
☀️ Test successful - checks-actions |
Finished benchmarking commit (222d1ff): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
|
This commit fixes compilation errors but not runtime ones. Related changes: rust-lang/rust#104986 rust-lang/rust#105657 rust-lang/rust#105603 rust-lang/rust#105613
…rochenkov give the resolver access to TyCtxt The resolver is now created after TyCtxt is created. Then macro expansion and name resolution are run and the results fed into queries just like before this PR. Since the resolver had (before this PR) mutable access to the `CStore` and the source span table, these two datastructures are now behind a `RwLock`. To ensure that these are not mutated anymore after the resolver is done, a read lock to them is leaked right after the resolver finishes. ### PRs split out of this one and leading up to it: * rust-lang#105423 * rust-lang#105357 * rust-lang#105603 * rust-lang#106776 * rust-lang#106810 * rust-lang#106812 * rust-lang#108032
Upgrade our toolchain to `nightly-2023-01-23`. The changes here are related to the following changes: - rust-lang/rust#104986 - rust-lang/rust#105657 - rust-lang/rust#105603 - rust-lang/rust#105613 - rust-lang/rust#105977 - rust-lang/rust#104645
give the resolver access to TyCtxt The resolver is now created after TyCtxt is created. Then macro expansion and name resolution are run and the results fed into queries just like before this PR. Since the resolver had (before this PR) mutable access to the `CStore` and the source span table, these two datastructures are now behind a `RwLock`. To ensure that these are not mutated anymore after the resolver is done, a read lock to them is leaked right after the resolver finishes. ### PRs split out of this one and leading up to it: * rust-lang/rust#105423 * rust-lang/rust#105357 * rust-lang/rust#105603 * rust-lang/rust#106776 * rust-lang/rust#106810 * rust-lang/rust#106812 * rust-lang/rust#108032
give the resolver access to TyCtxt The resolver is now created after TyCtxt is created. Then macro expansion and name resolution are run and the results fed into queries just like before this PR. Since the resolver had (before this PR) mutable access to the `CStore` and the source span table, these two datastructures are now behind a `RwLock`. To ensure that these are not mutated anymore after the resolver is done, a read lock to them is leaked right after the resolver finishes. ### PRs split out of this one and leading up to it: * rust-lang/rust#105423 * rust-lang/rust#105357 * rust-lang/rust#105603 * rust-lang/rust#106776 * rust-lang/rust#106810 * rust-lang/rust#106812 * rust-lang/rust#108032
While the current compiler has no issues where we
take
and then compute the query again, in #105462 I accidentally introduced such a case.I also took the opportunity to remove
peek_mut
, which is only ever used forglobal_tcx
to then invokeenter
. I added anenter
method directly on the query.