diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2016-08-23 07:47:14 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2016-08-23 07:47:14 -0400 |
| commit | 484da378452ed123919ee6d4d5a7e4e98c5d4060 (patch) | |
| tree | 5a2f76fe16afbd6302500bddd0c47c91f824bde8 | |
| parent | 226e1e5ded651f18a9fef8e5865a6f4f0db0d051 (diff) | |
| download | rust-484da378452ed123919ee6d4d5a7e4e98c5d4060.tar.gz rust-484da378452ed123919ee6d4d5a7e4e98c5d4060.zip | |
rename HashesMap to IncrementalHashesMap
| -rw-r--r-- | src/librustc_driver/driver.rs | 30 | ||||
| -rw-r--r-- | src/librustc_incremental/calculate_svh/mod.rs | 7 | ||||
| -rw-r--r-- | src/librustc_incremental/lib.rs | 4 | ||||
| -rw-r--r-- | src/librustc_incremental/persist/hash.rs | 12 | ||||
| -rw-r--r-- | src/librustc_incremental/persist/load.rs | 21 | ||||
| -rw-r--r-- | src/librustc_incremental/persist/save.rs | 7 | ||||
| -rw-r--r-- | src/librustc_trans/back/link.rs | 6 | ||||
| -rw-r--r-- | src/librustc_trans/base.rs | 6 |
8 files changed, 50 insertions, 43 deletions
diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 825a84d075b..b99a3b4ba2e 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -26,7 +26,7 @@ use rustc::util::common::time; use rustc::util::nodemap::NodeSet; use rustc_back::sha2::{Sha256, Digest}; use rustc_borrowck as borrowck; -use rustc_incremental::{self, HashesMap}; +use rustc_incremental::{self, IncrementalHashesMap}; use rustc_resolve::{MakeGlobMap, Resolver}; use rustc_metadata::macro_import; use rustc_metadata::creader::read_local_crates; @@ -172,7 +172,7 @@ pub fn compile_input(sess: &Session, resolutions, &arenas, &crate_name, - |tcx, mir_map, analysis, hashes_map, result| { + |tcx, mir_map, analysis, incremental_hashes_map, result| { { // Eventually, we will want to track plugins. let _ignore = tcx.dep_graph.in_ignore(); @@ -203,7 +203,7 @@ pub fn compile_input(sess: &Session, let trans = phase_4_translate_to_llvm(tcx, mir_map.unwrap(), analysis, - &hashes_map); + &incremental_hashes_map); if log_enabled!(::log::INFO) { println!("Post-trans"); @@ -798,7 +798,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session, where F: for<'a> FnOnce(TyCtxt<'a, 'tcx, 'tcx>, Option<MirMap<'tcx>>, ty::CrateAnalysis, - HashesMap, + IncrementalHashesMap, CompileResult) -> R { macro_rules! try_with_f { @@ -862,16 +862,16 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session, index, name, |tcx| { - let hashes_map = + let incremental_hashes_map = time(time_passes, - "compute_hashes_map", - || rustc_incremental::compute_hashes_map(tcx)); + "compute_incremental_hashes_map", + || rustc_incremental::compute_incremental_hashes_map(tcx)); time(time_passes, "load_dep_graph", - || rustc_incremental::load_dep_graph(tcx, &hashes_map)); + || rustc_incremental::load_dep_graph(tcx, &incremental_hashes_map)); // passes are timed inside typeck - try_with_f!(typeck::check_crate(tcx), (tcx, None, analysis, hashes_map)); + try_with_f!(typeck::check_crate(tcx), (tcx, None, analysis, incremental_hashes_map)); time(time_passes, "const checking", @@ -941,7 +941,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session, // lint warnings and so on -- kindck used to do this abort, but // kindck is gone now). -nmatsakis if sess.err_count() > 0 { - return Ok(f(tcx, Some(mir_map), analysis, hashes_map, Err(sess.err_count()))); + return Ok(f(tcx, Some(mir_map), analysis, incremental_hashes_map, Err(sess.err_count()))); } analysis.reachable = @@ -969,10 +969,10 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session, // The above three passes generate errors w/o aborting if sess.err_count() > 0 { - return Ok(f(tcx, Some(mir_map), analysis, hashes_map, Err(sess.err_count()))); + return Ok(f(tcx, Some(mir_map), analysis, incremental_hashes_map, Err(sess.err_count()))); } - Ok(f(tcx, Some(mir_map), analysis, hashes_map, Ok(()))) + Ok(f(tcx, Some(mir_map), analysis, incremental_hashes_map, Ok(()))) }) } @@ -980,7 +980,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session, pub fn phase_4_translate_to_llvm<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mut mir_map: MirMap<'tcx>, analysis: ty::CrateAnalysis, - hashes_map: &HashesMap) + incremental_hashes_map: &IncrementalHashesMap) -> trans::CrateTranslation { let time_passes = tcx.sess.time_passes(); @@ -1014,7 +1014,7 @@ pub fn phase_4_translate_to_llvm<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let translation = time(time_passes, "translation", - move || trans::trans_crate(tcx, &mir_map, analysis, &hashes_map)); + move || trans::trans_crate(tcx, &mir_map, analysis, &incremental_hashes_map)); time(time_passes, "assert dep graph", @@ -1022,7 +1022,7 @@ pub fn phase_4_translate_to_llvm<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, time(time_passes, "serialize dep graph", - move || rustc_incremental::save_dep_graph(tcx, &hashes_map)); + move || rustc_incremental::save_dep_graph(tcx, &incremental_hashes_map)); translation } diff --git a/src/librustc_incremental/calculate_svh/mod.rs b/src/librustc_incremental/calculate_svh/mod.rs index 7b1b0ce4cf1..d41d718be63 100644 --- a/src/librustc_incremental/calculate_svh/mod.rs +++ b/src/librustc_incremental/calculate_svh/mod.rs @@ -41,9 +41,10 @@ use self::svh_visitor::StrictVersionHashVisitor; mod svh_visitor; -pub type HashesMap = FnvHashMap<DepNode<DefId>, u64>; +pub type IncrementalHashesMap = FnvHashMap<DepNode<DefId>, u64>; -pub fn compute_hashes_map<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> HashesMap { +pub fn compute_incremental_hashes_map<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) + -> IncrementalHashesMap { let _ignore = tcx.dep_graph.in_ignore(); let krate = tcx.map.krate(); 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 struct HashItemsVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, - hashes: HashesMap, + hashes: IncrementalHashesMap, } impl<'a, 'tcx> HashItemsVisitor<'a, 'tcx> { diff --git a/src/librustc_incremental/lib.rs b/src/librustc_incremental/lib.rs index b9c56c45386..d31d97b22cf 100644 --- a/src/librustc_incremental/lib.rs +++ b/src/librustc_incremental/lib.rs @@ -38,8 +38,8 @@ mod calculate_svh; mod persist; pub use assert_dep_graph::assert_dep_graph; -pub use calculate_svh::compute_hashes_map; -pub use calculate_svh::HashesMap; +pub use calculate_svh::compute_incremental_hashes_map; +pub use calculate_svh::IncrementalHashesMap; pub use persist::load_dep_graph; pub use persist::save_dep_graph; pub use persist::save_trans_partition; diff --git a/src/librustc_incremental/persist/hash.rs b/src/librustc_incremental/persist/hash.rs index 49ad6c36804..12dacf273b9 100644 --- a/src/librustc_incremental/persist/hash.rs +++ b/src/librustc_incremental/persist/hash.rs @@ -20,22 +20,24 @@ use std::io::{ErrorKind, Read}; use std::fs::File; use syntax::ast; -use HashesMap; +use IncrementalHashesMap; use super::data::*; use super::util::*; pub struct HashContext<'a, 'tcx: 'a> { pub tcx: TyCtxt<'a, 'tcx, 'tcx>, - hashes_map: &'a HashesMap, + incremental_hashes_map: &'a IncrementalHashesMap, item_metadata_hashes: FnvHashMap<DefId, u64>, crate_hashes: FnvHashMap<ast::CrateNum, Svh>, } impl<'a, 'tcx> HashContext<'a, 'tcx> { - pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, hashes_map: &'a HashesMap) -> Self { + pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, + incremental_hashes_map: &'a IncrementalHashesMap) + -> Self { HashContext { tcx: tcx, - hashes_map: hashes_map, + incremental_hashes_map: incremental_hashes_map, item_metadata_hashes: FnvHashMap(), crate_hashes: FnvHashMap(), } @@ -63,7 +65,7 @@ impl<'a, 'tcx> HashContext<'a, 'tcx> { def_id, self.tcx.item_path_str(def_id)); - Some((def_id, self.hashes_map[dep_node])) + Some((def_id, self.incremental_hashes_map[dep_node])) } // MetaData from other crates is an *input* to us. diff --git a/src/librustc_incremental/persist/load.rs b/src/librustc_incremental/persist/load.rs index a2ba566f75e..7449205c536 100644 --- a/src/librustc_incremental/persist/load.rs +++ b/src/librustc_incremental/persist/load.rs @@ -22,7 +22,7 @@ use std::io::Read; use std::fs::{self, File}; use std::path::{Path}; -use HashesMap; +use IncrementalHashesMap; use super::data::*; use super::directory::*; use super::dirty_clean; @@ -40,17 +40,17 @@ type CleanEdges = Vec<(DepNode<DefId>, DepNode<DefId>)>; /// actually it doesn't matter all that much.) See `README.md` for /// more general overview. pub fn load_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - hashes: &HashesMap) { + incremental_hashes_map: &IncrementalHashesMap) { if tcx.sess.opts.incremental.is_none() { return; } let _ignore = tcx.dep_graph.in_ignore(); - load_dep_graph_if_exists(tcx, hashes); + load_dep_graph_if_exists(tcx, incremental_hashes_map); } fn load_dep_graph_if_exists<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - hashes: &HashesMap) { + incremental_hashes_map: &IncrementalHashesMap) { let dep_graph_path = dep_graph_path(tcx).unwrap(); let dep_graph_data = match load_data(tcx.sess, &dep_graph_path) { Some(p) => p, @@ -63,7 +63,7 @@ fn load_dep_graph_if_exists<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, None => return // no file }; - match decode_dep_graph(tcx, hashes, &dep_graph_data, &work_products_data) { + match decode_dep_graph(tcx, incremental_hashes_map, &dep_graph_data, &work_products_data) { Ok(dirty_nodes) => dirty_nodes, Err(err) => { tcx.sess.warn( @@ -100,7 +100,7 @@ fn load_data(sess: &Session, path: &Path) -> Option<Vec<u8>> { /// Decode the dep graph and load the edges/nodes that are still clean /// into `tcx.dep_graph`. pub fn decode_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - hashes: &HashesMap, + incremental_hashes_map: &IncrementalHashesMap, dep_graph_data: &[u8], work_products_data: &[u8]) -> Result<(), Error> @@ -137,7 +137,10 @@ pub fn decode_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // reason for this is that this way we can include nodes that have // been removed (which no longer have a `DefId` in the current // compilation). - let dirty_raw_source_nodes = dirty_nodes(tcx, hashes, &serialized_dep_graph.hashes, &retraced); + let dirty_raw_source_nodes = dirty_nodes(tcx, + incremental_hashes_map, + &serialized_dep_graph.hashes, + &retraced); // Create a list of (raw-source-node -> // 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>, /// Computes which of the original set of def-ids are dirty. Stored in /// a bit vector where the index is the DefPathIndex. fn dirty_nodes<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - hashes: &HashesMap, + incremental_hashes_map: &IncrementalHashesMap, serialized_hashes: &[SerializedHash], retraced: &RetracedDefIdDirectory) -> DirtyNodes { - let mut hcx = HashContext::new(tcx, hashes); + let mut hcx = HashContext::new(tcx, incremental_hashes_map); let mut dirty_nodes = FnvHashSet(); for hash in serialized_hashes { diff --git a/src/librustc_incremental/persist/save.rs b/src/librustc_incremental/persist/save.rs index b81afe44f60..74ee876d0bb 100644 --- a/src/librustc_incremental/persist/save.rs +++ b/src/librustc_incremental/persist/save.rs @@ -21,21 +21,22 @@ use std::io::{self, Cursor, Write}; use std::fs::{self, File}; use std::path::PathBuf; -use HashesMap; +use IncrementalHashesMap; use super::data::*; use super::directory::*; use super::hash::*; use super::preds::*; use super::util::*; -pub fn save_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hashes_map: &HashesMap) { +pub fn save_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, + incremental_hashes_map: &IncrementalHashesMap) { debug!("save_dep_graph()"); let _ignore = tcx.dep_graph.in_ignore(); let sess = tcx.sess; if sess.opts.incremental.is_none() { return; } - let mut hcx = HashContext::new(tcx, hashes_map); + let mut hcx = HashContext::new(tcx, incremental_hashes_map); let mut builder = DefIdDirectoryBuilder::new(tcx); let query = tcx.dep_graph.query(); let preds = Predecessors::new(&query, &mut hcx); diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs index d47a5ddb224..9f401b13d6f 100644 --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs @@ -28,7 +28,7 @@ use util::fs::fix_windows_verbatim_for_gcc; use rustc::dep_graph::DepNode; use rustc::hir::svh::Svh; use rustc_back::tempdir::TempDir; -use rustc_incremental::HashesMap; +use rustc_incremental::IncrementalHashesMap; use std::ascii; use std::char; @@ -125,12 +125,12 @@ pub fn find_crate_name(sess: Option<&Session>, } -pub fn build_link_meta(hashes_map: &HashesMap, +pub fn build_link_meta(incremental_hashes_map: &IncrementalHashesMap, name: &str) -> LinkMeta { let r = LinkMeta { crate_name: name.to_owned(), - crate_hash: Svh::new(hashes_map[&DepNode::Krate]), + crate_hash: Svh::new(incremental_hashes_map[&DepNode::Krate]), }; info!("{:?}", r); return r; diff --git a/src/librustc_trans/base.rs b/src/librustc_trans/base.rs index f2d0bbae942..cab353cd262 100644 --- a/src/librustc_trans/base.rs +++ b/src/librustc_trans/base.rs @@ -48,7 +48,7 @@ use rustc::hir::map as hir_map; use rustc::util::common::time; use rustc::mir::mir_map::MirMap; use rustc_data_structures::graph::OUTGOING; -use rustc_incremental::HashesMap; +use rustc_incremental::IncrementalHashesMap; use session::config::{self, NoDebugInfo, FullDebugInfo}; use session::Session; use _match; @@ -2483,7 +2483,7 @@ pub fn filter_reachable_ids(tcx: TyCtxt, reachable: NodeSet) -> NodeSet { pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir_map: &MirMap<'tcx>, analysis: ty::CrateAnalysis, - hashes_map: &HashesMap) + incremental_hashes_map: &IncrementalHashesMap) -> CrateTranslation { let _task = tcx.dep_graph.in_task(DepNode::TransCrate); @@ -2508,7 +2508,7 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, tcx.sess.opts.debug_assertions }; - let link_meta = link::build_link_meta(hashes_map, name); + let link_meta = link::build_link_meta(incremental_hashes_map, name); let shared_ccx = SharedCrateContext::new(tcx, &mir_map, |
