Skip to content
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

Replace QueryStruct with arrays local to rustc_query_impl #111808

Merged
merged 2 commits into from
May 22, 2023

Conversation

Zoxc
Copy link
Contributor

@Zoxc Zoxc commented May 21, 2023

This removes QueryStruct and instead uses constant arrays of function pointers for try_collect_active_jobs, alloc_self_profile_query_strings and encode_query_results. This further decouples rustc_query_impl from rustc_middle.

r? @cjgillot

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 21, 2023
for<'tcx> fn(TyCtxt<'tcx>, &mut QueryKeyStringCache)
] = &[$(query_impl::$name::alloc_self_profile_query_strings),*];

const ENCODE_QUERY_RESULTS: &[
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment saying that those arrays are not indexed per DepKind, so should only be used for iteration?

@cjgillot
Copy link
Contributor

Thanks. One nit and r=me.

&mut CacheEncoder<'_, 'tcx>,
&mut EncodedDepNodeIndex)
>
] = &[$(expand_if_cached!([$($modifiers)*], query_impl::$name::encode_query_results)),*];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this use item_if_cached? Like this:

Suggested change
] = &[$(expand_if_cached!([$($modifiers)*], query_impl::$name::encode_query_results)),*];
] = &[$( item_if_cached!([$($modifiers)*], query_impl::$name::encode_query_results, ))*];

This will allow to remove the option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The macro has to expand to a single expression, so it's not quite that simple.

@cjgillot
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented May 21, 2023

📌 Commit aa5d436 has been approved by cjgillot

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 21, 2023
@bors
Copy link
Contributor

bors commented May 21, 2023

⌛ Testing commit aa5d436 with merge 2440cca...

@bors
Copy link
Contributor

bors commented May 22, 2023

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing 2440cca to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 22, 2023
@bors bors merged commit 2440cca into rust-lang:master May 22, 2023
@rustbot rustbot added this to the 1.71.0 milestone May 22, 2023
@Zoxc Zoxc deleted the query-structs-trim branch May 22, 2023 02:12
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2440cca): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.8% [2.8%, 2.8%] 1
Improvements ✅
(primary)
-3.8% [-3.9%, -3.6%] 2
Improvements ✅
(secondary)
-3.8% [-4.1%, -3.3%] 4
All ❌✅ (primary) -3.8% [-3.9%, -3.6%] 2

Cycles

Results

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.0% [-2.0%, -2.0%] 1
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 644.264s -> 643.64s (-0.10%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants