@@ -11,7 +11,7 @@ use rustc_data_structures::outline;
11
11
use rustc_data_structures:: profiling:: QueryInvocationId ;
12
12
use rustc_data_structures:: sharded:: { self , ShardedHashMap } ;
13
13
use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
14
- use rustc_data_structures:: sync:: { AtomicU64 , Lock , is_dyn_thread_safe } ;
14
+ use rustc_data_structures:: sync:: { AtomicU64 , Lock } ;
15
15
use rustc_data_structures:: unord:: UnordMap ;
16
16
use rustc_errors:: DiagInner ;
17
17
use rustc_index:: IndexVec ;
@@ -1308,11 +1308,11 @@ impl Default for TaskDeps {
1308
1308
}
1309
1309
}
1310
1310
}
1311
+
1311
1312
// A data structure that stores Option<DepNodeColor> values as a contiguous
1312
1313
// array, using one u32 per entry.
1313
1314
pub ( super ) struct DepNodeColorMap {
1314
1315
values : IndexVec < SerializedDepNodeIndex , AtomicU32 > ,
1315
- sync : bool ,
1316
1316
}
1317
1317
1318
1318
// The values here are chosen to optimize `DepNodeColorMap::get`. All values below
@@ -1323,10 +1323,7 @@ const COMPRESSED_RED: u32 = u32::MAX;
1323
1323
impl DepNodeColorMap {
1324
1324
fn new ( size : usize ) -> DepNodeColorMap {
1325
1325
debug_assert ! ( COMPRESSED_RED > DepNodeIndex :: MAX_AS_U32 ) ;
1326
- DepNodeColorMap {
1327
- values : ( 0 ..size) . map ( |_| AtomicU32 :: new ( COMPRESSED_UNKNOWN ) ) . collect ( ) ,
1328
- sync : is_dyn_thread_safe ( ) ,
1329
- }
1326
+ DepNodeColorMap { values : ( 0 ..size) . map ( |_| AtomicU32 :: new ( COMPRESSED_UNKNOWN ) ) . collect ( ) }
1330
1327
}
1331
1328
1332
1329
#[ inline]
@@ -1345,24 +1342,14 @@ impl DepNodeColorMap {
1345
1342
index : DepNodeIndex ,
1346
1343
) -> Result < ( ) , DepNodeIndex > {
1347
1344
let value = & self . values [ prev_index] ;
1348
- if self . sync {
1349
- match value. compare_exchange (
1350
- COMPRESSED_UNKNOWN ,
1351
- index. as_u32 ( ) ,
1352
- Ordering :: Relaxed ,
1353
- Ordering :: Relaxed ,
1354
- ) {
1355
- Ok ( _) => Ok ( ( ) ) ,
1356
- Err ( v) => Err ( DepNodeIndex :: from_u32 ( v) ) ,
1357
- }
1358
- } else {
1359
- let v = value. load ( Ordering :: Relaxed ) ;
1360
- if v == COMPRESSED_UNKNOWN {
1361
- value. store ( index. as_u32 ( ) , Ordering :: Relaxed ) ;
1362
- Ok ( ( ) )
1363
- } else {
1364
- Err ( DepNodeIndex :: from_u32 ( v) )
1365
- }
1345
+ match value. compare_exchange (
1346
+ COMPRESSED_UNKNOWN ,
1347
+ index. as_u32 ( ) ,
1348
+ Ordering :: Relaxed ,
1349
+ Ordering :: Relaxed ,
1350
+ ) {
1351
+ Ok ( _) => Ok ( ( ) ) ,
1352
+ Err ( v) => Err ( DepNodeIndex :: from_u32 ( v) ) ,
1366
1353
}
1367
1354
}
1368
1355
0 commit comments