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;
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();
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");
where F: for<'a> FnOnce(TyCtxt<'a, 'tcx, 'tcx>,
Option<MirMap<'tcx>>,
ty::CrateAnalysis,
- HashesMap,
+ IncrementalHashesMap,
CompileResult) -> R
{
macro_rules! try_with_f {
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",
// 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 =
// 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(())))
})
}
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();
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",
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
}
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() };
struct HashItemsVisitor<'a, 'tcx: 'a> {
tcx: TyCtxt<'a, 'tcx, 'tcx>,
- hashes: HashesMap,
+ hashes: IncrementalHashesMap,
}
impl<'a, 'tcx> HashItemsVisitor<'a, 'tcx> {
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;
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(),
}
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.
use std::fs::{self, File};
use std::path::{Path};
-use HashesMap;
+use IncrementalHashesMap;
use super::data::*;
use super::directory::*;
use super::dirty_clean;
/// 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,
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(
/// 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>
// 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
/// 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 {
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);
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;
}
-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;
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;
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);
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,