diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-09-25 13:14:43 -0400 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-09-25 16:57:27 -0400 |
| commit | b8a040fc5f5edc41af0ccb070239898c0c5d5484 (patch) | |
| tree | bb4b0f1834eaf3ff7eba99f83d8863524cdc4873 /src/librustc_codegen_llvm | |
| parent | 6c2c29c43206d6e2f1091fa278d2792ea10e3659 (diff) | |
| download | rust-b8a040fc5f5edc41af0ccb070239898c0c5d5484.tar.gz rust-b8a040fc5f5edc41af0ccb070239898c0c5d5484.zip | |
Remove tx_to_llvm_workers from TyCtxt
This can be kept within the codegen backend crates entirely
Diffstat (limited to 'src/librustc_codegen_llvm')
| -rw-r--r-- | src/librustc_codegen_llvm/base.rs | 8 | ||||
| -rw-r--r-- | src/librustc_codegen_llvm/lib.rs | 13 |
2 files changed, 14 insertions, 7 deletions
diff --git a/src/librustc_codegen_llvm/base.rs b/src/librustc_codegen_llvm/base.rs index 21c19e167cf..5758cdbebf7 100644 --- a/src/librustc_codegen_llvm/base.rs +++ b/src/librustc_codegen_llvm/base.rs @@ -103,7 +103,11 @@ pub fn iter_globals(llmod: &'ll llvm::Module) -> ValueIter<'ll> { } } -pub fn compile_codegen_unit(tcx: TyCtxt<'tcx>, cgu_name: InternedString) { +pub fn compile_codegen_unit( + tcx: TyCtxt<'tcx>, + cgu_name: InternedString, + tx_to_llvm_workers: &std::sync::mpsc::Sender<Box<dyn std::any::Any + Send>>, +) { let start_time = Instant::now(); let dep_node = tcx.codegen_unit(cgu_name).codegen_dep_node(tcx); @@ -121,7 +125,7 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'tcx>, cgu_name: InternedString) { let cost = time_to_codegen.as_secs() * 1_000_000_000 + time_to_codegen.subsec_nanos() as u64; - submit_codegened_module_to_llvm(&LlvmCodegenBackend(()), tcx, module, cost); + submit_codegened_module_to_llvm(&LlvmCodegenBackend(()), tx_to_llvm_workers, module, cost); fn module_codegen( tcx: TyCtxt<'_>, diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index 34e39af3c39..2a63011c2f5 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -52,7 +52,7 @@ use syntax::ext::allocator::AllocatorKind; use syntax_pos::symbol::InternedString; pub use llvm_util::target_features; use std::any::Any; -use std::sync::{mpsc, Arc}; +use std::sync::Arc; use std::ffi::CStr; use rustc::dep_graph::DepGraph; @@ -122,8 +122,12 @@ impl ExtraBackendMethods for LlvmCodegenBackend { ) { unsafe { allocator::codegen(tcx, mods, kind) } } - fn compile_codegen_unit(&self, tcx: TyCtxt<'_>, cgu_name: InternedString) { - base::compile_codegen_unit(tcx, cgu_name); + fn compile_codegen_unit( + &self, tcx: TyCtxt<'_>, + cgu_name: InternedString, + tx: &std::sync::mpsc::Sender<Box<dyn Any + Send>>, + ) { + base::compile_codegen_unit(tcx, cgu_name, tx); } fn target_machine_factory( &self, @@ -284,10 +288,9 @@ impl CodegenBackend for LlvmCodegenBackend { tcx: TyCtxt<'tcx>, metadata: EncodedMetadata, need_metadata_module: bool, - rx: mpsc::Receiver<Box<dyn Any + Send>>, ) -> Box<dyn Any> { box rustc_codegen_ssa::base::codegen_crate( - LlvmCodegenBackend(()), tcx, metadata, need_metadata_module, rx) + LlvmCodegenBackend(()), tcx, metadata, need_metadata_module) } fn join_codegen_and_link( |
