@@ -632,11 +632,11 @@ impl Map {
632632 tcx : TyCtxt < ' tcx > ,
633633 body : & Body < ' tcx > ,
634634 filter : impl Fn ( Ty < ' tcx > ) -> bool ,
635- place_limit : Option < usize > ,
635+ value_limit : Option < usize > ,
636636 ) -> Self {
637637 let mut map = Self :: new ( ) ;
638638 let exclude = excluded_locals ( body) ;
639- map. register_with_filter ( tcx, body, filter, exclude, place_limit ) ;
639+ map. register_with_filter ( tcx, body, filter, exclude, value_limit ) ;
640640 debug ! ( "registered {} places ({} nodes in total)" , map. value_count, map. places. len( ) ) ;
641641 map
642642 }
@@ -648,10 +648,11 @@ impl Map {
648648 body : & Body < ' tcx > ,
649649 filter : impl Fn ( Ty < ' tcx > ) -> bool ,
650650 exclude : BitSet < Local > ,
651- place_limit : Option < usize > ,
651+ value_limit : Option < usize > ,
652652 ) {
653- // We use this vector as stack, pushing and popping projections.
654- let mut worklist = VecDeque :: with_capacity ( place_limit. unwrap_or ( body. local_decls . len ( ) ) ) ;
653+ let mut worklist = VecDeque :: with_capacity ( value_limit. unwrap_or ( body. local_decls . len ( ) ) ) ;
654+
655+ // Start by constructing the places for each bare local.
655656 self . locals = IndexVec :: from_elem ( None , & body. local_decls ) ;
656657 for ( local, decl) in body. local_decls . iter_enumerated ( ) {
657658 if exclude. contains ( local) {
@@ -668,8 +669,10 @@ impl Map {
668669 }
669670
670671 // `place.elem1.elem2` with type `ty`.
672+ // `elem1` is either `Some(Variant(i))` or `None`.
671673 while let Some ( ( mut place, elem1, elem2, ty) ) = worklist. pop_front ( ) {
672- if let Some ( place_limit) = place_limit && self . value_count >= place_limit {
674+ // The user requires a bound on the number of created values.
675+ if let Some ( value_limit) = value_limit && self . value_count >= value_limit {
673676 break
674677 }
675678
@@ -688,6 +691,9 @@ impl Map {
688691 self . register_children ( tcx, place, ty, & filter, & mut worklist) ;
689692 }
690693
694+ // Pre-compute the tree of ValueIndex nested in each PlaceIndex.
695+ // `inner_values_buffer[inner_values[place]]` is the set of all the values
696+ // reachable by projecting `place`.
691697 self . inner_values_buffer = Vec :: with_capacity ( self . value_count ) ;
692698 self . inner_values = IndexVec :: from_elem ( 0 ..0 , & self . places ) ;
693699 for local in body. local_decls . indices ( ) {
0 commit comments