@@ -15,7 +15,6 @@ use rustc_span::Span;
15
15
use std:: hash:: Hash ;
16
16
use std:: num:: NonZeroU64 ;
17
17
18
- #[ cfg( parallel_compiler) ]
19
18
use {
20
19
parking_lot:: { Condvar , Mutex } ,
21
20
rayon_core,
@@ -47,17 +46,14 @@ impl QueryJobId {
47
46
map. get ( & self ) . unwrap ( ) . query . clone ( )
48
47
}
49
48
50
- #[ cfg( parallel_compiler) ]
51
49
fn span < D : DepKind > ( self , map : & QueryMap < D > ) -> Span {
52
50
map. get ( & self ) . unwrap ( ) . job . span
53
51
}
54
52
55
- #[ cfg( parallel_compiler) ]
56
53
fn parent < D : DepKind > ( self , map : & QueryMap < D > ) -> Option < QueryJobId > {
57
54
map. get ( & self ) . unwrap ( ) . job . parent
58
55
}
59
56
60
- #[ cfg( parallel_compiler) ]
61
57
fn latch < D : DepKind > ( self , map : & QueryMap < D > ) -> Option < & QueryLatch < D > > {
62
58
map. get ( & self ) . unwrap ( ) . job . latch . as_ref ( )
63
59
}
@@ -81,7 +77,6 @@ pub struct QueryJob<D: DepKind> {
81
77
pub parent : Option < QueryJobId > ,
82
78
83
79
/// The latch that is used to wait on this job.
84
- #[ cfg( parallel_compiler) ]
85
80
latch : Option < QueryLatch < D > > ,
86
81
spooky : core:: marker:: PhantomData < D > ,
87
82
}
@@ -90,17 +85,9 @@ impl<D: DepKind> QueryJob<D> {
90
85
/// Creates a new query job.
91
86
#[ inline]
92
87
pub fn new ( id : QueryJobId , span : Span , parent : Option < QueryJobId > ) -> Self {
93
- QueryJob {
94
- id,
95
- span,
96
- parent,
97
- #[ cfg( parallel_compiler) ]
98
- latch : None ,
99
- spooky : PhantomData ,
100
- }
88
+ QueryJob { id, span, parent, latch : None , spooky : PhantomData }
101
89
}
102
90
103
- #[ cfg( parallel_compiler) ]
104
91
pub ( super ) fn latch ( & mut self ) -> QueryLatch < D > {
105
92
if self . latch . is_none ( ) {
106
93
self . latch = Some ( QueryLatch :: new ( ) ) ;
@@ -114,11 +101,8 @@ impl<D: DepKind> QueryJob<D> {
114
101
/// as there are no concurrent jobs which could be waiting on us
115
102
#[ inline]
116
103
pub fn signal_complete ( self ) {
117
- #[ cfg( parallel_compiler) ]
118
- {
119
- if let Some ( latch) = self . latch {
120
- latch. set ( ) ;
121
- }
104
+ if let Some ( latch) = self . latch {
105
+ latch. set ( ) ;
122
106
}
123
107
}
124
108
}
@@ -184,35 +168,30 @@ impl QueryJobId {
184
168
}
185
169
}
186
170
187
- #[ cfg( parallel_compiler) ]
188
171
struct QueryWaiter < D : DepKind > {
189
172
query : Option < QueryJobId > ,
190
173
condvar : Condvar ,
191
174
span : Span ,
192
175
cycle : Lock < Option < CycleError < D > > > ,
193
176
}
194
177
195
- #[ cfg( parallel_compiler) ]
196
178
impl < D : DepKind > QueryWaiter < D > {
197
179
fn notify ( & self , registry : & rayon_core:: Registry ) {
198
180
rayon_core:: mark_unblocked ( registry) ;
199
181
self . condvar . notify_one ( ) ;
200
182
}
201
183
}
202
184
203
- #[ cfg( parallel_compiler) ]
204
185
struct QueryLatchInfo < D : DepKind > {
205
186
complete : bool ,
206
187
waiters : Vec < Lrc < QueryWaiter < D > > > ,
207
188
}
208
189
209
- #[ cfg( parallel_compiler) ]
210
190
#[ derive( Clone ) ]
211
191
pub ( super ) struct QueryLatch < D : DepKind > {
212
192
info : Lrc < Mutex < QueryLatchInfo < D > > > ,
213
193
}
214
194
215
- #[ cfg( parallel_compiler) ]
216
195
impl < D : DepKind > QueryLatch < D > {
217
196
fn new ( ) -> Self {
218
197
QueryLatch {
@@ -283,7 +262,6 @@ impl<D: DepKind> QueryLatch<D> {
283
262
}
284
263
285
264
/// A resumable waiter of a query. The usize is the index into waiters in the query's latch
286
- #[ cfg( parallel_compiler) ]
287
265
type Waiter = ( QueryJobId , usize ) ;
288
266
289
267
/// Visits all the non-resumable and resumable waiters of a query.
@@ -295,7 +273,6 @@ type Waiter = (QueryJobId, usize);
295
273
/// For visits of resumable waiters it returns Some(Some(Waiter)) which has the
296
274
/// required information to resume the waiter.
297
275
/// If all `visit` calls returns None, this function also returns None.
298
- #[ cfg( parallel_compiler) ]
299
276
fn visit_waiters < F , D > (
300
277
query_map : & QueryMap < D > ,
301
278
query : QueryJobId ,
@@ -331,7 +308,6 @@ where
331
308
/// `span` is the reason for the `query` to execute. This is initially DUMMY_SP.
332
309
/// If a cycle is detected, this initial value is replaced with the span causing
333
310
/// the cycle.
334
- #[ cfg( parallel_compiler) ]
335
311
fn cycle_check < D : DepKind > (
336
312
query_map : & QueryMap < D > ,
337
313
query : QueryJobId ,
@@ -372,7 +348,6 @@ fn cycle_check<D: DepKind>(
372
348
/// Finds out if there's a path to the compiler root (aka. code which isn't in a query)
373
349
/// from `query` without going through any of the queries in `visited`.
374
350
/// This is achieved with a depth first search.
375
- #[ cfg( parallel_compiler) ]
376
351
fn connected_to_root < D : DepKind > (
377
352
query_map : & QueryMap < D > ,
378
353
query : QueryJobId ,
@@ -395,7 +370,6 @@ fn connected_to_root<D: DepKind>(
395
370
}
396
371
397
372
// Deterministically pick an query from a list
398
- #[ cfg( parallel_compiler) ]
399
373
fn pick_query < ' a , T , F , D > ( query_map : & QueryMap < D > , queries : & ' a [ T ] , f : F ) -> & ' a T
400
374
where
401
375
F : Fn ( & T ) -> ( Span , QueryJobId ) ,
@@ -422,7 +396,6 @@ where
422
396
/// the function return true.
423
397
/// If a cycle was not found, the starting query is removed from `jobs` and
424
398
/// the function returns false.
425
- #[ cfg( parallel_compiler) ]
426
399
fn remove_cycle < D : DepKind > (
427
400
query_map : & QueryMap < D > ,
428
401
jobs : & mut Vec < QueryJobId > ,
@@ -527,7 +500,6 @@ fn remove_cycle<D: DepKind>(
527
500
/// uses a query latch and then resuming that waiter.
528
501
/// There may be multiple cycles involved in a deadlock, so this searches
529
502
/// all active queries for cycles before finally resuming all the waiters at once.
530
- #[ cfg( parallel_compiler) ]
531
503
pub fn deadlock < D : DepKind > ( query_map : QueryMap < D > , registry : & rayon_core:: Registry ) {
532
504
let on_panic = OnDrop ( || {
533
505
eprintln ! ( "deadlock handler panicked, aborting process" ) ;
0 commit comments