Skip to content

Commit

Permalink
Auto merge of #46564 - Zoxc:rayon-queries, r=<try>
Browse files Browse the repository at this point in the history
WIP: Parallelize passes using rayon

This builds on #46193 and #45912 and actually makes code run in parallel. This is not quite ready yet since `rustc` is not yet completely thread safe. It also uses a rough fork of rayon which uses fibers/stackful coroutines.
  • Loading branch information
bors committed Apr 19, 2018
2 parents 8a28d94 + fc85d9b commit 7b0006d
Show file tree
Hide file tree
Showing 81 changed files with 2,028 additions and 814 deletions.
117 changes: 116 additions & 1 deletion src/Cargo.lock

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ use std::str::FromStr;
use std::time::Instant;

fn main() {
// Show crash dialog
#[cfg(windows)]
{
extern "system" {
fn SetErrorMode(mode: u32) -> u32;
}
const SEM_NOGPFAULTERRORBOX: u32 = 0x0002;
unsafe {
let mode = SetErrorMode(0) & !SEM_NOGPFAULTERRORBOX;
SetErrorMode(mode);
}
}

let mut args = env::args_os().skip(1).collect::<Vec<_>>();

// Append metadata suffix for internal crates. See the corresponding entry
Expand Down Expand Up @@ -100,6 +113,7 @@ fn main() {
dylib_path.insert(0, PathBuf::from(&libdir));

let mut cmd = Command::new(rustc);
cmd.env("RUST_BACKTRACE", "1");
cmd.args(&args)
.arg("--cfg")
.arg(format!("stage{}", stage))
Expand Down
5 changes: 3 additions & 2 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ impl<'a> Builder<'a> {
tool::RustInstaller, tool::Cargo, tool::Rls, tool::Rustdoc, tool::Clippy,
native::Llvm, tool::Rustfmt, tool::Miri, native::Lld),
Kind::Check => describe!(check::Std, check::Test, check::Rustc, check::CodegenBackend),
Kind::Test => describe!(test::Tidy, test::Bootstrap, test::Ui, test::RunPass,
Kind::Test => describe!(test::Tidy, test::Bootstrap/*, test::Ui, test::RunPass,
test::CompileFail, test::ParseFail, test::RunFail, test::RunPassValgrind,
test::MirOpt, test::Codegen, test::CodegenUnits, test::Incremental, test::Debuginfo,
test::UiFullDeps, test::RunPassFullDeps, test::RunFailFullDeps,
Expand All @@ -324,8 +324,9 @@ impl<'a> Builder<'a> {
test::Nomicon, test::Reference, test::RustdocBook, test::RustByExample,
test::TheBook, test::UnstableBook,
test::Rustfmt, test::Miri, test::Clippy, test::RustdocJS, test::RustdocTheme,
test::RustdocUi,
// Run run-make last, since these won't pass without make on Windows
test::RunMake, test::RustdocUi),
test::RunMake*/),
Kind::Bench => describe!(test::Crate, test::CrateLibrustc),
Kind::Doc => describe!(doc::UnstableBook, doc::UnstableBookGen, doc::TheBook,
doc::Standalone, doc::Std, doc::Test, doc::WhitelistedRustc, doc::Rustc,
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ impl Config {
set(&mut config.test_miri, rust.test_miri);
set(&mut config.wasm_syscall, rust.wasm_syscall);
set(&mut config.lld_enabled, rust.lld);
config.rustc_parallel_queries = rust.experimental_parallel_queries.unwrap_or(false);
config.rustc_parallel_queries = rust.experimental_parallel_queries.unwrap_or(true);
config.rustc_default_linker = rust.default_linker.clone();
config.musl_root = rust.musl_root.clone().map(PathBuf::from);
config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from);
Expand Down
2 changes: 2 additions & 0 deletions src/libproc_macro/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
#![feature(lang_items)]
#![feature(optin_builtin_traits)]

#![recursion_limit="256"]

extern crate syntax;
extern crate syntax_pos;
extern crate rustc_errors;
Expand Down
8 changes: 8 additions & 0 deletions src/librustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobserver = "0.1"
lazy_static = "1.0.0"
log = { version = "0.4", features = ["release_max_level_info", "std"] }
proc_macro = { path = "../libproc_macro" }
rayon = { git = "https://github.com/Zoxc/rayon.git", branch = "fiber" }
rayon-core = { git = "https://github.com/Zoxc/rayon.git", branch = "fiber", features=["tlv"] }
scoped-tls = { version = "0.1.1", features = ["nightly"] }
rustc_apfloat = { path = "../librustc_apfloat" }
rustc_back = { path = "../librustc_back" }
rustc_const_math = { path = "../librustc_const_math" }
Expand All @@ -25,6 +28,7 @@ rustc_errors = { path = "../librustc_errors" }
serialize = { path = "../libserialize" }
syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" }
num_cpus = "1.0"
backtrace = "0.3.3"
byteorder = { version = "1.1", features = ["i128"]}

Expand Down Expand Up @@ -57,3 +61,7 @@ byteorder = { version = "1.1", features = ["i128"]}
# compiles, then please feel free to do so!
flate2 = "1.0"
tempdir = "0.3"

[target.'cfg(windows)'.dependencies]
kernel32-sys = "0.2.2"
winapi = "0.2.8"
Loading

0 comments on commit 7b0006d

Please sign in to comment.