@@ -3,6 +3,7 @@ use std::panic::UnwindSafe;
3
3
use std:: ptr:: { self , NonNull } ;
4
4
5
5
use rustc_hash:: FxHashMap ;
6
+ use thin_vec:: ThinVec ;
6
7
use tracing:: debug;
7
8
8
9
use crate :: accumulator:: accumulated_map:: { AccumulatedMap , AtomicInputAccumulatedValues } ;
@@ -371,7 +372,7 @@ impl QueryRevisionsExtra {
371
372
Some ( Box :: new ( QueryRevisionsExtraInner {
372
373
accumulated,
373
374
cycle_heads,
374
- tracked_struct_ids,
375
+ tracked_struct_ids : tracked_struct_ids . into_thin_vec ( ) ,
375
376
iteration,
376
377
} ) )
377
378
} ;
@@ -401,7 +402,7 @@ struct QueryRevisionsExtraInner {
401
402
/// previous revision. To handle this, `diff_outputs` compares
402
403
/// the structs from the old/new revision and retains
403
404
/// only entries that appeared in the new revision.
404
- tracked_struct_ids : IdentityMap ,
405
+ tracked_struct_ids : ThinVec < ( Identity , Id ) > ,
405
406
406
407
/// This result was computed based on provisional values from
407
408
/// these cycle heads. The "cycle head" is the query responsible
@@ -423,7 +424,7 @@ const _: [(); std::mem::size_of::<QueryRevisions>()] = [(); std::mem::size_of::<
423
424
#[ cfg( not( feature = "shuttle" ) ) ]
424
425
#[ cfg( target_pointer_width = "64" ) ]
425
426
const _: [ ( ) ; std:: mem:: size_of :: < QueryRevisionsExtraInner > ( ) ] =
426
- [ ( ) ; std:: mem:: size_of :: < [ usize ; 10 ] > ( ) ] ;
427
+ [ ( ) ; std:: mem:: size_of :: < [ usize ; 7 ] > ( ) ] ;
427
428
428
429
impl QueryRevisions {
429
430
pub ( crate ) fn fixpoint_initial ( query : DatabaseKeyIndex ) -> Self {
@@ -498,16 +499,16 @@ impl QueryRevisions {
498
499
}
499
500
500
501
/// Returns a reference to the `IdentityMap` for this query, or `None` if the map is empty.
501
- pub fn tracked_struct_ids ( & self ) -> Option < & IdentityMap > {
502
+ pub fn tracked_struct_ids ( & self ) -> Option < & [ ( Identity , Id ) ] > {
502
503
self . extra
503
504
. 0
504
505
. as_ref ( )
505
- . map ( |extra| & extra. tracked_struct_ids )
506
+ . map ( |extra| & * extra. tracked_struct_ids )
506
507
. filter ( |tracked_struct_ids| !tracked_struct_ids. is_empty ( ) )
507
508
}
508
509
509
510
/// Returns a mutable reference to the `IdentityMap` for this query, or `None` if the map is empty.
510
- pub fn tracked_struct_ids_mut ( & mut self ) -> Option < & mut IdentityMap > {
511
+ pub fn tracked_struct_ids_mut ( & mut self ) -> Option < & mut ThinVec < ( Identity , Id ) > > {
511
512
self . extra
512
513
. 0
513
514
. as_mut ( )
@@ -859,15 +860,15 @@ pub(crate) struct ActiveQueryGuard<'me> {
859
860
860
861
impl ActiveQueryGuard < ' _ > {
861
862
/// Initialize the tracked struct ids with the values from the prior execution.
862
- pub ( crate ) fn seed_tracked_struct_ids ( & self , tracked_struct_ids : & IdentityMap ) {
863
+ pub ( crate ) fn seed_tracked_struct_ids ( & self , tracked_struct_ids : & [ ( Identity , Id ) ] ) {
863
864
self . local_state . with_query_stack_mut ( |stack| {
864
865
#[ cfg( debug_assertions) ]
865
866
assert_eq ! ( stack. len( ) , self . push_len) ;
866
867
let frame = stack. last_mut ( ) . unwrap ( ) ;
867
868
assert ! ( frame. tracked_struct_ids( ) . is_empty( ) ) ;
868
869
frame
869
870
. tracked_struct_ids_mut ( )
870
- . clone_from ( tracked_struct_ids) ;
871
+ . clone_from_slice ( tracked_struct_ids) ;
871
872
} )
872
873
}
873
874
0 commit comments