Complete job outside of force_query_with_job.

This commit is contained in:
Camille GILLOT 2020-12-30 22:08:57 +01:00
parent 13d4eb92b8
commit d2304008c1

View File

@ -484,12 +484,11 @@ where
tcx.store_side_effects_for_anon_node(dep_node_index, side_effects);
}
let result = job.complete(result, dep_node_index);
(result, dep_node_index)
} else if query.eval_always {
// `to_dep_node` is expensive for some `DepKind`s.
let dep_node = dep_node.unwrap_or_else(|| query.to_dep_node(*tcx.dep_context(), &key));
force_query_with_job(tcx, key, job, dep_node, query, compute)
force_query_with_job(tcx, key, job.id, dep_node, query, compute)
} else {
// `to_dep_node` is expensive for some `DepKind`s.
let dep_node = dep_node.unwrap_or_else(|| query.to_dep_node(*tcx.dep_context(), &key));
@ -500,12 +499,12 @@ where
try_load_from_disk_and_cache_in_memory(tcx, &key, &dep_node, query, compute)
});
if let Some((result, dep_node_index)) = loaded {
let result = job.complete(result, dep_node_index);
(result, dep_node_index)
} else {
force_query_with_job(tcx, key, job, dep_node, query, compute)
force_query_with_job(tcx, key, job.id, dep_node, query, compute)
}
};
let result = job.complete(result, dep_node_index);
(result, Some(dep_node_index))
}
@ -636,22 +635,22 @@ fn incremental_verify_ich<CTX, K, V: Debug>(
}
}
fn force_query_with_job<C, CTX>(
fn force_query_with_job<CTX, K, V>(
tcx: CTX,
key: C::Key,
job: JobOwner<'_, CTX::DepKind, C>,
key: K,
job_id: QueryJobId<CTX::DepKind>,
dep_node: DepNode<CTX::DepKind>,
query: &QueryVtable<CTX, C::Key, C::Value>,
compute: fn(CTX::DepContext, C::Key) -> C::Value,
) -> (C::Stored, DepNodeIndex)
query: &QueryVtable<CTX, K, V>,
compute: fn(CTX::DepContext, K) -> V,
) -> (V, DepNodeIndex)
where
C: QueryCache,
CTX: QueryContext,
K: Debug,
{
let prof_timer = tcx.dep_context().profiler().query_provider();
let ((result, dep_node_index), diagnostics) = with_diagnostics(|diagnostics| {
tcx.start_query(job.id, diagnostics, || {
tcx.start_query(job_id, diagnostics, || {
if query.eval_always {
tcx.dep_context().dep_graph().with_eval_always_task(
dep_node,
@ -680,8 +679,6 @@ where
tcx.store_side_effects(dep_node_index, side_effects);
}
let result = job.complete(result, dep_node_index);
(result, dep_node_index)
}