Skip to content

Commit 171c020

Browse files
incr.comp.: Remove saving and loading of legacy dep-graph.
1 parent 272c324 commit 171c020

File tree

17 files changed

+66
-1622
lines changed

17 files changed

+66
-1622
lines changed

src/librustc/dep_graph/graph.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,9 @@ impl DepGraph {
506506
None => {
507507
if dep_dep_node.kind.is_input() {
508508
// This input does not exist anymore.
509-
debug_assert!(dep_dep_node.extract_def_id(tcx).is_none());
509+
debug_assert!(dep_dep_node.extract_def_id(tcx).is_none(),
510+
"Encountered input {:?} without color",
511+
dep_dep_node);
510512
debug!("try_mark_green({:?}) - END - dependency {:?} \
511513
was deleted input", dep_node, dep_dep_node);
512514
return None;

src/librustc_driver/driver.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,8 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
642642
);
643643

644644
let dep_graph = if sess.opts.build_dep_graph() {
645-
let prev_dep_graph = time(time_passes, "load prev dep-graph (new)", || {
646-
rustc_incremental::load_dep_graph_new(sess)
645+
let prev_dep_graph = time(time_passes, "load prev dep-graph", || {
646+
rustc_incremental::load_dep_graph(sess)
647647
});
648648

649649
DepGraph::new(prev_dep_graph)
@@ -1052,9 +1052,9 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
10521052
tx,
10531053
output_filenames,
10541054
|tcx| {
1055-
time(time_passes,
1056-
"load_dep_graph",
1057-
|| rustc_incremental::load_dep_graph(tcx));
1055+
// Do some initialization of the DepGraph that can only be done with the
1056+
// tcx available.
1057+
rustc_incremental::dep_graph_tcx_init(tcx);
10581058

10591059
time(time_passes,
10601060
"stability checking",

src/librustc_incremental/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ mod persist;
3232

3333
pub use assert_dep_graph::assert_dep_graph;
3434
pub use persist::load_dep_graph;
35-
pub use persist::load_dep_graph_new;
35+
pub use persist::dep_graph_tcx_init;
3636
pub use persist::save_dep_graph;
3737
pub use persist::save_trans_partition;
3838
pub use persist::save_work_products;

src/librustc_incremental/persist/data.rs

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -10,78 +10,11 @@
1010

1111
//! The data that we will serialize and deserialize.
1212
13-
use rustc::dep_graph::{DepNode, WorkProduct, WorkProductId};
13+
use rustc::dep_graph::{WorkProduct, WorkProductId};
1414
use rustc::hir::def_id::DefIndex;
1515
use rustc::hir::map::DefPathHash;
16-
use rustc::ich::Fingerprint;
1716
use rustc::middle::cstore::EncodedMetadataHash;
1817
use rustc_data_structures::fx::FxHashMap;
19-
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
20-
21-
/// Data for use when recompiling the **current crate**.
22-
#[derive(Debug, RustcEncodable, RustcDecodable)]
23-
pub struct SerializedDepGraph {
24-
/// The set of all DepNodes in the graph
25-
pub nodes: IndexVec<DepNodeIndex, DepNode>,
26-
/// For each DepNode, stores the list of edges originating from that
27-
/// DepNode. Encoded as a [start, end) pair indexing into edge_list_data,
28-
/// which holds the actual DepNodeIndices of the target nodes.
29-
pub edge_list_indices: IndexVec<DepNodeIndex, (u32, u32)>,
30-
/// A flattened list of all edge targets in the graph. Edge sources are
31-
/// implicit in edge_list_indices.
32-
pub edge_list_data: Vec<DepNodeIndex>,
33-
34-
/// These are output nodes that have no incoming edges. We track
35-
/// these separately so that when we reload all edges, we don't
36-
/// lose track of these nodes.
37-
pub bootstrap_outputs: Vec<DepNode>,
38-
39-
/// These are hashes of two things:
40-
/// - the HIR nodes in this crate
41-
/// - the metadata nodes from dependent crates we use
42-
///
43-
/// In each case, we store a hash summarizing the contents of
44-
/// those items as they were at the time we did this compilation.
45-
/// In the case of HIR nodes, this hash is derived by walking the
46-
/// HIR itself. In the case of metadata nodes, the hash is loaded
47-
/// from saved state.
48-
///
49-
/// When we do the next compile, we will load these back up and
50-
/// compare them against the hashes we see at that time, which
51-
/// will tell us what has changed, either in this crate or in some
52-
/// crate that we depend on.
53-
///
54-
/// Because they will be reloaded, we don't store the DefId (which
55-
/// will be different when we next compile) related to each node,
56-
/// but rather the `DefPathIndex`. This can then be retraced
57-
/// to find the current def-id.
58-
pub hashes: Vec<(DepNodeIndex, Fingerprint)>,
59-
}
60-
61-
impl SerializedDepGraph {
62-
pub fn edge_targets_from(&self, source: DepNodeIndex) -> &[DepNodeIndex] {
63-
let targets = self.edge_list_indices[source];
64-
&self.edge_list_data[targets.0 as usize .. targets.1 as usize]
65-
}
66-
}
67-
68-
/// The index of a DepNode in the SerializedDepGraph::nodes array.
69-
#[derive(Copy, Clone, Hash, Eq, PartialEq, Ord, PartialOrd, Debug,
70-
RustcEncodable, RustcDecodable)]
71-
pub struct DepNodeIndex(pub u32);
72-
73-
impl Idx for DepNodeIndex {
74-
#[inline]
75-
fn new(idx: usize) -> Self {
76-
assert!(idx <= ::std::u32::MAX as usize);
77-
DepNodeIndex(idx as u32)
78-
}
79-
80-
#[inline]
81-
fn index(self) -> usize {
82-
self.0 as usize
83-
}
84-
}
8518

8619
#[derive(Debug, RustcEncodable, RustcDecodable)]
8720
pub struct SerializedWorkProduct {

src/librustc_incremental/persist/fs.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ use std::__rand::{thread_rng, Rng};
129129

130130
const LOCK_FILE_EXT: &'static str = ".lock";
131131
const DEP_GRAPH_FILENAME: &'static str = "dep-graph.bin";
132-
const DEP_GRAPH_NEW_FILENAME: &'static str = "dep-graph-new.bin";
133132
const WORK_PRODUCTS_FILENAME: &'static str = "work-products.bin";
134133
const METADATA_HASHES_FILENAME: &'static str = "metadata.bin";
135134

@@ -143,10 +142,6 @@ pub fn dep_graph_path(sess: &Session) -> PathBuf {
143142
in_incr_comp_dir_sess(sess, DEP_GRAPH_FILENAME)
144143
}
145144

146-
pub fn dep_graph_path_new(sess: &Session) -> PathBuf {
147-
in_incr_comp_dir_sess(sess, DEP_GRAPH_NEW_FILENAME)
148-
}
149-
150145
pub fn work_products_path(sess: &Session) -> PathBuf {
151146
in_incr_comp_dir_sess(sess, WORK_PRODUCTS_FILENAME)
152147
}

0 commit comments

Comments
 (0)