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
|
/// 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
|
/// when satisfying the query for a particular codegen unit. Internally in
|
||||||
/// the query it'll send data along this channel to get processed later.
|
/// 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>,
|
output_filenames: Arc<OutputFilenames>,
|
||||||
}
|
}
|
||||||
|
@ -1283,7 +1283,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||||
stability_interner: Lock::new(FxHashSet()),
|
stability_interner: Lock::new(FxHashSet()),
|
||||||
interpret_interner: Default::default(),
|
interpret_interner: Default::default(),
|
||||||
all_traits: RefCell::new(None),
|
all_traits: RefCell::new(None),
|
||||||
tx_to_llvm_workers: tx,
|
tx_to_llvm_workers: Lock::new(tx),
|
||||||
output_filenames: Arc::new(output_filenames.clone()),
|
output_filenames: Arc::new(output_filenames.clone()),
|
||||||
}, f)
|
}, f)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1035,7 +1035,7 @@ pub fn start_async_translation(tcx: TyCtxt,
|
||||||
crate_info,
|
crate_info,
|
||||||
|
|
||||||
time_graph,
|
time_graph,
|
||||||
coordinator_send: tcx.tx_to_llvm_workers.clone(),
|
coordinator_send: tcx.tx_to_llvm_workers.lock().clone(),
|
||||||
trans_worker_receive,
|
trans_worker_receive,
|
||||||
shared_emitter_main,
|
shared_emitter_main,
|
||||||
future: coordinator_thread,
|
future: coordinator_thread,
|
||||||
|
@ -1428,7 +1428,7 @@ fn start_executing_work(tcx: TyCtxt,
|
||||||
metadata_config: Arc<ModuleConfig>,
|
metadata_config: Arc<ModuleConfig>,
|
||||||
allocator_config: Arc<ModuleConfig>)
|
allocator_config: Arc<ModuleConfig>)
|
||||||
-> thread::JoinHandle<Result<CompiledModules, ()>> {
|
-> 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;
|
let sess = tcx.sess;
|
||||||
|
|
||||||
// Compute the set of symbols we need to retain when doing LTO (if we need to)
|
// 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,
|
mtrans: ModuleTranslation,
|
||||||
cost: u64) {
|
cost: u64) {
|
||||||
let llvm_work_item = WorkItem::Optimize(mtrans);
|
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,
|
llvm_work_item,
|
||||||
cost,
|
cost,
|
||||||
})));
|
})));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue