@@ -11,7 +11,7 @@ use rustc_data_structures::outline;
1111use rustc_data_structures:: profiling:: QueryInvocationId ;
1212use rustc_data_structures:: sharded:: { self , ShardedHashMap } ;
1313use 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 } ;
1515use rustc_data_structures:: unord:: UnordMap ;
1616use rustc_errors:: DiagInner ;
1717use rustc_index:: IndexVec ;
@@ -1308,11 +1308,11 @@ impl Default for TaskDeps {
13081308 }
13091309 }
13101310}
1311+
13111312// A data structure that stores Option<DepNodeColor> values as a contiguous
13121313// array, using one u32 per entry.
13131314pub ( super ) struct DepNodeColorMap {
13141315 values : IndexVec < SerializedDepNodeIndex , AtomicU32 > ,
1315- sync : bool ,
13161316}
13171317
13181318// The values here are chosen to optimize `DepNodeColorMap::get`. All values below
@@ -1323,10 +1323,7 @@ const COMPRESSED_RED: u32 = u32::MAX;
13231323impl DepNodeColorMap {
13241324 fn new ( size : usize ) -> DepNodeColorMap {
13251325 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 ( ) }
13301327 }
13311328
13321329 #[ inline]
@@ -1345,24 +1342,14 @@ impl DepNodeColorMap {
13451342 index : DepNodeIndex ,
13461343 ) -> Result < ( ) , DepNodeIndex > {
13471344 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) ) ,
13661353 }
13671354 }
13681355
0 commit comments