Skip to content

Commit 7b0006d

Browse files
committed
Auto merge of #46564 - Zoxc:rayon-queries, r=<try>
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.
2 parents 8a28d94 + fc85d9b commit 7b0006d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+2028
-814
lines changed

src/Cargo.lock

+116-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bootstrap/bin/rustc.rs

+14
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ use std::str::FromStr;
3838
use std::time::Instant;
3939

4040
fn main() {
41+
// Show crash dialog
42+
#[cfg(windows)]
43+
{
44+
extern "system" {
45+
fn SetErrorMode(mode: u32) -> u32;
46+
}
47+
const SEM_NOGPFAULTERRORBOX: u32 = 0x0002;
48+
unsafe {
49+
let mode = SetErrorMode(0) & !SEM_NOGPFAULTERRORBOX;
50+
SetErrorMode(mode);
51+
}
52+
}
53+
4154
let mut args = env::args_os().skip(1).collect::<Vec<_>>();
4255

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

102115
let mut cmd = Command::new(rustc);
116+
cmd.env("RUST_BACKTRACE", "1");
103117
cmd.args(&args)
104118
.arg("--cfg")
105119
.arg(format!("stage{}", stage))

src/bootstrap/builder.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ impl<'a> Builder<'a> {
311311
tool::RustInstaller, tool::Cargo, tool::Rls, tool::Rustdoc, tool::Clippy,
312312
native::Llvm, tool::Rustfmt, tool::Miri, native::Lld),
313313
Kind::Check => describe!(check::Std, check::Test, check::Rustc, check::CodegenBackend),
314-
Kind::Test => describe!(test::Tidy, test::Bootstrap, test::Ui, test::RunPass,
314+
Kind::Test => describe!(test::Tidy, test::Bootstrap/*, test::Ui, test::RunPass,
315315
test::CompileFail, test::ParseFail, test::RunFail, test::RunPassValgrind,
316316
test::MirOpt, test::Codegen, test::CodegenUnits, test::Incremental, test::Debuginfo,
317317
test::UiFullDeps, test::RunPassFullDeps, test::RunFailFullDeps,
@@ -324,8 +324,9 @@ impl<'a> Builder<'a> {
324324
test::Nomicon, test::Reference, test::RustdocBook, test::RustByExample,
325325
test::TheBook, test::UnstableBook,
326326
test::Rustfmt, test::Miri, test::Clippy, test::RustdocJS, test::RustdocTheme,
327+
test::RustdocUi,
327328
// Run run-make last, since these won't pass without make on Windows
328-
test::RunMake, test::RustdocUi),
329+
test::RunMake*/),
329330
Kind::Bench => describe!(test::Crate, test::CrateLibrustc),
330331
Kind::Doc => describe!(doc::UnstableBook, doc::UnstableBookGen, doc::TheBook,
331332
doc::Standalone, doc::Std, doc::Test, doc::WhitelistedRustc, doc::Rustc,

src/bootstrap/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ impl Config {
518518
set(&mut config.test_miri, rust.test_miri);
519519
set(&mut config.wasm_syscall, rust.wasm_syscall);
520520
set(&mut config.lld_enabled, rust.lld);
521-
config.rustc_parallel_queries = rust.experimental_parallel_queries.unwrap_or(false);
521+
config.rustc_parallel_queries = rust.experimental_parallel_queries.unwrap_or(true);
522522
config.rustc_default_linker = rust.default_linker.clone();
523523
config.musl_root = rust.musl_root.clone().map(PathBuf::from);
524524
config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from);

src/libproc_macro/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
#![feature(lang_items)]
3939
#![feature(optin_builtin_traits)]
4040

41+
#![recursion_limit="256"]
42+
4143
extern crate syntax;
4244
extern crate syntax_pos;
4345
extern crate rustc_errors;

src/librustc/Cargo.toml

+8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobserver = "0.1"
1717
lazy_static = "1.0.0"
1818
log = { version = "0.4", features = ["release_max_level_info", "std"] }
1919
proc_macro = { path = "../libproc_macro" }
20+
rayon = { git = "https://github.com/Zoxc/rayon.git", branch = "fiber" }
21+
rayon-core = { git = "https://github.com/Zoxc/rayon.git", branch = "fiber", features=["tlv"] }
22+
scoped-tls = { version = "0.1.1", features = ["nightly"] }
2023
rustc_apfloat = { path = "../librustc_apfloat" }
2124
rustc_back = { path = "../librustc_back" }
2225
rustc_const_math = { path = "../librustc_const_math" }
@@ -25,6 +28,7 @@ rustc_errors = { path = "../librustc_errors" }
2528
serialize = { path = "../libserialize" }
2629
syntax = { path = "../libsyntax" }
2730
syntax_pos = { path = "../libsyntax_pos" }
31+
num_cpus = "1.0"
2832
backtrace = "0.3.3"
2933
byteorder = { version = "1.1", features = ["i128"]}
3034

@@ -57,3 +61,7 @@ byteorder = { version = "1.1", features = ["i128"]}
5761
# compiles, then please feel free to do so!
5862
flate2 = "1.0"
5963
tempdir = "0.3"
64+
65+
[target.'cfg(windows)'.dependencies]
66+
kernel32-sys = "0.2.2"
67+
winapi = "0.2.8"

0 commit comments

Comments
 (0)