parent
a1bf96f630
commit
1e5cea09d5
@ -215,26 +215,32 @@ fn run_aot(
|
|||||||
rustc_incremental::finalize_session_directory(tcx.sess, tcx.crate_hash(LOCAL_CRATE));
|
rustc_incremental::finalize_session_directory(tcx.sess, tcx.crate_hash(LOCAL_CRATE));
|
||||||
|
|
||||||
let metadata_module = if need_metadata_module {
|
let metadata_module = if need_metadata_module {
|
||||||
use rustc::mir::mono::CodegenUnitNameBuilder;
|
tcx.sess.profiler(|p| p.start_activity("codegen crate metadata"));
|
||||||
|
let (metadata_cgu_name, tmp_file) = rustc::util::common::time(tcx.sess, "write compressed metadata", || {
|
||||||
|
use rustc::mir::mono::CodegenUnitNameBuilder;
|
||||||
|
|
||||||
let cgu_name_builder = &mut CodegenUnitNameBuilder::new(tcx);
|
let cgu_name_builder = &mut CodegenUnitNameBuilder::new(tcx);
|
||||||
let metadata_cgu_name = cgu_name_builder
|
let metadata_cgu_name = cgu_name_builder
|
||||||
.build_cgu_name(LOCAL_CRATE, &["crate"], Some("metadata"))
|
.build_cgu_name(LOCAL_CRATE, &["crate"], Some("metadata"))
|
||||||
.as_str()
|
.as_str()
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
let mut metadata_artifact = faerie::Artifact::new(
|
let mut metadata_artifact = faerie::Artifact::new(
|
||||||
crate::build_isa(tcx.sess, true).triple().clone(),
|
crate::build_isa(tcx.sess, true).triple().clone(),
|
||||||
metadata_cgu_name.clone(),
|
metadata_cgu_name.clone(),
|
||||||
);
|
);
|
||||||
crate::metadata::write_metadata(tcx, &mut metadata_artifact);
|
crate::metadata::write_metadata(tcx, &mut metadata_artifact);
|
||||||
|
|
||||||
let tmp_file = tcx
|
let tmp_file = tcx
|
||||||
.output_filenames(LOCAL_CRATE)
|
.output_filenames(LOCAL_CRATE)
|
||||||
.temp_path(OutputType::Metadata, Some(&metadata_cgu_name));
|
.temp_path(OutputType::Metadata, Some(&metadata_cgu_name));
|
||||||
|
|
||||||
let obj = metadata_artifact.emit().unwrap();
|
let obj = metadata_artifact.emit().unwrap();
|
||||||
std::fs::write(&tmp_file, obj).unwrap();
|
std::fs::write(&tmp_file, obj).unwrap();
|
||||||
|
|
||||||
|
(metadata_cgu_name, tmp_file)
|
||||||
|
});
|
||||||
|
tcx.sess.profiler(|p| p.end_activity("codegen crate metadata"));
|
||||||
|
|
||||||
Some(CompiledModule {
|
Some(CompiledModule {
|
||||||
name: metadata_cgu_name,
|
name: metadata_cgu_name,
|
||||||
|
Loading…
Reference in New Issue
Block a user