ThinLTO: Don't keep files open after mmaping them (because it's not needed).
This commit is contained in:
parent
3f13b27c2b
commit
fc47a92336
2 changed files with 4 additions and 4 deletions
|
@ -29,7 +29,7 @@ use {ModuleCodegen, ModuleLlvm, ModuleKind};
|
||||||
use libc;
|
use libc;
|
||||||
|
|
||||||
use std::ffi::{CStr, CString};
|
use std::ffi::{CStr, CString};
|
||||||
use std::fs::{self, File};
|
use std::fs;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
@ -619,7 +619,7 @@ fn run_pass_manager(cgcx: &CodegenContext,
|
||||||
pub enum SerializedModule {
|
pub enum SerializedModule {
|
||||||
Local(ModuleBuffer),
|
Local(ModuleBuffer),
|
||||||
FromRlib(Vec<u8>),
|
FromRlib(Vec<u8>),
|
||||||
FromUncompressedFile(memmap::Mmap, File),
|
FromUncompressedFile(memmap::Mmap),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SerializedModule {
|
impl SerializedModule {
|
||||||
|
@ -627,7 +627,7 @@ impl SerializedModule {
|
||||||
match *self {
|
match *self {
|
||||||
SerializedModule::Local(ref m) => m.data(),
|
SerializedModule::Local(ref m) => m.data(),
|
||||||
SerializedModule::FromRlib(ref m) => m,
|
SerializedModule::FromRlib(ref m) => m,
|
||||||
SerializedModule::FromUncompressedFile(ref m, _) => m,
|
SerializedModule::FromUncompressedFile(ref m) => m,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2485,7 +2485,7 @@ pub(crate) fn submit_pre_lto_module_to_llvm(tcx: TyCtxt,
|
||||||
|
|
||||||
// Schedule the module to be loaded
|
// Schedule the module to be loaded
|
||||||
drop(tcx.tx_to_llvm_workers.lock().send(Box::new(Message::AddImportOnlyModule {
|
drop(tcx.tx_to_llvm_workers.lock().send(Box::new(Message::AddImportOnlyModule {
|
||||||
module_data: SerializedModule::FromUncompressedFile(mmap, file),
|
module_data: SerializedModule::FromUncompressedFile(mmap),
|
||||||
work_product: module.source,
|
work_product: module.source,
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue