Rename query_dispatcher and reduce its use.

It's now `query_vtable` because its return type changed. And thanks to
the previous commit it can be manually inlined in several places. (The
only remaining calls to it are in `make_dep_kind_vtable_for_query`,
which are more challenging to remove.)
This commit is contained in:
Nicholas Nethercote
2026-02-19 15:36:53 +11:00
parent 6c12694b64
commit 5aebfd648b
3 changed files with 8 additions and 8 deletions
@@ -131,10 +131,10 @@ pub(crate) fn make_dep_kind_vtable_for_query<'tcx, Q, Cache>(
is_eval_always,
key_fingerprint_style,
force_from_dep_node: Some(|tcx, dep_node, _| {
force_from_dep_node_inner(Q::query_dispatcher(tcx), tcx, dep_node)
force_from_dep_node_inner(Q::query_vtable(tcx), tcx, dep_node)
}),
try_load_from_on_disk_cache: Some(|tcx, dep_node| {
try_load_from_on_disk_cache_inner(Q::query_dispatcher(tcx), tcx, dep_node)
try_load_from_on_disk_cache_inner(Q::query_vtable(tcx), tcx, dep_node)
}),
}
}
+1 -1
View File
@@ -50,7 +50,7 @@
trait QueryDispatcherUnerased<'tcx, C: QueryCache> {
type UnerasedValue;
fn query_dispatcher(tcx: TyCtxt<'tcx>) -> &'tcx QueryVTable<'tcx, C>;
fn query_vtable(tcx: TyCtxt<'tcx>) -> &'tcx QueryVTable<'tcx, C>;
fn restore_val(value: C::Value) -> Self::UnerasedValue;
}
+5 -5
View File
@@ -501,7 +501,7 @@ pub(crate) fn __rust_end_short_backtrace<'tcx>(
#[cfg(debug_assertions)]
let _guard = tracing::span!(tracing::Level::TRACE, stringify!($name), ?key).entered();
execution::get_query_incr(
QueryType::query_dispatcher(tcx),
&tcx.query_system.query_vtables.$name,
tcx,
span,
key,
@@ -521,7 +521,7 @@ pub(crate) fn __rust_end_short_backtrace<'tcx>(
__mode: QueryMode,
) -> Option<Erased<queries::$name::Value<'tcx>>> {
Some(execution::get_query_non_incr(
QueryType::query_dispatcher(tcx),
&tcx.query_system.query_vtables.$name,
tcx,
span,
key,
@@ -628,7 +628,7 @@ impl<'tcx> QueryDispatcherUnerased<'tcx, queries::$name::Storage<'tcx>>
type UnerasedValue = queries::$name::Value<'tcx>;
#[inline(always)]
fn query_dispatcher(tcx: TyCtxt<'tcx>)
fn query_vtable(tcx: TyCtxt<'tcx>)
-> &'tcx QueryVTable<'tcx, queries::$name::Storage<'tcx>>
{
&tcx.query_system.query_vtables.$name
@@ -697,7 +697,7 @@ pub(crate) fn encode_query_results<'tcx>(
query_impl::$name::QueryType<'tcx>,
_
> (
query_impl::$name::QueryType::query_dispatcher(tcx),
&tcx.query_system.query_vtables.$name,
tcx,
encoder,
query_result_index,
@@ -707,7 +707,7 @@ pub(crate) fn encode_query_results<'tcx>(
pub(crate) fn query_key_hash_verify<'tcx>(tcx: TyCtxt<'tcx>) {
$crate::plumbing::query_key_hash_verify(
query_impl::$name::QueryType::query_dispatcher(tcx),
&tcx.query_system.query_vtables.$name,
tcx,
)
}