Specialize query execution for incremental and non-incremental
This commit is contained in:
parent
eda41addfc
commit
882a9684f9
4 changed files with 76 additions and 17 deletions
|
@ -34,7 +34,8 @@ use rustc_middle::ty::TyCtxt;
|
|||
use rustc_query_system::dep_graph::SerializedDepNodeIndex;
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_query_system::query::{
|
||||
get_query, HashResult, QueryCache, QueryConfig, QueryInfo, QueryMap, QueryMode, QueryState,
|
||||
get_query_incr, get_query_non_incr, HashResult, QueryCache, QueryConfig, QueryInfo, QueryMap,
|
||||
QueryMode, QueryState,
|
||||
};
|
||||
use rustc_query_system::HandleCycleError;
|
||||
use rustc_query_system::Value;
|
||||
|
@ -203,6 +204,7 @@ pub fn query_system<'tcx>(
|
|||
local_providers: Providers,
|
||||
extern_providers: ExternProviders,
|
||||
on_disk_cache: Option<OnDiskCache<'tcx>>,
|
||||
incremental: bool,
|
||||
) -> QuerySystem<'tcx> {
|
||||
QuerySystem {
|
||||
states: Default::default(),
|
||||
|
@ -211,7 +213,7 @@ pub fn query_system<'tcx>(
|
|||
dynamic_queries: dynamic_queries(),
|
||||
on_disk_cache,
|
||||
fns: QuerySystemFns {
|
||||
engine: engine(),
|
||||
engine: engine(incremental),
|
||||
local_providers,
|
||||
extern_providers,
|
||||
query_structs: make_dep_kind_array!(query_structs).to_vec(),
|
||||
|
|
|
@ -494,7 +494,7 @@ macro_rules! define_queries {
|
|||
(
|
||||
$($(#[$attr:meta])*
|
||||
[$($modifiers:tt)*] fn $name:ident($($K:tt)*) -> $V:ty,)*) => {
|
||||
mod get_query {
|
||||
mod get_query_incr {
|
||||
use super::*;
|
||||
|
||||
$(
|
||||
|
@ -506,7 +506,7 @@ macro_rules! define_queries {
|
|||
key: query_keys::$name<'tcx>,
|
||||
mode: QueryMode,
|
||||
) -> Option<Erase<query_values::$name<'tcx>>> {
|
||||
get_query(
|
||||
get_query_incr(
|
||||
queries::$name::config(tcx),
|
||||
QueryCtxt::new(tcx),
|
||||
span,
|
||||
|
@ -517,9 +517,37 @@ macro_rules! define_queries {
|
|||
)*
|
||||
}
|
||||
|
||||
pub(crate) fn engine() -> QueryEngine {
|
||||
QueryEngine {
|
||||
$($name: get_query::$name,)*
|
||||
mod get_query_non_incr {
|
||||
use super::*;
|
||||
|
||||
$(
|
||||
#[inline(always)]
|
||||
#[tracing::instrument(level = "trace", skip(tcx))]
|
||||
pub(super) fn $name<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
span: Span,
|
||||
key: query_keys::$name<'tcx>,
|
||||
__mode: QueryMode,
|
||||
) -> Option<Erase<query_values::$name<'tcx>>> {
|
||||
Some(get_query_non_incr(
|
||||
queries::$name::config(tcx),
|
||||
QueryCtxt::new(tcx),
|
||||
span,
|
||||
key,
|
||||
))
|
||||
}
|
||||
)*
|
||||
}
|
||||
|
||||
pub(crate) fn engine(incremental: bool) -> QueryEngine {
|
||||
if incremental {
|
||||
QueryEngine {
|
||||
$($name: get_query_incr::$name,)*
|
||||
}
|
||||
} else {
|
||||
QueryEngine {
|
||||
$($name: get_query_non_incr::$name,)*
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue