Skip to content

Commit 484da37

Browse files
committed
rename HashesMap to IncrementalHashesMap
1 parent 226e1e5 commit 484da37

File tree

8 files changed

+50
-43
lines changed

8 files changed

+50
-43
lines changed

src/librustc_driver/driver.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use rustc::util::common::time;
2626
use rustc::util::nodemap::NodeSet;
2727
use rustc_back::sha2::{Sha256, Digest};
2828
use rustc_borrowck as borrowck;
29-
use rustc_incremental::{self, HashesMap};
29+
use rustc_incremental::{self, IncrementalHashesMap};
3030
use rustc_resolve::{MakeGlobMap, Resolver};
3131
use rustc_metadata::macro_import;
3232
use rustc_metadata::creader::read_local_crates;
@@ -172,7 +172,7 @@ pub fn compile_input(sess: &Session,
172172
resolutions,
173173
&arenas,
174174
&crate_name,
175-
|tcx, mir_map, analysis, hashes_map, result| {
175+
|tcx, mir_map, analysis, incremental_hashes_map, result| {
176176
{
177177
// Eventually, we will want to track plugins.
178178
let _ignore = tcx.dep_graph.in_ignore();
@@ -203,7 +203,7 @@ pub fn compile_input(sess: &Session,
203203
let trans = phase_4_translate_to_llvm(tcx,
204204
mir_map.unwrap(),
205205
analysis,
206-
&hashes_map);
206+
&incremental_hashes_map);
207207

208208
if log_enabled!(::log::INFO) {
209209
println!("Post-trans");
@@ -798,7 +798,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
798798
where F: for<'a> FnOnce(TyCtxt<'a, 'tcx, 'tcx>,
799799
Option<MirMap<'tcx>>,
800800
ty::CrateAnalysis,
801-
HashesMap,
801+
IncrementalHashesMap,
802802
CompileResult) -> R
803803
{
804804
macro_rules! try_with_f {
@@ -862,16 +862,16 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
862862
index,
863863
name,
864864
|tcx| {
865-
let hashes_map =
865+
let incremental_hashes_map =
866866
time(time_passes,
867-
"compute_hashes_map",
868-
|| rustc_incremental::compute_hashes_map(tcx));
867+
"compute_incremental_hashes_map",
868+
|| rustc_incremental::compute_incremental_hashes_map(tcx));
869869
time(time_passes,
870870
"load_dep_graph",
871-
|| rustc_incremental::load_dep_graph(tcx, &hashes_map));
871+
|| rustc_incremental::load_dep_graph(tcx, &incremental_hashes_map));
872872

873873
// passes are timed inside typeck
874-
try_with_f!(typeck::check_crate(tcx), (tcx, None, analysis, hashes_map));
874+
try_with_f!(typeck::check_crate(tcx), (tcx, None, analysis, incremental_hashes_map));
875875

876876
time(time_passes,
877877
"const checking",
@@ -941,7 +941,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
941941
// lint warnings and so on -- kindck used to do this abort, but
942942
// kindck is gone now). -nmatsakis
943943
if sess.err_count() > 0 {
944-
return Ok(f(tcx, Some(mir_map), analysis, hashes_map, Err(sess.err_count())));
944+
return Ok(f(tcx, Some(mir_map), analysis, incremental_hashes_map, Err(sess.err_count())));
945945
}
946946

947947
analysis.reachable =
@@ -969,18 +969,18 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
969969

970970
// The above three passes generate errors w/o aborting
971971
if sess.err_count() > 0 {
972-
return Ok(f(tcx, Some(mir_map), analysis, hashes_map, Err(sess.err_count())));
972+
return Ok(f(tcx, Some(mir_map), analysis, incremental_hashes_map, Err(sess.err_count())));
973973
}
974974

975-
Ok(f(tcx, Some(mir_map), analysis, hashes_map, Ok(())))
975+
Ok(f(tcx, Some(mir_map), analysis, incremental_hashes_map, Ok(())))
976976
})
977977
}
978978

979979
/// Run the translation phase to LLVM, after which the AST and analysis can
980980
pub fn phase_4_translate_to_llvm<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
981981
mut mir_map: MirMap<'tcx>,
982982
analysis: ty::CrateAnalysis,
983-
hashes_map: &HashesMap)
983+
incremental_hashes_map: &IncrementalHashesMap)
984984
-> trans::CrateTranslation {
985985
let time_passes = tcx.sess.time_passes();
986986

@@ -1014,15 +1014,15 @@ pub fn phase_4_translate_to_llvm<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
10141014
let translation =
10151015
time(time_passes,
10161016
"translation",
1017-
move || trans::trans_crate(tcx, &mir_map, analysis, &hashes_map));
1017+
move || trans::trans_crate(tcx, &mir_map, analysis, &incremental_hashes_map));
10181018

10191019
time(time_passes,
10201020
"assert dep graph",
10211021
move || rustc_incremental::assert_dep_graph(tcx));
10221022

10231023
time(time_passes,
10241024
"serialize dep graph",
1025-
move || rustc_incremental::save_dep_graph(tcx, &hashes_map));
1025+
move || rustc_incremental::save_dep_graph(tcx, &incremental_hashes_map));
10261026

10271027
translation
10281028
}

src/librustc_incremental/calculate_svh/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ use self::svh_visitor::StrictVersionHashVisitor;
4141

4242
mod svh_visitor;
4343

44-
pub type HashesMap = FnvHashMap<DepNode<DefId>, u64>;
44+
pub type IncrementalHashesMap = FnvHashMap<DepNode<DefId>, u64>;
4545

46-
pub fn compute_hashes_map<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> HashesMap {
46+
pub fn compute_incremental_hashes_map<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>)
47+
-> IncrementalHashesMap {
4748
let _ignore = tcx.dep_graph.in_ignore();
4849
let krate = tcx.map.krate();
4950
let mut visitor = HashItemsVisitor { tcx: tcx, hashes: FnvHashMap() };
@@ -55,7 +56,7 @@ pub fn compute_hashes_map<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> HashesMa
5556

5657
struct HashItemsVisitor<'a, 'tcx: 'a> {
5758
tcx: TyCtxt<'a, 'tcx, 'tcx>,
58-
hashes: HashesMap,
59+
hashes: IncrementalHashesMap,
5960
}
6061

6162
impl<'a, 'tcx> HashItemsVisitor<'a, 'tcx> {

src/librustc_incremental/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ mod calculate_svh;
3838
mod persist;
3939

4040
pub use assert_dep_graph::assert_dep_graph;
41-
pub use calculate_svh::compute_hashes_map;
42-
pub use calculate_svh::HashesMap;
41+
pub use calculate_svh::compute_incremental_hashes_map;
42+
pub use calculate_svh::IncrementalHashesMap;
4343
pub use persist::load_dep_graph;
4444
pub use persist::save_dep_graph;
4545
pub use persist::save_trans_partition;

src/librustc_incremental/persist/hash.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,24 @@ use std::io::{ErrorKind, Read};
2020
use std::fs::File;
2121
use syntax::ast;
2222

23-
use HashesMap;
23+
use IncrementalHashesMap;
2424
use super::data::*;
2525
use super::util::*;
2626

2727
pub struct HashContext<'a, 'tcx: 'a> {
2828
pub tcx: TyCtxt<'a, 'tcx, 'tcx>,
29-
hashes_map: &'a HashesMap,
29+
incremental_hashes_map: &'a IncrementalHashesMap,
3030
item_metadata_hashes: FnvHashMap<DefId, u64>,
3131
crate_hashes: FnvHashMap<ast::CrateNum, Svh>,
3232
}
3333

3434
impl<'a, 'tcx> HashContext<'a, 'tcx> {
35-
pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, hashes_map: &'a HashesMap) -> Self {
35+
pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>,
36+
incremental_hashes_map: &'a IncrementalHashesMap)
37+
-> Self {
3638
HashContext {
3739
tcx: tcx,
38-
hashes_map: hashes_map,
40+
incremental_hashes_map: incremental_hashes_map,
3941
item_metadata_hashes: FnvHashMap(),
4042
crate_hashes: FnvHashMap(),
4143
}
@@ -63,7 +65,7 @@ impl<'a, 'tcx> HashContext<'a, 'tcx> {
6365
def_id,
6466
self.tcx.item_path_str(def_id));
6567

66-
Some((def_id, self.hashes_map[dep_node]))
68+
Some((def_id, self.incremental_hashes_map[dep_node]))
6769
}
6870

6971
// MetaData from other crates is an *input* to us.

src/librustc_incremental/persist/load.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use std::io::Read;
2222
use std::fs::{self, File};
2323
use std::path::{Path};
2424

25-
use HashesMap;
25+
use IncrementalHashesMap;
2626
use super::data::*;
2727
use super::directory::*;
2828
use super::dirty_clean;
@@ -40,17 +40,17 @@ type CleanEdges = Vec<(DepNode<DefId>, DepNode<DefId>)>;
4040
/// actually it doesn't matter all that much.) See `README.md` for
4141
/// more general overview.
4242
pub fn load_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
43-
hashes: &HashesMap) {
43+
incremental_hashes_map: &IncrementalHashesMap) {
4444
if tcx.sess.opts.incremental.is_none() {
4545
return;
4646
}
4747

4848
let _ignore = tcx.dep_graph.in_ignore();
49-
load_dep_graph_if_exists(tcx, hashes);
49+
load_dep_graph_if_exists(tcx, incremental_hashes_map);
5050
}
5151

5252
fn load_dep_graph_if_exists<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
53-
hashes: &HashesMap) {
53+
incremental_hashes_map: &IncrementalHashesMap) {
5454
let dep_graph_path = dep_graph_path(tcx).unwrap();
5555
let dep_graph_data = match load_data(tcx.sess, &dep_graph_path) {
5656
Some(p) => p,
@@ -63,7 +63,7 @@ fn load_dep_graph_if_exists<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
6363
None => return // no file
6464
};
6565

66-
match decode_dep_graph(tcx, hashes, &dep_graph_data, &work_products_data) {
66+
match decode_dep_graph(tcx, incremental_hashes_map, &dep_graph_data, &work_products_data) {
6767
Ok(dirty_nodes) => dirty_nodes,
6868
Err(err) => {
6969
tcx.sess.warn(
@@ -100,7 +100,7 @@ fn load_data(sess: &Session, path: &Path) -> Option<Vec<u8>> {
100100
/// Decode the dep graph and load the edges/nodes that are still clean
101101
/// into `tcx.dep_graph`.
102102
pub fn decode_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
103-
hashes: &HashesMap,
103+
incremental_hashes_map: &IncrementalHashesMap,
104104
dep_graph_data: &[u8],
105105
work_products_data: &[u8])
106106
-> Result<(), Error>
@@ -137,7 +137,10 @@ pub fn decode_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
137137
// reason for this is that this way we can include nodes that have
138138
// been removed (which no longer have a `DefId` in the current
139139
// compilation).
140-
let dirty_raw_source_nodes = dirty_nodes(tcx, hashes, &serialized_dep_graph.hashes, &retraced);
140+
let dirty_raw_source_nodes = dirty_nodes(tcx,
141+
incremental_hashes_map,
142+
&serialized_dep_graph.hashes,
143+
&retraced);
141144

142145
// Create a list of (raw-source-node ->
143146
// retracted-target-node) edges. In the process of retracing the
@@ -210,11 +213,11 @@ pub fn decode_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
210213
/// Computes which of the original set of def-ids are dirty. Stored in
211214
/// a bit vector where the index is the DefPathIndex.
212215
fn dirty_nodes<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
213-
hashes: &HashesMap,
216+
incremental_hashes_map: &IncrementalHashesMap,
214217
serialized_hashes: &[SerializedHash],
215218
retraced: &RetracedDefIdDirectory)
216219
-> DirtyNodes {
217-
let mut hcx = HashContext::new(tcx, hashes);
220+
let mut hcx = HashContext::new(tcx, incremental_hashes_map);
218221
let mut dirty_nodes = FnvHashSet();
219222

220223
for hash in serialized_hashes {

src/librustc_incremental/persist/save.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,22 @@ use std::io::{self, Cursor, Write};
2121
use std::fs::{self, File};
2222
use std::path::PathBuf;
2323

24-
use HashesMap;
24+
use IncrementalHashesMap;
2525
use super::data::*;
2626
use super::directory::*;
2727
use super::hash::*;
2828
use super::preds::*;
2929
use super::util::*;
3030

31-
pub fn save_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hashes_map: &HashesMap) {
31+
pub fn save_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
32+
incremental_hashes_map: &IncrementalHashesMap) {
3233
debug!("save_dep_graph()");
3334
let _ignore = tcx.dep_graph.in_ignore();
3435
let sess = tcx.sess;
3536
if sess.opts.incremental.is_none() {
3637
return;
3738
}
38-
let mut hcx = HashContext::new(tcx, hashes_map);
39+
let mut hcx = HashContext::new(tcx, incremental_hashes_map);
3940
let mut builder = DefIdDirectoryBuilder::new(tcx);
4041
let query = tcx.dep_graph.query();
4142
let preds = Predecessors::new(&query, &mut hcx);

src/librustc_trans/back/link.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use util::fs::fix_windows_verbatim_for_gcc;
2828
use rustc::dep_graph::DepNode;
2929
use rustc::hir::svh::Svh;
3030
use rustc_back::tempdir::TempDir;
31-
use rustc_incremental::HashesMap;
31+
use rustc_incremental::IncrementalHashesMap;
3232

3333
use std::ascii;
3434
use std::char;
@@ -125,12 +125,12 @@ pub fn find_crate_name(sess: Option<&Session>,
125125

126126
}
127127

128-
pub fn build_link_meta(hashes_map: &HashesMap,
128+
pub fn build_link_meta(incremental_hashes_map: &IncrementalHashesMap,
129129
name: &str)
130130
-> LinkMeta {
131131
let r = LinkMeta {
132132
crate_name: name.to_owned(),
133-
crate_hash: Svh::new(hashes_map[&DepNode::Krate]),
133+
crate_hash: Svh::new(incremental_hashes_map[&DepNode::Krate]),
134134
};
135135
info!("{:?}", r);
136136
return r;

src/librustc_trans/base.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ use rustc::hir::map as hir_map;
4848
use rustc::util::common::time;
4949
use rustc::mir::mir_map::MirMap;
5050
use rustc_data_structures::graph::OUTGOING;
51-
use rustc_incremental::HashesMap;
51+
use rustc_incremental::IncrementalHashesMap;
5252
use session::config::{self, NoDebugInfo, FullDebugInfo};
5353
use session::Session;
5454
use _match;
@@ -2483,7 +2483,7 @@ pub fn filter_reachable_ids(tcx: TyCtxt, reachable: NodeSet) -> NodeSet {
24832483
pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
24842484
mir_map: &MirMap<'tcx>,
24852485
analysis: ty::CrateAnalysis,
2486-
hashes_map: &HashesMap)
2486+
incremental_hashes_map: &IncrementalHashesMap)
24872487
-> CrateTranslation {
24882488
let _task = tcx.dep_graph.in_task(DepNode::TransCrate);
24892489

@@ -2508,7 +2508,7 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
25082508
tcx.sess.opts.debug_assertions
25092509
};
25102510

2511-
let link_meta = link::build_link_meta(hashes_map, name);
2511+
let link_meta = link::build_link_meta(incremental_hashes_map, name);
25122512

25132513
let shared_ccx = SharedCrateContext::new(tcx,
25142514
&mir_map,

0 commit comments

Comments
 (0)