Auto merge of #57035 - Zoxc:query-pref9, r=michaelwoerister
Uninline some debugging code and use unlikely! macro r? @michaelwoerister
This commit is contained in:
commit
2cf7f55662
@ -503,31 +503,11 @@ fn load_from_disk_and_cache_in_memory<Q: QueryDescription<'gcx>>(
|
||||
|
||||
// If -Zincremental-verify-ich is specified, re-hash results from
|
||||
// the cache and make sure that they have the expected fingerprint.
|
||||
if self.sess.opts.debugging_opts.incremental_verify_ich {
|
||||
use rustc_data_structures::stable_hasher::{StableHasher, HashStable};
|
||||
use ich::Fingerprint;
|
||||
|
||||
assert!(Some(self.dep_graph.fingerprint_of(dep_node_index)) ==
|
||||
self.dep_graph.prev_fingerprint_of(dep_node),
|
||||
"Fingerprint for green query instance not loaded \
|
||||
from cache: {:?}", dep_node);
|
||||
|
||||
debug!("BEGIN verify_ich({:?})", dep_node);
|
||||
let mut hcx = self.create_stable_hashing_context();
|
||||
let mut hasher = StableHasher::new();
|
||||
|
||||
result.hash_stable(&mut hcx, &mut hasher);
|
||||
|
||||
let new_hash: Fingerprint = hasher.finish();
|
||||
debug!("END verify_ich({:?})", dep_node);
|
||||
|
||||
let old_hash = self.dep_graph.fingerprint_of(dep_node_index);
|
||||
|
||||
assert!(new_hash == old_hash, "Found unstable fingerprints \
|
||||
for {:?}", dep_node);
|
||||
if unlikely!(self.sess.opts.debugging_opts.incremental_verify_ich) {
|
||||
self.incremental_verify_ich::<Q>(&result, dep_node, dep_node_index);
|
||||
}
|
||||
|
||||
if self.sess.opts.debugging_opts.query_dep_graph {
|
||||
if unlikely!(self.sess.opts.debugging_opts.query_dep_graph) {
|
||||
self.dep_graph.mark_loaded_from_cache(dep_node_index, true);
|
||||
}
|
||||
|
||||
@ -536,6 +516,37 @@ fn load_from_disk_and_cache_in_memory<Q: QueryDescription<'gcx>>(
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
#[cold]
|
||||
fn incremental_verify_ich<Q: QueryDescription<'gcx>>(
|
||||
self,
|
||||
result: &Q::Value,
|
||||
dep_node: &DepNode,
|
||||
dep_node_index: DepNodeIndex,
|
||||
) {
|
||||
use rustc_data_structures::stable_hasher::{StableHasher, HashStable};
|
||||
use ich::Fingerprint;
|
||||
|
||||
assert!(Some(self.dep_graph.fingerprint_of(dep_node_index)) ==
|
||||
self.dep_graph.prev_fingerprint_of(dep_node),
|
||||
"Fingerprint for green query instance not loaded \
|
||||
from cache: {:?}", dep_node);
|
||||
|
||||
debug!("BEGIN verify_ich({:?})", dep_node);
|
||||
let mut hcx = self.create_stable_hashing_context();
|
||||
let mut hasher = StableHasher::new();
|
||||
|
||||
result.hash_stable(&mut hcx, &mut hasher);
|
||||
|
||||
let new_hash: Fingerprint = hasher.finish();
|
||||
debug!("END verify_ich({:?})", dep_node);
|
||||
|
||||
let old_hash = self.dep_graph.fingerprint_of(dep_node_index);
|
||||
|
||||
assert!(new_hash == old_hash, "Found unstable fingerprints \
|
||||
for {:?}", dep_node);
|
||||
}
|
||||
|
||||
fn force_query_with_job<Q: QueryDescription<'gcx>>(
|
||||
self,
|
||||
key: Q::Key,
|
||||
@ -578,7 +589,7 @@ fn force_query_with_job<Q: QueryDescription<'gcx>>(
|
||||
|
||||
let ((result, dep_node_index), diagnostics) = res;
|
||||
|
||||
if self.sess.opts.debugging_opts.query_dep_graph {
|
||||
if unlikely!(self.sess.opts.debugging_opts.query_dep_graph) {
|
||||
self.dep_graph.mark_loaded_from_cache(dep_node_index, false);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user