Skip to content

Commit

Permalink
Auto merge of #64358 - cuviper:rustc-rayon-1.2, r=nikomatsakis
Browse files Browse the repository at this point in the history
Rebase rustc-rayon on rayon-1.2

See also rust-lang/rustc-rayon#3
  • Loading branch information
bors committed Oct 7, 2019
2 parents f3c9cec + 29cd7eb commit c20654e
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 25 deletions.
64 changes: 49 additions & 15 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,16 @@ dependencies = [
"crossbeam-utils 0.6.5",
]

[[package]]
name = "crossbeam-deque"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b18cd2e169ad86297e6bc0ad9aa679aee9daa4f19e8163860faf7c164e4f5a71"
dependencies = [
"crossbeam-epoch 0.7.2",
"crossbeam-utils 0.6.5",
]

[[package]]
name = "crossbeam-epoch"
version = "0.3.1"
Expand Down Expand Up @@ -2791,22 +2801,22 @@ dependencies = [

[[package]]
name = "rayon"
version = "1.1.0"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4b0186e22767d5b9738a05eab7c6ac90b15db17e5b5f9bd87976dd7d89a10a4"
checksum = "83a27732a533a1be0a0035a111fe76db89ad312f6f0347004c220c57f209a123"
dependencies = [
"crossbeam-deque 0.6.3",
"crossbeam-deque 0.7.1",
"either",
"rayon-core",
]

[[package]]
name = "rayon-core"
version = "1.5.0"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebbe0df8435ac0c397d467b6cad6d25543d06e8a019ef3f6af3c384597515bd2"
checksum = "98dcf634205083b17d0861252431eb2acbfb698ab7478a2d20de07954f47ec7b"
dependencies = [
"crossbeam-deque 0.6.3",
"crossbeam-deque 0.7.1",
"crossbeam-queue",
"crossbeam-utils 0.6.5",
"lazy_static 1.3.0",
Expand Down Expand Up @@ -3074,8 +3084,8 @@ dependencies = [
"num_cpus",
"parking_lot 0.9.0",
"polonius-engine",
"rustc-rayon",
"rustc-rayon-core",
"rustc-rayon 0.3.0",
"rustc-rayon-core 0.3.0",
"rustc_apfloat",
"rustc_data_structures",
"rustc_errors",
Expand Down Expand Up @@ -3123,8 +3133,8 @@ dependencies = [
"rustc-ap-graphviz",
"rustc-ap-serialize",
"rustc-hash",
"rustc-rayon",
"rustc-rayon-core",
"rustc-rayon 0.2.0",
"rustc-rayon-core 0.2.0",
"smallvec",
"stable_deref_trait",
]
Expand Down Expand Up @@ -3263,7 +3273,18 @@ checksum = "0d2e07e19601f21c59aad953c2632172ba70cb27e685771514ea66e4062b3363"
dependencies = [
"crossbeam-deque 0.2.0",
"either",
"rustc-rayon-core",
"rustc-rayon-core 0.2.0",
]

[[package]]
name = "rustc-rayon"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f32767f90d938f1b7199a174ef249ae1924f6e5bbdb9d112fea141e016f25b3a"
dependencies = [
"crossbeam-deque 0.7.1",
"either",
"rustc-rayon-core 0.3.0",
]

[[package]]
Expand All @@ -3278,6 +3299,19 @@ dependencies = [
"num_cpus",
]

[[package]]
name = "rustc-rayon-core"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea2427831f0053ea3ea73559c8eabd893133a51b251d142bacee53c62a288cb3"
dependencies = [
"crossbeam-deque 0.7.1",
"crossbeam-queue",
"crossbeam-utils 0.6.5",
"lazy_static 1.3.0",
"num_cpus",
]

[[package]]
name = "rustc-serialize"
version = "0.3.24"
Expand Down Expand Up @@ -3398,8 +3432,8 @@ dependencies = [
"log",
"parking_lot 0.9.0",
"rustc-hash",
"rustc-rayon",
"rustc-rayon-core",
"rustc-rayon 0.3.0",
"rustc-rayon-core 0.3.0",
"rustc_index",
"serialize",
"smallvec",
Expand Down Expand Up @@ -3479,7 +3513,7 @@ dependencies = [
"log",
"once_cell",
"rustc",
"rustc-rayon",
"rustc-rayon 0.3.0",
"rustc_codegen_ssa",
"rustc_codegen_utils",
"rustc_data_structures",
Expand Down Expand Up @@ -3758,7 +3792,7 @@ version = "0.0.0"
dependencies = [
"minifier",
"pulldown-cmark 0.5.3",
"rustc-rayon",
"rustc-rayon 0.3.0",
"tempfile",
]

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobserver = "0.1"
num_cpus = "1.0"
scoped-tls = "1.0"
log = { version = "0.4", features = ["release_max_level_info", "std"] }
rustc-rayon = "0.2.0"
rustc-rayon-core = "0.2.0"
rustc-rayon = "0.3.0"
rustc-rayon-core = "0.3.0"
polonius-engine = "0.10.0"
rustc_apfloat = { path = "../librustc_apfloat" }
rustc_target = { path = "../librustc_target" }
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_data_structures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ graphviz = { path = "../libgraphviz" }
cfg-if = "0.1.2"
crossbeam-utils = { version = "0.6.5", features = ["nightly"] }
stable_deref_trait = "1.0.0"
rayon = { version = "0.2.0", package = "rustc-rayon" }
rayon-core = { version = "0.2.0", package = "rustc-rayon-core" }
rayon = { version = "0.3.0", package = "rustc-rayon" }
rayon-core = { version = "0.3.0", package = "rustc-rayon-core" }
rustc-hash = "1.0.1"
smallvec = { version = "0.6.7", features = ["union", "may_dangle"] }
rustc_index = { path = "../librustc_index", package = "rustc_index" }
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ doctest = false

[dependencies]
log = "0.4"
rayon = { version = "0.2.0", package = "rustc-rayon" }
rayon = { version = "0.3.0", package = "rustc-rayon" }
smallvec = { version = "0.6.7", features = ["union", "may_dangle"] }
syntax = { path = "../libsyntax" }
syntax_ext = { path = "../libsyntax_ext" }
Expand Down
9 changes: 5 additions & 4 deletions src/librustc_interface/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,12 @@ pub fn spawn_thread_pool<F: FnOnce() -> R + Send, R: Send>(
stderr: &Option<Arc<Mutex<Vec<u8>>>>,
f: F,
) -> R {
use rayon::{ThreadPool, ThreadPoolBuilder};
use rayon::{ThreadBuilder, ThreadPool, ThreadPoolBuilder};

let gcx_ptr = &Lock::new(0);

let mut config = ThreadPoolBuilder::new()
.thread_name(|_| "rustc".to_string())
.acquire_thread_handler(jobserver::acquire_thread)
.release_thread_handler(jobserver::release_thread)
.num_threads(threads)
Expand All @@ -225,20 +226,20 @@ pub fn spawn_thread_pool<F: FnOnce() -> R + Send, R: Send>(
// the thread local rustc uses. syntax_globals and syntax_pos_globals are
// captured and set on the new threads. ty::tls::with_thread_locals sets up
// thread local callbacks from libsyntax
let main_handler = move |worker: &mut dyn FnMut()| {
let main_handler = move |thread: ThreadBuilder| {
syntax::GLOBALS.set(syntax_globals, || {
syntax_pos::GLOBALS.set(syntax_pos_globals, || {
if let Some(stderr) = stderr {
io::set_panic(Some(box Sink(stderr.clone())));
}
ty::tls::with_thread_locals(|| {
ty::tls::GCX_PTR.set(gcx_ptr, || worker())
ty::tls::GCX_PTR.set(gcx_ptr, || thread.run())
})
})
})
};

ThreadPool::scoped_pool(config, main_handler, with_pool).unwrap()
config.build_scoped(main_handler, with_pool).unwrap()
})
})
})
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ path = "lib.rs"
[dependencies]
pulldown-cmark = { version = "0.5.3", default-features = false }
minifier = "0.0.33"
rayon = { version = "0.2.0", package = "rustc-rayon" }
rayon = { version = "0.3.0", package = "rustc-rayon" }
tempfile = "3"
1 change: 1 addition & 0 deletions src/tools/tidy/src/deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const WHITELIST: &[Crate<'_>] = &[
Crate("crc32fast"),
Crate("crossbeam-deque"),
Crate("crossbeam-epoch"),
Crate("crossbeam-queue"),
Crate("crossbeam-utils"),
Crate("datafrog"),
Crate("dlmalloc"),
Expand Down

0 comments on commit c20654e

Please sign in to comment.