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,
//! 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::config::{QueryDescription, QueryVtable};
use crate::query::job::{
report_cycle, QueryInfo, QueryJob, QueryJobId, QueryJobInfo, QueryShardJobId,
};
use crate::query::{QueryContext, QueryMap, QuerySideEffects, QueryStackFrame};
use crate::dep_graph::DepKind;
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::{FxHashMap, FxHasher};
#[cfg(parallel_compiler)]
@ -515,7 +515,13 @@ fn try_load_from_disk_and_cache_in_memory<CTX, K, V>(
// Some things are never cached on disk.
if query.cache_on_disk {
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());
if let Some(result) = result {