Make LLVM worker channel thread-safe
This commit is contained in:
parent
3773f4dc3f
commit
1e3f638836
2 changed files with 5 additions and 5 deletions
|
@ -909,7 +909,7 @@ pub struct GlobalCtxt<'tcx> {
|
|||
/// This is intended to only get used during the trans phase of the compiler
|
||||
/// when satisfying the query for a particular codegen unit. Internally in
|
||||
/// the query it'll send data along this channel to get processed later.
|
||||
pub tx_to_llvm_workers: mpsc::Sender<Box<dyn Any + Send>>,
|
||||
pub tx_to_llvm_workers: Lock<mpsc::Sender<Box<dyn Any + Send>>>,
|
||||
|
||||
output_filenames: Arc<OutputFilenames>,
|
||||
}
|
||||
|
@ -1283,7 +1283,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||
stability_interner: Lock::new(FxHashSet()),
|
||||
interpret_interner: Default::default(),
|
||||
all_traits: RefCell::new(None),
|
||||
tx_to_llvm_workers: tx,
|
||||
tx_to_llvm_workers: Lock::new(tx),
|
||||
output_filenames: Arc::new(output_filenames.clone()),
|
||||
}, f)
|
||||
}
|
||||
|
|
|
@ -1035,7 +1035,7 @@ pub fn start_async_translation(tcx: TyCtxt,
|
|||
crate_info,
|
||||
|
||||
time_graph,
|
||||
coordinator_send: tcx.tx_to_llvm_workers.clone(),
|
||||
coordinator_send: tcx.tx_to_llvm_workers.lock().clone(),
|
||||
trans_worker_receive,
|
||||
shared_emitter_main,
|
||||
future: coordinator_thread,
|
||||
|
@ -1428,7 +1428,7 @@ fn start_executing_work(tcx: TyCtxt,
|
|||
metadata_config: Arc<ModuleConfig>,
|
||||
allocator_config: Arc<ModuleConfig>)
|
||||
-> thread::JoinHandle<Result<CompiledModules, ()>> {
|
||||
let coordinator_send = tcx.tx_to_llvm_workers.clone();
|
||||
let coordinator_send = tcx.tx_to_llvm_workers.lock().clone();
|
||||
let sess = tcx.sess;
|
||||
|
||||
// Compute the set of symbols we need to retain when doing LTO (if we need to)
|
||||
|
@ -2340,7 +2340,7 @@ pub(crate) fn submit_translated_module_to_llvm(tcx: TyCtxt,
|
|||
mtrans: ModuleTranslation,
|
||||
cost: u64) {
|
||||
let llvm_work_item = WorkItem::Optimize(mtrans);
|
||||
drop(tcx.tx_to_llvm_workers.send(Box::new(Message::TranslationDone {
|
||||
drop(tcx.tx_to_llvm_workers.lock().send(Box::new(Message::TranslationDone {
|
||||
llvm_work_item,
|
||||
cost,
|
||||
})));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue