@@ -3,6 +3,7 @@ use std::panic::UnwindSafe;
33use std:: ptr:: { self , NonNull } ;
44
55use rustc_hash:: FxHashMap ;
6+ use thin_vec:: ThinVec ;
67use tracing:: debug;
78
89use crate :: accumulator:: accumulated_map:: { AccumulatedMap , AtomicInputAccumulatedValues } ;
@@ -371,7 +372,7 @@ impl QueryRevisionsExtra {
371372 Some ( Box :: new ( QueryRevisionsExtraInner {
372373 accumulated,
373374 cycle_heads,
374- tracked_struct_ids,
375+ tracked_struct_ids : tracked_struct_ids . into_thin_vec ( ) ,
375376 iteration,
376377 } ) )
377378 } ;
@@ -401,7 +402,7 @@ struct QueryRevisionsExtraInner {
401402 /// previous revision. To handle this, `diff_outputs` compares
402403 /// the structs from the old/new revision and retains
403404 /// only entries that appeared in the new revision.
404- tracked_struct_ids : IdentityMap ,
405+ tracked_struct_ids : ThinVec < ( Identity , Id ) > ,
405406
406407 /// This result was computed based on provisional values from
407408 /// these cycle heads. The "cycle head" is the query responsible
@@ -423,7 +424,7 @@ const _: [(); std::mem::size_of::<QueryRevisions>()] = [(); std::mem::size_of::<
423424#[ cfg( not( feature = "shuttle" ) ) ]
424425#[ cfg( target_pointer_width = "64" ) ]
425426const _: [ ( ) ; std:: mem:: size_of :: < QueryRevisionsExtraInner > ( ) ] =
426- [ ( ) ; std:: mem:: size_of :: < [ usize ; 10 ] > ( ) ] ;
427+ [ ( ) ; std:: mem:: size_of :: < [ usize ; 7 ] > ( ) ] ;
427428
428429impl QueryRevisions {
429430 pub ( crate ) fn fixpoint_initial ( query : DatabaseKeyIndex ) -> Self {
@@ -498,16 +499,16 @@ impl QueryRevisions {
498499 }
499500
500501 /// 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 ) ] > {
502503 self . extra
503504 . 0
504505 . as_ref ( )
505- . map ( |extra| & extra. tracked_struct_ids )
506+ . map ( |extra| & * extra. tracked_struct_ids )
506507 . filter ( |tracked_struct_ids| !tracked_struct_ids. is_empty ( ) )
507508 }
508509
509510 /// 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 ) > > {
511512 self . extra
512513 . 0
513514 . as_mut ( )
@@ -859,15 +860,15 @@ pub(crate) struct ActiveQueryGuard<'me> {
859860
860861impl ActiveQueryGuard < ' _ > {
861862 /// 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 ) ] ) {
863864 self . local_state . with_query_stack_mut ( |stack| {
864865 #[ cfg( debug_assertions) ]
865866 assert_eq ! ( stack. len( ) , self . push_len) ;
866867 let frame = stack. last_mut ( ) . unwrap ( ) ;
867868 assert ! ( frame. tracked_struct_ids( ) . is_empty( ) ) ;
868869 frame
869870 . tracked_struct_ids_mut ( )
870- . clone_from ( tracked_struct_ids) ;
871+ . clone_from_slice ( tracked_struct_ids) ;
871872 } )
872873 }
873874
0 commit comments