@@ -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 : tracked_struct_ids. into_boxed_slice ( ) ,
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 : Box < [ ( Identity , Id ) ] > ,
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 ; 8 ] > ( ) ] ;
427+ [ ( ) ; std:: mem:: size_of :: < [ usize ; 7 ] > ( ) ] ;
427428
428429impl QueryRevisions {
429430 pub ( crate ) fn fixpoint_initial ( query : DatabaseKeyIndex ) -> Self {
@@ -507,18 +508,12 @@ impl QueryRevisions {
507508 }
508509
509510 /// Returns a mutable reference to the `IdentityMap` for this query, or `None` if the map is empty.
510- pub fn retain_tracked_struct_ids < F > ( & mut self , f : F )
511- where
512- F : FnMut ( & ( Identity , Id ) ) -> bool ,
513- {
514- let Some ( extra) = self . extra . 0 . as_mut ( ) else {
515- return ;
516- } ;
517-
518- let tracked_struct_ids = std:: mem:: take ( & mut extra. tracked_struct_ids ) ;
519- let mut tracked_struct_ids = tracked_struct_ids. into_vec ( ) ;
520- tracked_struct_ids. retain ( f) ;
521- extra. tracked_struct_ids = tracked_struct_ids. into_boxed_slice ( )
511+ pub fn tracked_struct_ids_mut ( & mut self ) -> Option < & mut ThinVec < ( Identity , Id ) > > {
512+ self . extra
513+ . 0
514+ . as_mut ( )
515+ . map ( |extra| & mut extra. tracked_struct_ids )
516+ . filter ( |tracked_struct_ids| !tracked_struct_ids. is_empty ( ) )
522517 }
523518}
524519
0 commit comments