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`.
This commit is contained in:
Mazdak Farrokhzad 2019-09-26 17:55:13 +02:00 committed by GitHub
commit 01303936f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 42 additions and 70 deletions

View file

@ -64,7 +64,6 @@ use std::fmt;
use std::mem;
use std::ops::{Deref, Bound};
use std::iter;
use std::sync::mpsc;
use std::sync::Arc;
use rustc_target::spec::abi;
use rustc_macros::HashStable;
@ -1064,14 +1063,6 @@ pub struct GlobalCtxt<'tcx> {
layout_interner: ShardedHashMap<&'tcx LayoutDetails, ()>,
/// A general purpose channel to throw data out the back towards LLVM worker
/// threads.
///
/// This is intended to only get used during the codegen 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: Lock<mpsc::Sender<Box<dyn Any + Send>>>,
output_filenames: Arc<OutputFilenames>,
}
@ -1184,7 +1175,6 @@ impl<'tcx> TyCtxt<'tcx> {
hir: hir_map::Map<'tcx>,
on_disk_query_result_cache: query::OnDiskCache<'tcx>,
crate_name: &str,
tx: mpsc::Sender<Box<dyn Any + Send>>,
output_filenames: &OutputFilenames,
) -> GlobalCtxt<'tcx> {
let data_layout = TargetDataLayout::parse(&s.target.target).unwrap_or_else(|err| {
@ -1291,7 +1281,6 @@ impl<'tcx> TyCtxt<'tcx> {
stability_interner: Default::default(),
allocation_interner: Default::default(),
alloc_map: Lock::new(interpret::AllocMap::new()),
tx_to_llvm_workers: Lock::new(tx),
output_filenames: Arc::new(output_filenames.clone()),
}
}