@@ -66,7 +66,7 @@ pub struct MarkFrame<'a> {
66
66
parent : Option < & ' a MarkFrame < ' a > > ,
67
67
}
68
68
69
- enum DepNodeColor {
69
+ pub ( super ) enum DepNodeColor {
70
70
Red ,
71
71
Green ( DepNodeIndex ) ,
72
72
}
@@ -140,34 +140,25 @@ impl<D: Deps> DepGraph<D> {
140
140
let colors = DepNodeColorMap :: new ( prev_graph_node_count) ;
141
141
142
142
// Instantiate a dependy-less node only once for anonymous queries.
143
- let _green_node_index = current. alloc_new_node (
143
+ let _green_node_index = current. alloc_node (
144
144
DepNode { kind : D :: DEP_KIND_NULL , hash : current. anon_id_seed . into ( ) } ,
145
145
EdgesVec :: new ( ) ,
146
146
Fingerprint :: ZERO ,
147
147
) ;
148
148
assert_eq ! ( _green_node_index, DepNodeIndex :: SINGLETON_DEPENDENCYLESS_ANON_NODE ) ;
149
149
150
150
// Instantiate a dependy-less red node only once for anonymous queries.
151
- let ( red_node_index, red_node_prev_index_and_color) = current. intern_node (
152
- & prev_graph,
151
+ let red_node_index = current. alloc_node (
153
152
DepNode { kind : D :: DEP_KIND_RED , hash : Fingerprint :: ZERO . into ( ) } ,
154
153
EdgesVec :: new ( ) ,
155
- None ,
154
+ Fingerprint :: ZERO ,
156
155
) ;
157
156
assert_eq ! ( red_node_index, DepNodeIndex :: FOREVER_RED_NODE ) ;
158
- match red_node_prev_index_and_color {
159
- None => {
160
- // This is expected when we have no previous compilation session.
161
- assert ! ( prev_graph_node_count == 0 ) ;
162
- }
163
- Some ( ( prev_red_node_index, DepNodeColor :: Red ) ) => {
164
- assert_eq ! ( prev_red_node_index. as_usize( ) , red_node_index. as_usize( ) ) ;
165
- colors. insert ( prev_red_node_index, DepNodeColor :: Red ) ;
166
- }
167
- Some ( ( _, DepNodeColor :: Green ( _) ) ) => {
168
- // There must be a logic error somewhere if we hit this branch.
169
- panic ! ( "DepNodeIndex::FOREVER_RED_NODE evaluated to DepNodeColor::Green" )
170
- }
157
+ if prev_graph_node_count > 0 {
158
+ colors. insert (
159
+ SerializedDepNodeIndex :: from_u32 ( DepNodeIndex :: FOREVER_RED_NODE . as_u32 ( ) ) ,
160
+ DepNodeColor :: Red ,
161
+ ) ;
171
162
}
172
163
173
164
DepGraph {
@@ -376,8 +367,7 @@ impl<D: Deps> DepGraphData<D> {
376
367
} ;
377
368
378
369
let dcx = cx. dep_context ( ) ;
379
- let dep_node_index =
380
- self . hash_result_and_intern_node ( dcx, key, edges, & result, hash_result) ;
370
+ let dep_node_index = self . hash_result_and_alloc_node ( dcx, key, edges, & result, hash_result) ;
381
371
382
372
( result, dep_node_index)
383
373
}
@@ -447,7 +437,7 @@ impl<D: Deps> DepGraphData<D> {
447
437
// memory impact of this `anon_node_to_index` map remains tolerable, and helps
448
438
// us avoid useless growth of the graph with almost-equivalent nodes.
449
439
self . current . anon_node_to_index . get_or_insert_with ( target_dep_node, || {
450
- self . current . alloc_new_node ( target_dep_node, task_deps, Fingerprint :: ZERO )
440
+ self . current . alloc_node ( target_dep_node, task_deps, Fingerprint :: ZERO )
451
441
} )
452
442
}
453
443
} ;
@@ -456,7 +446,7 @@ impl<D: Deps> DepGraphData<D> {
456
446
}
457
447
458
448
/// Intern the new `DepNode` with the dependencies up-to-now.
459
- fn hash_result_and_intern_node < Ctxt : DepContext < Deps = D > , R > (
449
+ fn hash_result_and_alloc_node < Ctxt : DepContext < Deps = D > , R > (
460
450
& self ,
461
451
cx : & Ctxt ,
462
452
node : DepNode ,
@@ -468,22 +458,8 @@ impl<D: Deps> DepGraphData<D> {
468
458
let current_fingerprint = hash_result. map ( |hash_result| {
469
459
cx. with_stable_hashing_context ( |mut hcx| hash_result ( & mut hcx, result) )
470
460
} ) ;
471
-
472
- // Intern the new `DepNode` with the dependencies up-to-now.
473
- let ( dep_node_index, prev_and_color) =
474
- self . current . intern_node ( & self . previous , node, edges, current_fingerprint) ;
475
-
461
+ let dep_node_index = self . alloc_and_color_node ( node, edges, current_fingerprint) ;
476
462
hashing_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
477
-
478
- if let Some ( ( prev_index, color) ) = prev_and_color {
479
- debug_assert ! (
480
- self . colors. get( prev_index) . is_none( ) ,
481
- "DepGraph::with_task() - Duplicate DepNodeColor insertion for {node:?}" ,
482
- ) ;
483
-
484
- self . colors . insert ( prev_index, color) ;
485
- }
486
-
487
463
dep_node_index
488
464
}
489
465
}
@@ -601,7 +577,7 @@ impl<D: Deps> DepGraph<D> {
601
577
//
602
578
// For sanity, we still check that the loaded stable hash and the new one match.
603
579
if let Some ( prev_index) = data. previous . node_to_index_opt ( & node) {
604
- let dep_node_index = data. current . prev_index_to_index . lock ( ) [ prev_index] ;
580
+ let dep_node_index = data. colors . current ( prev_index) ;
605
581
if let Some ( dep_node_index) = dep_node_index {
606
582
crate :: query:: incremental_verify_ich (
607
583
cx,
@@ -637,7 +613,7 @@ impl<D: Deps> DepGraph<D> {
637
613
}
638
614
} ) ;
639
615
640
- data. hash_result_and_intern_node ( & cx, node, edges, result, hash_result)
616
+ data. hash_result_and_alloc_node ( & cx, node, edges, result, hash_result)
641
617
} else {
642
618
// Incremental compilation is turned off. We just execute the task
643
619
// without tracking. We still provide a dep-node index that uniquely
@@ -655,13 +631,11 @@ impl<D: Deps> DepGraphData<D> {
655
631
msg : impl FnOnce ( ) -> S ,
656
632
) {
657
633
if let Some ( prev_index) = self . previous . node_to_index_opt ( dep_node) {
658
- let current = self . current . prev_index_to_index . lock ( ) [ prev_index] ;
634
+ let current = self . colors . get ( prev_index) ;
659
635
assert ! ( current. is_none( ) , "{}" , msg( ) )
660
- } else if let Some ( nodes_newly_allocated_in_current_session) =
661
- & self . current . nodes_newly_allocated_in_current_session
662
- {
636
+ } else if let Some ( nodes_in_current_session) = & self . current . nodes_in_current_session {
663
637
outline ( || {
664
- let seen = nodes_newly_allocated_in_current_session . lock ( ) . contains_key ( dep_node) ;
638
+ let seen = nodes_in_current_session . lock ( ) . contains_key ( dep_node) ;
665
639
assert ! ( !seen, "{}" , msg( ) ) ;
666
640
} ) ;
667
641
}
@@ -738,15 +712,77 @@ impl<D: Deps> DepGraphData<D> {
738
712
}
739
713
}
740
714
741
- // Promote the previous diagnostics to the current session.
742
- let index = self . current . promote_node_and_deps_to_current ( & self . previous , prev_index) ;
743
- // FIXME: Can this race with a parallel compiler?
744
- qcx. store_side_effect ( index, side_effect) ;
715
+ // Manually recreate the node as `promote_node_and_deps_to_current` expects all
716
+ // green dependencies.
717
+ let dep_node_index = self . current . encoder . send (
718
+ DepNode {
719
+ kind : D :: DEP_KIND_SIDE_EFFECT ,
720
+ hash : PackedFingerprint :: from ( Fingerprint :: ZERO ) ,
721
+ } ,
722
+ Fingerprint :: ZERO ,
723
+ std:: iter:: once ( DepNodeIndex :: FOREVER_RED_NODE ) . collect ( ) ,
724
+ ) ;
725
+ qcx. store_side_effect ( dep_node_index, side_effect) ;
745
726
746
727
// Mark the node as green.
747
- self . colors . insert ( prev_index, DepNodeColor :: Green ( index ) ) ;
728
+ self . colors . insert ( prev_index, DepNodeColor :: Green ( dep_node_index ) ) ;
748
729
} )
749
730
}
731
+
732
+ fn alloc_and_color_node (
733
+ & self ,
734
+ key : DepNode ,
735
+ edges : EdgesVec ,
736
+ fingerprint : Option < Fingerprint > ,
737
+ ) -> DepNodeIndex {
738
+ let dep_node_index =
739
+ self . current . alloc_node ( key, edges, fingerprint. unwrap_or ( Fingerprint :: ZERO ) ) ;
740
+
741
+ if let Some ( prev_index) = self . previous . node_to_index_opt ( & key) {
742
+ // Determine the color and index of the new `DepNode`.
743
+ let color = if let Some ( fingerprint) = fingerprint {
744
+ if fingerprint == self . previous . fingerprint_by_index ( prev_index) {
745
+ // This is a green node: it existed in the previous compilation,
746
+ // its query was re-executed, and it has the same result as before.
747
+ DepNodeColor :: Green ( dep_node_index)
748
+ } else {
749
+ // This is a red node: it existed in the previous compilation, its query
750
+ // was re-executed, but it has a different result from before.
751
+ DepNodeColor :: Red
752
+ }
753
+ } else {
754
+ // This is a red node, effectively: it existed in the previous compilation
755
+ // session, its query was re-executed, but it doesn't compute a result hash
756
+ // (i.e. it represents a `no_hash` query), so we have no way of determining
757
+ // whether or not the result was the same as before.
758
+ DepNodeColor :: Red
759
+ } ;
760
+
761
+ debug_assert ! (
762
+ self . colors. get( prev_index) . is_none( ) ,
763
+ "DepGraph::with_task() - Duplicate DepNodeColor insertion for {key:?}" ,
764
+ ) ;
765
+
766
+ self . colors . insert ( prev_index, color) ;
767
+ }
768
+
769
+ dep_node_index
770
+ }
771
+
772
+ fn promote_node_and_deps_to_current ( & self , prev_index : SerializedDepNodeIndex ) -> DepNodeIndex {
773
+ self . current . debug_assert_not_in_new_nodes ( & self . previous , prev_index) ;
774
+
775
+ let dep_node_index = self . current . encoder . send_promoted ( prev_index, & self . colors ) ;
776
+
777
+ #[ cfg( debug_assertions) ]
778
+ self . current . record_edge (
779
+ dep_node_index,
780
+ self . previous . index_to_node ( prev_index) ,
781
+ self . previous . fingerprint_by_index ( prev_index) ,
782
+ ) ;
783
+
784
+ dep_node_index
785
+ }
750
786
}
751
787
752
788
impl < D : Deps > DepGraph < D > {
@@ -948,14 +984,10 @@ impl<D: Deps> DepGraphData<D> {
948
984
949
985
// We allocating an entry for the node in the current dependency graph and
950
986
// adding all the appropriate edges imported from the previous graph
951
- let dep_node_index =
952
- self . current . promote_node_and_deps_to_current ( & self . previous , prev_dep_node_index) ;
953
-
954
- // ... emitting any stored diagnostic ...
987
+ let dep_node_index = self . promote_node_and_deps_to_current ( prev_dep_node_index) ;
955
988
956
989
// ... and finally storing a "Green" entry in the color map.
957
990
// Multiple threads can all write the same color here
958
- self . colors . insert ( prev_dep_node_index, DepNodeColor :: Green ( dep_node_index) ) ;
959
991
960
992
debug ! ( "successfully marked {dep_node:?} as green" ) ;
961
993
Some ( dep_node_index)
@@ -1106,7 +1138,6 @@ rustc_index::newtype_index! {
1106
1138
/// first, and `data` second.
1107
1139
pub ( super ) struct CurrentDepGraph < D : Deps > {
1108
1140
encoder : GraphEncoder < D > ,
1109
- prev_index_to_index : Lock < IndexVec < SerializedDepNodeIndex , Option < DepNodeIndex > > > ,
1110
1141
anon_node_to_index : ShardedHashMap < DepNode , DepNodeIndex > ,
1111
1142
1112
1143
/// This is used to verify that fingerprints do not change between the creation of a node
@@ -1123,9 +1154,8 @@ pub(super) struct CurrentDepGraph<D: Deps> {
1123
1154
/// This field is only `Some` if the `-Z incremental_verify_ich` option is present
1124
1155
/// or if `debug_assertions` are enabled.
1125
1156
///
1126
- /// The map contains all DepNodes that have been allocated in the current session so far and
1127
- /// for which there is no equivalent in the previous session.
1128
- nodes_newly_allocated_in_current_session : Option < Lock < FxHashMap < DepNode , DepNodeIndex > > > ,
1157
+ /// The map contains all DepNodes that have been allocated in the current session so far.
1158
+ nodes_in_current_session : Option < Lock < FxHashMap < DepNode , DepNodeIndex > > > ,
1129
1159
1130
1160
/// Anonymous `DepNode`s are nodes whose IDs we compute from the list of
1131
1161
/// their edges. This has the beneficial side-effect that multiple anonymous
@@ -1190,13 +1220,12 @@ impl<D: Deps> CurrentDepGraph<D> {
1190
1220
// FIXME: The count estimate is off as anon nodes are only a portion of the nodes.
1191
1221
new_node_count_estimate / sharded:: shards ( ) ,
1192
1222
) ,
1193
- prev_index_to_index : Lock :: new ( IndexVec :: from_elem_n ( None , prev_graph_node_count) ) ,
1194
1223
anon_id_seed,
1195
1224
#[ cfg( debug_assertions) ]
1196
1225
forbidden_edge,
1197
1226
#[ cfg( debug_assertions) ]
1198
1227
fingerprints : Lock :: new ( IndexVec :: from_elem_n ( None , new_node_count_estimate) ) ,
1199
- nodes_newly_allocated_in_current_session : new_node_dbg. then ( || {
1228
+ nodes_in_current_session : new_node_dbg. then ( || {
1200
1229
Lock :: new ( FxHashMap :: with_capacity_and_hasher (
1201
1230
new_node_count_estimate,
1202
1231
Default :: default ( ) ,
@@ -1219,7 +1248,7 @@ impl<D: Deps> CurrentDepGraph<D> {
1219
1248
/// Writes the node to the current dep-graph and allocates a `DepNodeIndex` for it.
1220
1249
/// Assumes that this is a node that has no equivalent in the previous dep-graph.
1221
1250
#[ inline( always) ]
1222
- fn alloc_new_node (
1251
+ fn alloc_node (
1223
1252
& self ,
1224
1253
key : DepNode ,
1225
1254
edges : EdgesVec ,
@@ -1230,15 +1259,9 @@ impl<D: Deps> CurrentDepGraph<D> {
1230
1259
#[ cfg( debug_assertions) ]
1231
1260
self . record_edge ( dep_node_index, key, current_fingerprint) ;
1232
1261
1233
- if let Some ( ref nodes_newly_allocated_in_current_session) =
1234
- self . nodes_newly_allocated_in_current_session
1235
- {
1262
+ if let Some ( ref nodes_in_current_session) = self . nodes_in_current_session {
1236
1263
outline ( || {
1237
- if nodes_newly_allocated_in_current_session
1238
- . lock ( )
1239
- . insert ( key, dep_node_index)
1240
- . is_some ( )
1241
- {
1264
+ if nodes_in_current_session. lock ( ) . insert ( key, dep_node_index) . is_some ( ) {
1242
1265
panic ! ( "Found duplicate dep-node {key:?}" ) ;
1243
1266
}
1244
1267
} ) ;
@@ -1247,102 +1270,20 @@ impl<D: Deps> CurrentDepGraph<D> {
1247
1270
dep_node_index
1248
1271
}
1249
1272
1250
- fn intern_node (
1251
- & self ,
1252
- prev_graph : & SerializedDepGraph ,
1253
- key : DepNode ,
1254
- edges : EdgesVec ,
1255
- fingerprint : Option < Fingerprint > ,
1256
- ) -> ( DepNodeIndex , Option < ( SerializedDepNodeIndex , DepNodeColor ) > ) {
1257
- if let Some ( prev_index) = prev_graph. node_to_index_opt ( & key) {
1258
- let get_dep_node_index = |fingerprint| {
1259
- let mut prev_index_to_index = self . prev_index_to_index . lock ( ) ;
1260
-
1261
- let dep_node_index = match prev_index_to_index[ prev_index] {
1262
- Some ( dep_node_index) => dep_node_index,
1263
- None => {
1264
- let dep_node_index = self . encoder . send ( key, fingerprint, edges) ;
1265
- prev_index_to_index[ prev_index] = Some ( dep_node_index) ;
1266
- dep_node_index
1267
- }
1268
- } ;
1269
-
1270
- #[ cfg( debug_assertions) ]
1271
- self . record_edge ( dep_node_index, key, fingerprint) ;
1272
-
1273
- dep_node_index
1274
- } ;
1275
-
1276
- // Determine the color and index of the new `DepNode`.
1277
- if let Some ( fingerprint) = fingerprint {
1278
- if fingerprint == prev_graph. fingerprint_by_index ( prev_index) {
1279
- // This is a green node: it existed in the previous compilation,
1280
- // its query was re-executed, and it has the same result as before.
1281
- let dep_node_index = get_dep_node_index ( fingerprint) ;
1282
- ( dep_node_index, Some ( ( prev_index, DepNodeColor :: Green ( dep_node_index) ) ) )
1283
- } else {
1284
- // This is a red node: it existed in the previous compilation, its query
1285
- // was re-executed, but it has a different result from before.
1286
- let dep_node_index = get_dep_node_index ( fingerprint) ;
1287
- ( dep_node_index, Some ( ( prev_index, DepNodeColor :: Red ) ) )
1288
- }
1289
- } else {
1290
- // This is a red node, effectively: it existed in the previous compilation
1291
- // session, its query was re-executed, but it doesn't compute a result hash
1292
- // (i.e. it represents a `no_hash` query), so we have no way of determining
1293
- // whether or not the result was the same as before.
1294
- let dep_node_index = get_dep_node_index ( Fingerprint :: ZERO ) ;
1295
- ( dep_node_index, Some ( ( prev_index, DepNodeColor :: Red ) ) )
1296
- }
1297
- } else {
1298
- let fingerprint = fingerprint. unwrap_or ( Fingerprint :: ZERO ) ;
1299
-
1300
- // This is a new node: it didn't exist in the previous compilation session.
1301
- let dep_node_index = self . alloc_new_node ( key, edges, fingerprint) ;
1302
-
1303
- ( dep_node_index, None )
1304
- }
1305
- }
1306
-
1307
- fn promote_node_and_deps_to_current (
1308
- & self ,
1309
- prev_graph : & SerializedDepGraph ,
1310
- prev_index : SerializedDepNodeIndex ,
1311
- ) -> DepNodeIndex {
1312
- self . debug_assert_not_in_new_nodes ( prev_graph, prev_index) ;
1313
-
1314
- let mut prev_index_to_index = self . prev_index_to_index . lock ( ) ;
1315
-
1316
- match prev_index_to_index[ prev_index] {
1317
- Some ( dep_node_index) => dep_node_index,
1318
- None => {
1319
- let dep_node_index = self . encoder . send_promoted ( prev_index, & * prev_index_to_index) ;
1320
- prev_index_to_index[ prev_index] = Some ( dep_node_index) ;
1321
- #[ cfg( debug_assertions) ]
1322
- self . record_edge (
1323
- dep_node_index,
1324
- prev_graph. index_to_node ( prev_index) ,
1325
- prev_graph. fingerprint_by_index ( prev_index) ,
1326
- ) ;
1327
- dep_node_index
1328
- }
1329
- }
1330
- }
1331
-
1332
1273
#[ inline]
1333
1274
fn debug_assert_not_in_new_nodes (
1334
1275
& self ,
1335
1276
prev_graph : & SerializedDepGraph ,
1336
1277
prev_index : SerializedDepNodeIndex ,
1337
1278
) {
1338
- let node = & prev_graph . index_to_node ( prev_index ) ;
1339
- debug_assert ! (
1340
- ! self
1341
- . nodes_newly_allocated_in_current_session
1342
- . as_ref ( )
1343
- . map_or ( false , |set| set . lock ( ) . contains_key ( node) ) ,
1344
- "node from previous graph present in new node collection"
1345
- ) ;
1279
+ if let Some ( ref nodes_in_current_session ) = self . nodes_in_current_session {
1280
+ debug_assert ! (
1281
+ !nodes_in_current_session
1282
+ . lock ( )
1283
+ . contains_key ( & prev_graph . index_to_node ( prev_index ) ) ,
1284
+ "node from previous graph present in new node collection"
1285
+ ) ;
1286
+ }
1346
1287
}
1347
1288
}
1348
1289
@@ -1389,36 +1330,40 @@ impl Default for TaskDeps {
1389
1330
}
1390
1331
// A data structure that stores Option<DepNodeColor> values as a contiguous
1391
1332
// array, using one u32 per entry.
1392
- struct DepNodeColorMap {
1333
+ pub ( super ) struct DepNodeColorMap {
1393
1334
values : IndexVec < SerializedDepNodeIndex , AtomicU32 > ,
1394
1335
}
1395
1336
1396
- const COMPRESSED_NONE : u32 = 0 ;
1397
- const COMPRESSED_RED : u32 = 1 ;
1398
- const COMPRESSED_FIRST_GREEN : u32 = 2 ;
1337
+ const COMPRESSED_NONE : u32 = u32:: MAX ;
1338
+ const COMPRESSED_RED : u32 = u32:: MAX - 1 ;
1399
1339
1400
1340
impl DepNodeColorMap {
1401
1341
fn new ( size : usize ) -> DepNodeColorMap {
1342
+ debug_assert ! ( COMPRESSED_RED > DepNodeIndex :: MAX_AS_U32 ) ;
1402
1343
DepNodeColorMap { values : ( 0 ..size) . map ( |_| AtomicU32 :: new ( COMPRESSED_NONE ) ) . collect ( ) }
1403
1344
}
1404
1345
1405
1346
#[ inline]
1406
- fn get ( & self , index : SerializedDepNodeIndex ) -> Option < DepNodeColor > {
1347
+ pub ( super ) fn current ( & self , index : SerializedDepNodeIndex ) -> Option < DepNodeIndex > {
1348
+ let value = self . values [ index] . load ( Ordering :: Relaxed ) ;
1349
+ if value <= DepNodeIndex :: MAX_AS_U32 { Some ( DepNodeIndex :: from_u32 ( value) ) } else { None }
1350
+ }
1351
+
1352
+ #[ inline]
1353
+ pub ( super ) fn get ( & self , index : SerializedDepNodeIndex ) -> Option < DepNodeColor > {
1407
1354
match self . values [ index] . load ( Ordering :: Acquire ) {
1408
1355
COMPRESSED_NONE => None ,
1409
1356
COMPRESSED_RED => Some ( DepNodeColor :: Red ) ,
1410
- value => {
1411
- Some ( DepNodeColor :: Green ( DepNodeIndex :: from_u32 ( value - COMPRESSED_FIRST_GREEN ) ) )
1412
- }
1357
+ value => Some ( DepNodeColor :: Green ( DepNodeIndex :: from_u32 ( value) ) ) ,
1413
1358
}
1414
1359
}
1415
1360
1416
1361
#[ inline]
1417
- fn insert ( & self , index : SerializedDepNodeIndex , color : DepNodeColor ) {
1362
+ pub ( super ) fn insert ( & self , index : SerializedDepNodeIndex , color : DepNodeColor ) {
1418
1363
self . values [ index] . store (
1419
1364
match color {
1420
1365
DepNodeColor :: Red => COMPRESSED_RED ,
1421
- DepNodeColor :: Green ( index) => index. as_u32 ( ) + COMPRESSED_FIRST_GREEN ,
1366
+ DepNodeColor :: Green ( index) => index. as_u32 ( ) ,
1422
1367
} ,
1423
1368
Ordering :: Release ,
1424
1369
)
@@ -1454,16 +1399,16 @@ fn panic_on_forbidden_read<D: Deps>(data: &DepGraphData<D>, dep_node_index: DepN
1454
1399
let mut dep_node = None ;
1455
1400
1456
1401
// First try to find the dep node among those that already existed in the
1457
- // previous session
1458
- for ( prev_index, index ) in data. current . prev_index_to_index . lock ( ) . iter_enumerated ( ) {
1459
- if index == & Some ( dep_node_index) {
1402
+ // previous session and has been marked green
1403
+ for prev_index in data. colors . values . indices ( ) {
1404
+ if data . colors . current ( prev_index ) == Some ( dep_node_index) {
1460
1405
dep_node = Some ( data. previous . index_to_node ( prev_index) ) ;
1461
1406
break ;
1462
1407
}
1463
1408
}
1464
1409
1465
1410
if dep_node. is_none ( )
1466
- && let Some ( nodes) = & data. current . nodes_newly_allocated_in_current_session
1411
+ && let Some ( nodes) = & data. current . nodes_in_current_session
1467
1412
{
1468
1413
// Try to find it among the nodes allocated so far in this session
1469
1414
if let Some ( ( node, _) ) = nodes. lock ( ) . iter ( ) . find ( |& ( _, index) | * index == dep_node_index) {
0 commit comments