Update naming in line with PR comments

This commit is contained in:
Isaac Whitfield 2018-05-09 08:16:08 -07:00
parent 5c83422a5b
commit 0a4fbe326a
6 changed files with 23 additions and 20 deletions

View File

@ -36,9 +36,9 @@ pub use persist::dep_graph_tcx_init;
pub use persist::load_dep_graph;
pub use persist::load_query_result_cache;
pub use persist::LoadResult;
pub use persist::create_trans_partition;
pub use persist::copy_cgu_workproducts_to_incr_comp_cache_dir;
pub use persist::save_dep_graph;
pub use persist::save_work_products;
pub use persist::save_work_product_index;
pub use persist::in_incr_comp_dir;
pub use persist::prepare_session_directory;
pub use persist::finalize_session_directory;

View File

@ -29,6 +29,6 @@ pub use self::load::load_dep_graph;
pub use self::load::load_query_result_cache;
pub use self::load::LoadResult;
pub use self::save::save_dep_graph;
pub use self::save::save_work_products;
pub use self::work_product::create_trans_partition;
pub use self::save::save_work_product_index;
pub use self::work_product::copy_cgu_workproducts_to_incr_comp_cache_dir;
pub use self::work_product::delete_workproduct_files;

View File

@ -55,17 +55,17 @@ pub fn save_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
})
}
pub fn save_work_products(sess: &Session,
dep_graph: &DepGraph,
new_work_products: FxHashMap<WorkProductId, WorkProduct>) {
pub fn save_work_product_index(sess: &Session,
dep_graph: &DepGraph,
new_work_products: FxHashMap<WorkProductId, WorkProduct>) {
if sess.opts.incremental.is_none() {
return;
}
debug!("save_work_products()");
debug!("save_work_product_index()");
dep_graph.assert_ignored();
let path = work_products_path(sess);
save_in(sess, path, |e| encode_work_products(&new_work_products, e));
save_in(sess, path, |e| encode_work_product_index(&new_work_products, e));
// We also need to clean out old work-products, as not all of them are
// deleted during invalidation. Some object files don't change their
@ -234,8 +234,8 @@ fn encode_dep_graph(tcx: TyCtxt,
Ok(())
}
fn encode_work_products(work_products: &FxHashMap<WorkProductId, WorkProduct>,
encoder: &mut Encoder) -> io::Result<()> {
fn encode_work_product_index(work_products: &FxHashMap<WorkProductId, WorkProduct>,
encoder: &mut Encoder) -> io::Result<()> {
let serialized_products: Vec<_> = work_products
.iter()
.map(|(id, work_product)| {

View File

@ -17,10 +17,11 @@ use rustc::util::fs::link_or_copy;
use std::path::PathBuf;
use std::fs as std_fs;
pub fn create_trans_partition(sess: &Session,
cgu_name: &str,
files: &[(WorkProductFileKind, PathBuf)])
-> Option<(WorkProductId, WorkProduct)> {
pub fn copy_cgu_workproducts_to_incr_comp_cache_dir(
sess: &Session,
cgu_name: &str,
files: &[(WorkProductFileKind, PathBuf)]
) -> Option<(WorkProductId, WorkProduct)> {
debug!("create_trans_partition({:?},{:?})",
cgu_name,
files);

View File

@ -17,7 +17,7 @@ use back::linker::LinkerInfo;
use back::symbol_export::ExportedSymbols;
use base;
use consts;
use rustc_incremental::{create_trans_partition, in_incr_comp_dir};
use rustc_incremental::{copy_cgu_workproducts_to_incr_comp_cache_dir, in_incr_comp_dir};
use rustc::dep_graph::{WorkProduct, WorkProductId, WorkProductFileKind};
use rustc::middle::cstore::{LinkMeta, EncodedMetadata};
use rustc::session::config::{self, OutputFilenames, OutputType, Passes, SomePasses,
@ -1021,7 +1021,7 @@ pub fn start_async_translation(tcx: TyCtxt,
}
}
fn generate_module_artifacts(
fn copy_all_cgu_workproducts_to_incr_comp_cache_dir(
sess: &Session,
compiled_modules: &CompiledModules
) -> FxHashMap<WorkProductId, WorkProduct> {
@ -1044,7 +1044,8 @@ fn generate_module_artifacts(
files.push((WorkProductFileKind::BytecodeCompressed, path.clone()));
}
if let Some((id, product)) = create_trans_partition(sess, &module.name, &files) {
if let Some((id, product)) =
copy_cgu_workproducts_to_incr_comp_cache_dir(sess, &module.name, &files) {
work_products.insert(id, product);
}
}
@ -2265,7 +2266,8 @@ impl OngoingCrateTranslation {
time_graph.dump(&format!("{}-timings", self.crate_name));
}
let work_products = generate_module_artifacts(sess, &compiled_modules);
let work_products = copy_all_cgu_workproducts_to_incr_comp_cache_dir(sess,
&compiled_modules);
produce_final_output_artifacts(sess,
&compiled_modules,

View File

@ -221,7 +221,7 @@ impl TransCrate for LlvmTransCrate {
time(sess,
"serialize work products",
move || rustc_incremental::save_work_products(sess, &dep_graph, work_products));
move || rustc_incremental::save_work_product_index(sess, &dep_graph, work_products));
sess.compile_status()?;