diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-09-26 17:55:13 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-26 17:55:13 +0200 |
| commit | 01303936f37ef494bfe11012645ff7ca37606fdf (patch) | |
| tree | a12dba5010e0fb65b0406d176e5caa44ed06a4cb /src/librustc_codegen_llvm | |
| parent | 3b5fbb6a3616cc530edba496bbca3ddb02e19762 (diff) | |
| parent | b8a040fc5f5edc41af0ccb070239898c0c5d5484 (diff) | |
Rollup merge of #64772 - Mark-Simulacrum:no-tyctxt-tx, r=eddyb
Remove tx_to_llvm_workers from TyCtxt This can be kept within the codegen backend crates entirely -- there's no reason for us to create it outside and attempt to hold it in the (global) context. Changes here aren't really too easily reviewable I suspect -- not sure if they can be cleaned up by splitting into more commits though, it's just hard to reason about `Box<Any>` in general. If there are thoughts though I'd be happy to hear them. The primary goal of this PR is to get rid of the field on `rustc_interface::Queries`.
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( |
