Save/restore more items in cache with incremental compilation
This commit is contained in:
@@ -528,12 +528,20 @@ fn copy_all_cgu_workproducts_to_incr_comp_cache_dir(
|
||||
for module in compiled_modules.modules.iter().filter(|m| m.kind == ModuleKind::Regular) {
|
||||
let mut files = Vec::new();
|
||||
if let Some(object_file_path) = &module.object {
|
||||
files.push(("o", object_file_path.as_path()));
|
||||
files.push((OutputType::Object.extension(), object_file_path.as_path()));
|
||||
}
|
||||
if let Some(dwarf_object_file_path) = &module.dwarf_object {
|
||||
files.push(("dwo", dwarf_object_file_path.as_path()));
|
||||
}
|
||||
|
||||
if let Some(path) = &module.assembly {
|
||||
files.push((OutputType::Assembly.extension(), path.as_path()));
|
||||
}
|
||||
if let Some(path) = &module.llvm_ir {
|
||||
files.push((OutputType::LlvmAssembly.extension(), path.as_path()));
|
||||
}
|
||||
if let Some(path) = &module.bytecode {
|
||||
files.push((OutputType::Bitcode.extension(), path.as_path()));
|
||||
}
|
||||
if let Some((id, product)) =
|
||||
copy_cgu_workproduct_to_incr_comp_cache_dir(sess, &module.name, files.as_slice())
|
||||
{
|
||||
@@ -937,12 +945,28 @@ fn execute_copy_from_cache_work_item<B: ExtraBackendMethods>(
|
||||
load_from_incr_comp_dir(dwarf_obj_out, saved_dwarf_object_file)
|
||||
});
|
||||
|
||||
let load_from_incr_cache = |perform, output_type: OutputType| {
|
||||
if perform {
|
||||
let saved_file = module.source.saved_files.get(output_type.extension())?;
|
||||
let output_path = cgcx.output_filenames.temp_path(output_type, Some(&module.name));
|
||||
load_from_incr_comp_dir(output_path, &saved_file)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
};
|
||||
|
||||
let assembly = load_from_incr_cache(module_config.emit_asm, OutputType::Assembly);
|
||||
let llvm_ir = load_from_incr_cache(module_config.emit_ir, OutputType::LlvmAssembly);
|
||||
let bytecode = load_from_incr_cache(module_config.emit_bc, OutputType::Bitcode);
|
||||
|
||||
WorkItemResult::Finished(CompiledModule {
|
||||
name: module.name,
|
||||
kind: ModuleKind::Regular,
|
||||
object,
|
||||
dwarf_object,
|
||||
bytecode: None,
|
||||
bytecode,
|
||||
assembly,
|
||||
llvm_ir,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user