Lazy DefPath decoding for incremental compilation
This commit is contained in:
parent
db79d2f637
commit
e935d3832c
11 changed files with 275 additions and 43 deletions
|
@ -7,6 +7,7 @@ use rustc_data_structures::sync::{AtomicU32, AtomicU64, Lock, Lrc, Ordering};
|
|||
use rustc_data_structures::unlikely;
|
||||
use rustc_errors::Diagnostic;
|
||||
use rustc_index::vec::{Idx, IndexVec};
|
||||
use rustc_span::def_id::DefPathHash;
|
||||
|
||||
use parking_lot::{Condvar, Mutex};
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
|
@ -699,6 +700,18 @@ impl<K: DepKind> DepGraph<K> {
|
|||
data.current.intern_node(*dep_node, current_deps, fingerprint)
|
||||
};
|
||||
|
||||
// We have just loaded a deserialized `DepNode` from the previous
|
||||
// compilation session into the current one. If this was a foreign `DefId`,
|
||||
// then we stored additional information in the incr comp cache when we
|
||||
// initially created its fingerprint (see `DepNodeParams::to_fingerprint`)
|
||||
// We won't be calling `to_fingerprint` again for this `DepNode` (we no longer
|
||||
// have the original value), so we need to copy over this additional information
|
||||
// from the old incremental cache into the new cache that we serialize
|
||||
// and the end of this compilation session.
|
||||
if dep_node.kind.can_reconstruct_query_key() {
|
||||
tcx.register_reused_dep_path_hash(DefPathHash(dep_node.hash));
|
||||
}
|
||||
|
||||
// ... emitting any stored diagnostic ...
|
||||
|
||||
// FIXME: Store the fact that a node has diagnostics in a bit in the dep graph somewhere
|
||||
|
|
|
@ -15,6 +15,7 @@ use rustc_data_structures::profiling::SelfProfilerRef;
|
|||
use rustc_data_structures::sync::Lock;
|
||||
use rustc_data_structures::thin_vec::ThinVec;
|
||||
use rustc_errors::Diagnostic;
|
||||
use rustc_span::def_id::DefPathHash;
|
||||
|
||||
use std::fmt;
|
||||
use std::hash::Hash;
|
||||
|
@ -32,6 +33,8 @@ pub trait DepContext: Copy {
|
|||
/// Try to force a dep node to execute and see if it's green.
|
||||
fn try_force_from_dep_node(&self, dep_node: &DepNode<Self::DepKind>) -> bool;
|
||||
|
||||
fn register_reused_dep_path_hash(&self, hash: DefPathHash);
|
||||
|
||||
/// Return whether the current session is tainted by errors.
|
||||
fn has_errors_or_delayed_span_bugs(&self) -> bool;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue