-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Remove QueryDispatcher
#152371
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
Remove QueryDispatcher
#152371
Conversation
Query keys must be stably hashable. Currently this requirement is expressed as a where-clause on `impl QueryDispatcher for SemiDynamicQueryDispatcher` and a where-clause on `create_deferred_query_stack_frame`. This commit removes those where-clause bounds and adds a single bound to `QueryCache::Key`, which already has some other bounds. I.e. it consolidates the bounds. It also gives them a name (`QueryCacheKey`) to avoid repeating them. There is also a related `Key` trait in `rustc_middle`; it should probably be merged with `QueryCacheKey` in the future, but not today. This cleanup helps with the next two commits, which do bigger rearrangements, and where the where-clauses caused me some difficulties.
It's always `SemiDynamicQueryDispatcher`, so we can just use that type directly. (This requires adding some explicit generic params to `QueryDispatcherUnerased`.) Less indirection makes the code clearer, and this is a prerequisite for the next commit, which is a much bigger simplification.
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Remove `QueryDispatcher`
|
Best reviewed one commit at a time. This code uses generics and trait bounds heavily and getting everything compiling took some effort. The changes I made make sense to me but there might be better ways of doing things. |
| self.vtable.will_cache_on_disk_for_key_fn.map_or(false, |f| f(tcx, key)) | ||
| } | ||
|
|
||
| // Don't use this method to access query results, instead use the methods on TyCtxt. |
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.
Note for future reference: These are existing comments, being migrated over from QueryDispatcher.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (a7cede3): comparison URL. Overall result: ❌ regressions - no action neededBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -4.3%, secondary -4.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 475.432s -> 478.527s (0.65%) |
It takes an `is_anon` argument, but it's now generic over `QueryFlags`, which contains the same `is_anon` field. So the argument is no longer necessary.
It existed only to bridge the divide between `rustc_query_system` and `rustc_query_impl`. But enough pieces have been moved from the former to the latter that the trait is no longer needed. Less indirection and abstraction makes the code easier to understand.
It's the only thing left in `rustc_query_system::query::dispatcher`.
08c239a to
f995804
Compare
|
@bors r+ rollup=maybe |
This comment has been minimized.
This comment has been minimized.
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 4cd4c18 (parent) -> c6936c3 (this PR) Test differencesShow 4 test diffs4 doctest diffs were found. These are ignored, as they are noisy. Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard c6936c309add33a7008747866aee081ff5289946 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (c6936c3): 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)Results (secondary 4.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 4.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.0%, secondary -0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 473.075s -> 474.574s (0.32%) |
QueryDispatcheris a trait that existed purely becauserustc_query_systemhad code that didn't have access toTyCtxt. That is no longer the case, so the trait can be removed.r? @Zalathar