Skip to content

Clean up some code related to QueryVTable::execute_query_fn - #153120

Merged
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
Zalathar:execute
Feb 26, 2026
Merged

Clean up some code related to QueryVTable::execute_query_fn#153120
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
Zalathar:execute

Conversation

@Zalathar

Copy link
Copy Markdown
Member

This PR is an assortment of small cleanups to code that interacts with execute_query_fn in the query vtable.

I also experimented with trying to replace the macro-generated __rust_end_short_backtrace functions with a single shared generic function, but I couldn't manage to avoid breaking short backtraces, so I left a note behind to document my attempt.

r? nnethercote (or compiler)

All three of these functions were previously taking `cache` and
`execute_query_fn` as separate arguments, but after some other recent
simplifications we can just pass `&'tcx QueryVTable<'tcx, C>` instead.
This makes it easier to see where `execute_query_fn` is actually called.
@rustbotrustbot 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 Feb 26, 2026
Comment threadcompiler/rustc_middle/src/query/plumbing.rs
@nnethercote

Copy link
Copy Markdown
Contributor

Looks fine, one nit. r=me after considering/addressing that.

This function is tricky to document, and there's more that could be said here,
but I don't want to take up too much vertical space, or add too much risk of
details becoming inaccurate over time.
@nnethercote

Copy link
Copy Markdown
Contributor

@bors r+ rollup

@rust-bors

rust-borsBot commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

📌 Commit fb42537 has been approved by nnethercote

It is now in the queue for this repository.

@rust-borsrust-borsBot 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 Feb 26, 2026
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Feb 26, 2026
Clean up some code related to `QueryVTable::execute_query_fn`
This PR is an assortment of small cleanups to code that interacts with `execute_query_fn` in the query vtable.
I also experimented with trying to replace the macro-generated `__rust_end_short_backtrace` functions with a single shared generic function, but I couldn't manage to avoid breaking short backtraces, so I left a note behind to document my attempt.
r? nnethercote (or compiler)
rust-borsBot pushed a commit that referenced this pull request Feb 26, 2026
…uwer
Rollup of 7 pull requests
Successful merges:
- #153079 (Revert "Move aarch64-apple dist builder to dynamic llvm linking")
- #152651 (Avoid duplicate `requirement` diag args in `RegionOriginNote`)
- #152978 (Port `#[rustc_autodiff]` to the attribute parser infrastructure)
- #153091 (Migration of `LintDiagnostic` - part 4)
- #153112 (Query key cleanups)
- #153118 (mailmap: add redddy)
- #153120 (Clean up some code related to `QueryVTable::execute_query_fn`)
@rust-bors
rust-borsBot merged commit 3eafea8 into rust-lang:mainFeb 26, 2026
11 checks passed
rust-timer added a commit that referenced this pull request Feb 26, 2026
Rollup merge of #153120 - Zalathar:execute, r=nnethercote
Clean up some code related to `QueryVTable::execute_query_fn`
This PR is an assortment of small cleanups to code that interacts with `execute_query_fn` in the query vtable.
I also experimented with trying to replace the macro-generated `__rust_end_short_backtrace` functions with a single shared generic function, but I couldn't manage to avoid breaking short backtraces, so I left a note behind to document my attempt.
r? nnethercote (or compiler)
@rustbotrustbot added this to the 1.95.0 milestone Feb 26, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rust-timer build 122a72d

@rust-timer

This comment has been minimized.

@Zalathar
Zalathar deleted the execute branch February 26, 2026 22:56
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (122a72d): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking 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
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
1.1%[1.1%, 1.1%]1
Improvements ✅
(primary)
-0.2%[-0.4%, -0.1%]15
Improvements ✅
(secondary)
-0.4%[-0.9%, -0.2%]16
All ❌✅ (primary)-0.2%[-0.4%, -0.1%]15

Max RSS (memory usage)

Results (primary -9.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-9.8%[-9.8%, -9.8%]1
Improvements ✅
(secondary)
--0
All ❌✅ (primary)-9.8%[-9.8%, -9.8%]1

Cycles

Results (secondary 3.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
3.0%[3.0%, 3.0%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Binary size

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

Bootstrap: 480.132s -> 480.506s (0.08%)
Artifact size: 395.80 MiB -> 395.78 MiB (-0.01%)

@Zalathar

Copy link
Copy Markdown
MemberAuthor

I'm surprised to see this have any perf effect. Maybe we're just perturbing LLVM's inlining heuristics?

@Zoxc

Zoxc commented Feb 28, 2026

Copy link
Copy Markdown
Contributor

query_get_at is quite hot and used everywhere, so it has pretty strong effect on inlining.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-systemArea: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html)S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

6 participants

@Zalathar@nnethercote@JonathanBrouwer@rust-timer@Zoxc@rustbot