1
Fork 0

Ban deps only during query loading from disk

This commit is contained in:
Aaron Hill 2021-12-14 10:59:29 -05:00
parent 75181dc22f
commit 49560e9c49
No known key found for this signature in database
GPG key ID: B4087E510E98B164

View file

@ -2,14 +2,14 @@
//! generate the actual methods on tcx which find and execute the provider, //! generate the actual methods on tcx which find and execute the provider,
//! manage the caches, and so forth. //! manage the caches, and so forth.
use crate::dep_graph::{DepContext, DepNode, DepNodeIndex, DepNodeParams}; use crate::dep_graph::{DepContext, DepNode, DepNodeIndex, DepNodeParams, TaskDeps};
use crate::query::caches::QueryCache; use crate::query::caches::QueryCache;
use crate::query::config::{QueryDescription, QueryVtable}; use crate::query::config::{QueryDescription, QueryVtable};
use crate::query::job::{ use crate::query::job::{
report_cycle, QueryInfo, QueryJob, QueryJobId, QueryJobInfo, QueryShardJobId, report_cycle, QueryInfo, QueryJob, QueryJobId, QueryJobInfo, QueryShardJobId,
}; };
use crate::query::{QueryContext, QueryMap, QuerySideEffects, QueryStackFrame}; use crate::query::{QueryContext, QueryMap, QuerySideEffects, QueryStackFrame};
use crate::dep_graph::DepKind;
use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::{FxHashMap, FxHasher}; use rustc_data_structures::fx::{FxHashMap, FxHasher};
#[cfg(parallel_compiler)] #[cfg(parallel_compiler)]
@ -515,7 +515,13 @@ where
// Some things are never cached on disk. // Some things are never cached on disk.
if query.cache_on_disk { if query.cache_on_disk {
let prof_timer = tcx.dep_context().profiler().incr_cache_loading(); let prof_timer = tcx.dep_context().profiler().incr_cache_loading();
let result = query.try_load_from_disk(tcx, prev_dep_node_index);
let mut deps = TaskDeps::default();
deps.read_allowed = false;
let deps = Lock::new(deps);
let result = CTX::DepKind::with_deps(Some(&deps), || {
query.try_load_from_disk(tcx, prev_dep_node_index)
});
prof_timer.finish_with_query_invocation_id(dep_node_index.into()); prof_timer.finish_with_query_invocation_id(dep_node_index.into());
if let Some(result) = result { if let Some(result) = result {