Skip to content

Commit fea3b26

Browse files
committed
fixes
1 parent 0128f64 commit fea3b26

File tree

6 files changed

+85
-58
lines changed

6 files changed

+85
-58
lines changed

src/Cargo.lock

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

src/librustc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ graphviz = { path = "../libgraphviz" }
1616
jobserver = "0.1"
1717
log = "0.3"
1818
rayon = { git = "https://github.com/Zoxc/rayon.git", branch = "fiber" }
19-
rayon-core = { git = "https://github.com/Zoxc/rayon.git", branch = "fiber", features=["debug", "tlv"] }
19+
rayon-core = { git = "https://github.com/Zoxc/rayon.git", branch = "fiber", features=["tlv"] }
2020
scoped-tls = { git = "https://github.com/Zoxc/scoped-tls.git", features=["nightly"] }
2121
owning_ref = { git = "https://github.com/Zoxc/owning-ref-rs.git" }
2222
rustc_back = { path = "../librustc_back" }

src/librustc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ extern crate x86;
8686
extern crate owning_ref;
8787
extern crate rustc_back;
8888
#[macro_use] extern crate rustc_data_structures;
89-
#[macro_use] extern crate lazy_static;
9089
extern crate serialize;
9190
extern crate rustc_const_math;
9291
extern crate rustc_errors as errors;

src/librustc/ty/maps/job.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,20 @@ impl<'tcx> QueryJob<'tcx> {
4545
}
4646

4747
pub fn await(&self) {
48-
#[cfg(parallel_queries)]
48+
/*#[cfg(parallel_queries)]
4949
registry::in_worker(|worker, _| {
5050
unsafe {
5151
worker.wait_until(&self.latch);
5252
}
53-
});
53+
});*/
5454
}
5555

5656
pub fn signal_complete(&self) {
57-
#[cfg(parallel_queries)]
57+
/*#[cfg(parallel_queries)]
5858
{
5959
self.latch.set();
6060
Registry::current().signal();
61-
}
61+
}*/
6262
}
6363
}
6464

src/librustc/ty/maps/plumbing.rs

-38
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use ty::maps::Query; // NB: actually generated by the macros in this file
1919
use ty::maps::config::QueryDescription;
2020
use ty::maps::job::QueryResult;
2121
use ty::item_path;
22-
use std::sync::atomic::AtomicUsize;
2322

2423
use rustc_data_structures::fx::{FxHashMap};
2524
use rustc_data_structures::sync::LockGuard;
@@ -169,8 +168,6 @@ macro_rules! profq_key {
169168
}
170169
}
171170

172-
pub static QUERY_DEPTH: AtomicUsize = AtomicUsize::new(0);
173-
174171
macro_rules! define_maps {
175172
(<$tcx:tt>
176173
$($(#[$attr:meta])*
@@ -182,8 +179,6 @@ macro_rules! define_maps {
182179
use std::mem;
183180
use std::panic;
184181
use errors::Diagnostic;
185-
use ty::maps::plumbing::QUERY_DEPTH;
186-
use std::sync::atomic::Ordering;
187182
use rayon_core;
188183

189184
define_map_struct! {
@@ -298,19 +293,6 @@ macro_rules! define_maps {
298293
} else {
299294
break
300295
};
301-
lazy_static! {
302-
static ref LOG: bool = ::std::env::var("QUERY_LOG").is_ok();
303-
}
304-
305-
if *LOG {
306-
println!("({}) waiting on query {:?} latch {:x}",
307-
QUERY_DEPTH.load(Ordering::SeqCst),
308-
Query::$name(Clone::clone(&key)), &job.latch as *const _ as usize);
309-
for i in tcx.query().stack.iter() {
310-
println!(" query stack entry {:?}", i);
311-
312-
}
313-
}
314296
// If there is a cycle, waiting will never complete
315297
tcx.cycle_check(span, &Query::$name(Clone::clone(&key)))?;
316298
job.await();
@@ -441,25 +423,11 @@ macro_rules! define_maps {
441423

442424
tcx.cycle_check(span, &query)?;
443425

444-
lazy_static! {
445-
static ref LOG: bool = ::std::env::var("QUERY_LOG").is_ok();
446-
}
447-
448426
let entry = (span, query);
449427
let stack = tcx.query().stack.iter().cloned().chain(iter::once(entry)).collect();
450428
let job = Lrc::new(QueryJob::new(stack, true, false));
451429
job.start();
452430

453-
if *LOG {
454-
println!("({}) starting query {:?} latch {:x}",
455-
QUERY_DEPTH.load(Ordering::SeqCst),
456-
query.clone(), &job.latch as *const _ as usize);
457-
for i in tcx.query().stack.iter() {
458-
println!(" query stack entry {:?}", i);
459-
460-
}
461-
}
462-
QUERY_DEPTH.fetch_add(1, Ordering::SeqCst);
463431

464432
#[cfg(parallel_queries)]
465433
{
@@ -501,12 +469,6 @@ macro_rules! define_maps {
501469
r
502470
};
503471

504-
if *LOG {
505-
println!("ending query {:?}", query.clone());
506-
}
507-
508-
QUERY_DEPTH.fetch_sub(1, Ordering::SeqCst);
509-
510472
let diagnostics: Vec<_> = {
511473
let mut diagnostics = job.diagnostics.lock();
512474
let diagnostics: Vec<_> = diagnostics.drain(..).collect();

src/librustc/ty/mod.rs

+4-12
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use std::fmt;
4242
use std::hash::{Hash, Hasher};
4343
use std::iter::FromIterator;
4444
use std::ops::Deref;
45-
use rustc_data_structures::sync::{Send, Sync, Lrc};
45+
use rustc_data_structures::sync::{par_iter, Send, Sync, Lrc};
4646
use std::slice;
4747
use std::vec::IntoIter;
4848
use std::mem;
@@ -2098,17 +2098,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
20982098
}
20992099

21002100
pub fn par_body_owners<F: Fn(DefId) + Sync + Send>(self, f: F) {
2101-
#[cfg(not(parallel_queries))]
2102-
self.body_owners().for_each(|def_id| f(def_id));
2103-
2104-
#[cfg(parallel_queries)]
2105-
{
2106-
use rayon::prelude::*;
2107-
self.hir.krate()
2108-
.body_ids
2109-
.par_iter()
2110-
.for_each(|&body_id| f(self.hir.body_owner_def_id(body_id)));
2111-
}
2101+
par_iter(&self.hir.krate().body_ids).for_each(|&body_id| {
2102+
f(self.hir.body_owner_def_id(body_id))
2103+
});
21122104
}
21132105

21142106
pub fn expr_span(self, id: NodeId) -> Span {

0 commit comments

Comments
 (0)