Merge two query callbacks arrays.
This commit is contained in:
parent
dc7143367c
commit
b09de95fab
12 changed files with 179 additions and 246 deletions
|
@ -60,8 +60,11 @@ impl<K: DepKind> DepNode<K> {
|
|||
/// Creates a new, parameterless DepNode. This method will assert
|
||||
/// that the DepNode corresponding to the given DepKind actually
|
||||
/// does not require any parameters.
|
||||
pub fn new_no_params(kind: K) -> DepNode<K> {
|
||||
debug_assert_eq!(kind.fingerprint_style(), FingerprintStyle::Unit);
|
||||
pub fn new_no_params<Ctxt>(tcx: Ctxt, kind: K) -> DepNode<K>
|
||||
where
|
||||
Ctxt: super::DepContext<DepKind = K>,
|
||||
{
|
||||
debug_assert_eq!(tcx.fingerprint_style(kind), FingerprintStyle::Unit);
|
||||
DepNode { kind, hash: Fingerprint::ZERO.into() }
|
||||
}
|
||||
|
||||
|
@ -75,7 +78,7 @@ impl<K: DepKind> DepNode<K> {
|
|||
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
if !kind.fingerprint_style().reconstructible()
|
||||
if !tcx.fingerprint_style(kind).reconstructible()
|
||||
&& (tcx.sess().opts.debugging_opts.incremental_info
|
||||
|| tcx.sess().opts.debugging_opts.query_dep_graph)
|
||||
{
|
||||
|
|
|
@ -252,7 +252,7 @@ impl<K: DepKind> DepGraph<K> {
|
|||
key
|
||||
);
|
||||
|
||||
let task_deps = if key.kind.is_eval_always() {
|
||||
let task_deps = if cx.dep_context().is_eval_always(key.kind) {
|
||||
None
|
||||
} else {
|
||||
Some(Lock::new(TaskDeps {
|
||||
|
@ -316,7 +316,7 @@ impl<K: DepKind> DepGraph<K> {
|
|||
where
|
||||
OP: FnOnce() -> R,
|
||||
{
|
||||
debug_assert!(!dep_kind.is_eval_always());
|
||||
debug_assert!(!cx.is_eval_always(dep_kind));
|
||||
|
||||
if let Some(ref data) = self.data {
|
||||
let task_deps = Lock::new(TaskDeps::default());
|
||||
|
@ -493,7 +493,7 @@ impl<K: DepKind> DepGraph<K> {
|
|||
tcx: Ctxt,
|
||||
dep_node: &DepNode<K>,
|
||||
) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> {
|
||||
debug_assert!(!dep_node.kind.is_eval_always());
|
||||
debug_assert!(!tcx.dep_context().is_eval_always(dep_node.kind));
|
||||
|
||||
// Return None if the dep graph is disabled
|
||||
let data = self.data.as_ref()?;
|
||||
|
@ -553,7 +553,7 @@ impl<K: DepKind> DepGraph<K> {
|
|||
|
||||
// We don't know the state of this dependency. If it isn't
|
||||
// an eval_always node, let's try to mark it green recursively.
|
||||
if !dep_dep_node.kind.is_eval_always() {
|
||||
if !tcx.dep_context().is_eval_always(dep_dep_node.kind) {
|
||||
debug!(
|
||||
"try_mark_previous_green({:?}) --- state of dependency {:?} ({}) \
|
||||
is unknown, trying to mark it green",
|
||||
|
@ -643,7 +643,7 @@ impl<K: DepKind> DepGraph<K> {
|
|||
}
|
||||
|
||||
// We never try to mark eval_always nodes as green
|
||||
debug_assert!(!dep_node.kind.is_eval_always());
|
||||
debug_assert!(!tcx.dep_context().is_eval_always(dep_node.kind));
|
||||
|
||||
debug_assert_eq!(data.previous.index_to_node(prev_dep_node_index), *dep_node);
|
||||
|
||||
|
|
|
@ -32,6 +32,11 @@ pub trait DepContext: Copy {
|
|||
|
||||
/// Access the compiler session.
|
||||
fn sess(&self) -> &Session;
|
||||
|
||||
/// Return whether this kind always require evaluation.
|
||||
fn is_eval_always(&self, kind: Self::DepKind) -> bool;
|
||||
|
||||
fn fingerprint_style(&self, kind: Self::DepKind) -> FingerprintStyle;
|
||||
}
|
||||
|
||||
pub trait HasDepContext: Copy {
|
||||
|
@ -75,9 +80,6 @@ impl FingerprintStyle {
|
|||
pub trait DepKind: Copy + fmt::Debug + Eq + Hash + Send + Encodable<FileEncoder> + 'static {
|
||||
const NULL: Self;
|
||||
|
||||
/// Return whether this kind always require evaluation.
|
||||
fn is_eval_always(&self) -> bool;
|
||||
|
||||
/// Implementation of `std::fmt::Debug` for `DepNode`.
|
||||
fn debug_node(node: &DepNode<Self>, f: &mut fmt::Formatter<'_>) -> fmt::Result;
|
||||
|
||||
|
@ -90,6 +92,4 @@ pub trait DepKind: Copy + fmt::Debug + Eq + Hash + Send + Encodable<FileEncoder>
|
|||
fn read_deps<OP>(op: OP)
|
||||
where
|
||||
OP: for<'a> FnOnce(Option<&'a Lock<TaskDeps<Self>>>);
|
||||
|
||||
fn fingerprint_style(&self) -> FingerprintStyle;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//! generate the actual methods on tcx which find and execute the provider,
|
||||
//! manage the caches, and so forth.
|
||||
|
||||
use crate::dep_graph::{DepContext, DepKind, DepNode, DepNodeIndex, DepNodeParams};
|
||||
use crate::dep_graph::{DepContext, DepNode, DepNodeIndex, DepNodeParams};
|
||||
use crate::query::caches::QueryCache;
|
||||
use crate::query::config::{QueryDescription, QueryVtable, QueryVtableExt};
|
||||
use crate::query::job::{
|
||||
|
@ -520,14 +520,6 @@ where
|
|||
let result = query.try_load_from_disk(tcx, prev_dep_node_index);
|
||||
prof_timer.finish_with_query_invocation_id(dep_node_index.into());
|
||||
|
||||
// We always expect to find a cached result for things that
|
||||
// can be forced from `DepNode`.
|
||||
debug_assert!(
|
||||
!dep_node.kind.fingerprint_style().reconstructible() || result.is_some(),
|
||||
"missing on-disk cache entry for {:?}",
|
||||
dep_node
|
||||
);
|
||||
|
||||
if let Some(result) = result {
|
||||
// If `-Zincremental-verify-ich` is specified, re-hash results from
|
||||
// the cache and make sure that they have the expected fingerprint.
|
||||
|
@ -537,6 +529,14 @@ where
|
|||
|
||||
return Some((result, dep_node_index));
|
||||
}
|
||||
|
||||
// We always expect to find a cached result for things that
|
||||
// can be forced from `DepNode`.
|
||||
debug_assert!(
|
||||
!tcx.dep_context().fingerprint_style(dep_node.kind).reconstructible(),
|
||||
"missing on-disk cache entry for {:?}",
|
||||
dep_node
|
||||
);
|
||||
}
|
||||
|
||||
// We could not load a result from the on-disk cache, so
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue