Skip to content

Rollup of 5 pull requests #64816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Sep 27, 2019
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b8a040f
Remove tx_to_llvm_workers from TyCtxt
Mark-Simulacrum Sep 25, 2019
80db06d
Fix ExitStatus on Fuchsia
tmandry Sep 25, 2019
5418e15
Fix issue #64732
onehr Sep 25, 2019
a048447
Add test case for issue #64732
onehr Sep 26, 2019
ece6f83
Refuse downgrading NLL errors on Rust 2015.
Centril Sep 6, 2019
aff9c83
rustc_mir: remove dead code for downgrading errors.
Centril Sep 6, 2019
6ec9b3a
Adjust & --bless tests due to no longer downgrading NLL errors on 2015.
Centril Sep 6, 2019
487f8ab
add test for #53432.
Centril Sep 6, 2019
2fb0bba
remove feature(nll) from #45157 test.
Centril Sep 6, 2019
1256613
remove feature(nll) from #31567 test.
Centril Sep 6, 2019
b638aa1
remove feature(nll) from #27868 test.
Centril Sep 6, 2019
2b80ed9
remove feature(nll) in more cases.
Centril Sep 6, 2019
dfdd4d7
rm "src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.s…
Centril Sep 25, 2019
ce8c5d2
issue-#45696-scribble...: remove outdated comment.
Centril Sep 25, 2019
f8af766
cargotest: bump webrender
Centril Sep 26, 2019
9a2cc54
cargotest: bump iron
Centril Sep 26, 2019
8220252
Add test for E0543
GuillaumeGomez Sep 26, 2019
5a0e461
issue-#45696: remove ignore-compare-mode-nll
Centril Sep 26, 2019
3b5fbb6
Rollup merge of #64221 - Centril:nll-no-migrate-2015, r=matthewjasper
Centril Sep 26, 2019
0130393
Rollup merge of #64772 - Mark-Simulacrum:no-tyctxt-tx, r=eddyb
Centril Sep 26, 2019
95ea4a1
Rollup merge of #64783 - onehr:onehrxn, r=varkor
Centril Sep 26, 2019
0717483
Rollup merge of #64787 - tmandry:fuchsia-exitstatus, r=cramertj
Centril Sep 26, 2019
02a8505
Rollup merge of #64812 - GuillaumeGomez:add-test-for-e0543, r=Centril
Centril Sep 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
@@ -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()),
}
}
8 changes: 6 additions & 2 deletions src/librustc_codegen_llvm/base.rs
Original file line number Diff line number Diff line change
@@ -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<'_>,
13 changes: 8 additions & 5 deletions src/librustc_codegen_llvm/lib.rs
Original file line number Diff line number Diff line change
@@ -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(
23 changes: 13 additions & 10 deletions src/librustc_codegen_ssa/back/write.rs
Original file line number Diff line number Diff line change
@@ -376,9 +376,9 @@ pub fn start_async_codegen<B: ExtraBackendMethods>(
backend: B,
tcx: TyCtxt<'_>,
metadata: EncodedMetadata,
coordinator_receive: Receiver<Box<dyn Any + Send>>,
total_cgus: usize,
) -> OngoingCodegen<B> {
let (coordinator_send, coordinator_receive) = channel();
let sess = tcx.sess;
let crate_name = tcx.crate_name(LOCAL_CRATE);
let crate_hash = tcx.crate_hash(LOCAL_CRATE);
@@ -500,7 +500,8 @@ pub fn start_async_codegen<B: ExtraBackendMethods>(
sess.jobserver.clone(),
Arc::new(modules_config),
Arc::new(metadata_config),
Arc::new(allocator_config));
Arc::new(allocator_config),
coordinator_send.clone());

OngoingCodegen {
backend,
@@ -511,7 +512,7 @@ pub fn start_async_codegen<B: ExtraBackendMethods>(
linker_info,
crate_info,

coordinator_send: tcx.tx_to_llvm_workers.lock().clone(),
coordinator_send,
codegen_worker_receive,
shared_emitter_main,
future: coordinator_thread,
@@ -1005,8 +1006,9 @@ fn start_executing_work<B: ExtraBackendMethods>(
modules_config: Arc<ModuleConfig>,
metadata_config: Arc<ModuleConfig>,
allocator_config: Arc<ModuleConfig>,
tx_to_llvm_workers: Sender<Box<dyn Any + Send>>,
) -> thread::JoinHandle<Result<CompiledModules, ()>> {
let coordinator_send = tcx.tx_to_llvm_workers.lock().clone();
let coordinator_send = tx_to_llvm_workers;
let sess = tcx.sess;

// Compute the set of symbols we need to retain when doing LTO (if we need to)
@@ -1857,7 +1859,7 @@ impl<B: ExtraBackendMethods> OngoingCodegen<B> {

// These are generally cheap and won't throw off scheduling.
let cost = 0;
submit_codegened_module_to_llvm(&self.backend, tcx, module, cost);
submit_codegened_module_to_llvm(&self.backend, &self.coordinator_send, module, cost);
}

pub fn codegen_finished(&self, tcx: TyCtxt<'_>) {
@@ -1899,24 +1901,24 @@ impl<B: ExtraBackendMethods> OngoingCodegen<B> {

pub fn submit_codegened_module_to_llvm<B: ExtraBackendMethods>(
_backend: &B,
tcx: TyCtxt<'_>,
tx_to_llvm_workers: &Sender<Box<dyn Any + Send>>,
module: ModuleCodegen<B::Module>,
cost: u64,
) {
let llvm_work_item = WorkItem::Optimize(module);
drop(tcx.tx_to_llvm_workers.lock().send(Box::new(Message::CodegenDone::<B> {
drop(tx_to_llvm_workers.send(Box::new(Message::CodegenDone::<B> {
llvm_work_item,
cost,
})));
}

pub fn submit_post_lto_module_to_llvm<B: ExtraBackendMethods>(
_backend: &B,
tcx: TyCtxt<'_>,
tx_to_llvm_workers: &Sender<Box<dyn Any + Send>>,
module: CachedModuleCodegen,
) {
let llvm_work_item = WorkItem::CopyPostLtoArtifacts(module);
drop(tcx.tx_to_llvm_workers.lock().send(Box::new(Message::CodegenDone::<B> {
drop(tx_to_llvm_workers.send(Box::new(Message::CodegenDone::<B> {
llvm_work_item,
cost: 0,
})));
@@ -1925,6 +1927,7 @@ pub fn submit_post_lto_module_to_llvm<B: ExtraBackendMethods>(
pub fn submit_pre_lto_module_to_llvm<B: ExtraBackendMethods>(
_backend: &B,
tcx: TyCtxt<'_>,
tx_to_llvm_workers: &Sender<Box<dyn Any + Send>>,
module: CachedModuleCodegen,
) {
let filename = pre_lto_bitcode_filename(&module.name);
@@ -1939,7 +1942,7 @@ pub fn submit_pre_lto_module_to_llvm<B: ExtraBackendMethods>(
})
};
// Schedule the module to be loaded
drop(tcx.tx_to_llvm_workers.lock().send(Box::new(Message::AddImportOnlyModule::<B> {
drop(tx_to_llvm_workers.send(Box::new(Message::AddImportOnlyModule::<B> {
module_data: SerializedModule::FromUncompressedFile(mmap),
work_product: module.source,
})));
25 changes: 7 additions & 18 deletions src/librustc_codegen_ssa/base.rs
Original file line number Diff line number Diff line change
@@ -43,11 +43,9 @@ use crate::mir;

use crate::traits::*;

use std::any::Any;
use std::cmp;
use std::ops::{Deref, DerefMut};
use std::time::{Instant, Duration};
use std::sync::mpsc;
use syntax_pos::Span;
use syntax::attr;
use rustc::hir;
@@ -482,19 +480,13 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
tcx: TyCtxt<'tcx>,
metadata: EncodedMetadata,
need_metadata_module: bool,
rx: mpsc::Receiver<Box<dyn Any + Send>>,
) -> OngoingCodegen<B> {
check_for_rustc_errors_attr(tcx);

// Skip crate items and just output metadata in -Z no-codegen mode.
if tcx.sess.opts.debugging_opts.no_codegen ||
!tcx.sess.opts.output_types.should_codegen() {
let ongoing_codegen = start_async_codegen(
backend,
tcx,
metadata,
rx,
1);
let ongoing_codegen = start_async_codegen(backend, tcx, metadata, 1);

ongoing_codegen.codegen_finished(tcx);

@@ -523,12 +515,7 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
}
}

let ongoing_codegen = start_async_codegen(
backend.clone(),
tcx,
metadata,
rx,
codegen_units.len());
let ongoing_codegen = start_async_codegen(backend.clone(), tcx, metadata, codegen_units.len());
let ongoing_codegen = AbortCodegenOnDrop::<B>(Some(ongoing_codegen));

// Codegen an allocator shim, if necessary.
@@ -614,20 +601,22 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
CguReuse::No => {
tcx.sess.profiler(|p| p.start_activity(format!("codegen {}", cgu.name())));
let start_time = Instant::now();
backend.compile_codegen_unit(tcx, *cgu.name());
backend.compile_codegen_unit(tcx, *cgu.name(), &ongoing_codegen.coordinator_send);
total_codegen_time += start_time.elapsed();
tcx.sess.profiler(|p| p.end_activity(format!("codegen {}", cgu.name())));
false
}
CguReuse::PreLto => {
submit_pre_lto_module_to_llvm(&backend, tcx, CachedModuleCodegen {
submit_pre_lto_module_to_llvm(&backend, tcx, &ongoing_codegen.coordinator_send,
CachedModuleCodegen {
name: cgu.name().to_string(),
source: cgu.work_product(tcx),
});
true
}
CguReuse::PostLto => {
submit_post_lto_module_to_llvm(&backend, tcx, CachedModuleCodegen {
submit_post_lto_module_to_llvm(&backend, &ongoing_codegen.coordinator_send,
CachedModuleCodegen {
name: cgu.name().to_string(),
source: cgu.work_product(tcx),
});
8 changes: 7 additions & 1 deletion src/librustc_codegen_ssa/traits/backend.rs
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ use rustc::session::{Session, config};
use rustc::ty::TyCtxt;
use rustc_codegen_utils::codegen_backend::CodegenBackend;
use std::sync::Arc;
use std::sync::mpsc;
use syntax::ext::allocator::AllocatorKind;
use syntax_pos::symbol::InternedString;

@@ -44,7 +45,12 @@ pub trait ExtraBackendMethods: CodegenBackend + WriteBackendMethods + Sized + Se
mods: &mut Self::Module,
kind: AllocatorKind,
);
fn compile_codegen_unit(&self, tcx: TyCtxt<'_>, cgu_name: InternedString);
fn compile_codegen_unit(
&self,
tcx: TyCtxt<'_>,
cgu_name: InternedString,
tx_to_llvm_workers: &mpsc::Sender<Box<dyn std::any::Any + Send>>,
);
// If find_features is true this won't access `sess.crate_types` by assuming
// that `is_pie_binary` is false. When we discover LLVM target features
// `sess.crate_types` is uninitialized so we cannot access it.
2 changes: 0 additions & 2 deletions src/librustc_codegen_utils/codegen_backend.rs
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]

use std::any::Any;
use std::sync::mpsc;

use syntax::symbol::Symbol;
use rustc::session::Session;
@@ -36,7 +35,6 @@ pub trait CodegenBackend {
tcx: TyCtxt<'tcx>,
metadata: EncodedMetadata,
need_metadata_module: bool,
rx: mpsc::Receiver<Box<dyn Any + Send>>,
) -> Box<dyn Any>;

/// This is called on the returned `Box<dyn Any>` from `codegen_backend`
6 changes: 1 addition & 5 deletions src/librustc_interface/passes.rs
Original file line number Diff line number Diff line change
@@ -54,7 +54,6 @@ use std::fs;
use std::io::{self, Write};
use std::iter;
use std::path::PathBuf;
use std::sync::mpsc;
use std::cell::RefCell;
use std::rc::Rc;

@@ -816,7 +815,6 @@ pub fn create_global_ctxt(
defs: hir::map::Definitions,
resolutions: Resolutions,
outputs: OutputFilenames,
tx: mpsc::Sender<Box<dyn Any + Send>>,
crate_name: &str,
) -> BoxedGlobalCtxt {
let sess = compiler.session().clone();
@@ -858,7 +856,6 @@ pub fn create_global_ctxt(
hir_map,
query_result_on_disk_cache,
&crate_name,
tx,
&outputs
);

@@ -1068,7 +1065,6 @@ fn encode_and_write_metadata(
pub fn start_codegen<'tcx>(
codegen_backend: &dyn CodegenBackend,
tcx: TyCtxt<'tcx>,
rx: mpsc::Receiver<Box<dyn Any + Send>>,
outputs: &OutputFilenames,
) -> Box<dyn Any> {
if log_enabled!(::log::Level::Info) {
@@ -1082,7 +1078,7 @@ pub fn start_codegen<'tcx>(

tcx.sess.profiler(|p| p.start_activity("codegen crate"));
let codegen = time(tcx.sess, "codegen", move || {
codegen_backend.codegen_crate(tcx, metadata, need_metadata_module, rx)
codegen_backend.codegen_crate(tcx, metadata, need_metadata_module)
});
tcx.sess.profiler(|p| p.end_activity("codegen crate"));

Loading