@@ -38,7 +38,7 @@ pub(crate) enum RegionElement {
38
38
/// an interval matrix storing liveness ranges for each region-vid.
39
39
pub ( crate ) struct LivenessValues {
40
40
/// The map from locations to points.
41
- elements : Rc < DenseLocationMap > ,
41
+ location_map : Rc < DenseLocationMap > ,
42
42
43
43
/// Which regions are live. This is exclusive with the fine-grained tracking in `points`, and
44
44
/// currently only used for validating promoteds (which don't care about more precise tracking).
@@ -77,11 +77,11 @@ impl LiveLoans {
77
77
78
78
impl LivenessValues {
79
79
/// Create an empty map of regions to locations where they're live.
80
- pub ( crate ) fn with_specific_points ( elements : Rc < DenseLocationMap > ) -> Self {
80
+ pub ( crate ) fn with_specific_points ( location_map : Rc < DenseLocationMap > ) -> Self {
81
81
LivenessValues {
82
82
live_regions : None ,
83
- points : Some ( SparseIntervalMatrix :: new ( elements . num_points ( ) ) ) ,
84
- elements ,
83
+ points : Some ( SparseIntervalMatrix :: new ( location_map . num_points ( ) ) ) ,
84
+ location_map ,
85
85
loans : None ,
86
86
}
87
87
}
@@ -90,11 +90,11 @@ impl LivenessValues {
90
90
///
91
91
/// Unlike `with_specific_points`, does not track exact locations where something is live, only
92
92
/// which regions are live.
93
- pub ( crate ) fn without_specific_points ( elements : Rc < DenseLocationMap > ) -> Self {
93
+ pub ( crate ) fn without_specific_points ( location_map : Rc < DenseLocationMap > ) -> Self {
94
94
LivenessValues {
95
95
live_regions : Some ( Default :: default ( ) ) ,
96
96
points : None ,
97
- elements ,
97
+ location_map ,
98
98
loans : None ,
99
99
}
100
100
}
@@ -122,11 +122,11 @@ impl LivenessValues {
122
122
123
123
/// Records `region` as being live at the given `location`.
124
124
pub ( crate ) fn add_location ( & mut self , region : RegionVid , location : Location ) {
125
- let point = self . elements . point_from_location ( location) ;
125
+ let point = self . location_map . point_from_location ( location) ;
126
126
debug ! ( "LivenessValues::add_location(region={:?}, location={:?})" , region, location) ;
127
127
if let Some ( points) = & mut self . points {
128
128
points. insert ( region, point) ;
129
- } else if self . elements . point_in_range ( point) {
129
+ } else if self . location_map . point_in_range ( point) {
130
130
self . live_regions . as_mut ( ) . unwrap ( ) . insert ( region) ;
131
131
}
132
132
@@ -143,7 +143,7 @@ impl LivenessValues {
143
143
debug ! ( "LivenessValues::add_points(region={:?}, points={:?})" , region, points) ;
144
144
if let Some ( this) = & mut self . points {
145
145
this. union_row ( region, points) ;
146
- } else if points. iter ( ) . any ( |point| self . elements . point_in_range ( point) ) {
146
+ } else if points. iter ( ) . any ( |point| self . location_map . point_in_range ( point) ) {
147
147
self . live_regions . as_mut ( ) . unwrap ( ) . insert ( region) ;
148
148
}
149
149
@@ -170,7 +170,7 @@ impl LivenessValues {
170
170
171
171
/// Returns whether `region` is marked live at the given `location`.
172
172
pub ( crate ) fn is_live_at ( & self , region : RegionVid , location : Location ) -> bool {
173
- let point = self . elements . point_from_location ( location) ;
173
+ let point = self . location_map . point_from_location ( location) ;
174
174
if let Some ( points) = & self . points {
175
175
points. row ( region) . is_some_and ( |r| r. contains ( point) )
176
176
} else {
@@ -191,25 +191,26 @@ impl LivenessValues {
191
191
. row ( region)
192
192
. into_iter ( )
193
193
. flat_map ( |set| set. iter ( ) )
194
- . take_while ( |& p| self . elements . point_in_range ( p) )
194
+ . take_while ( |& p| self . location_map . point_in_range ( p) )
195
195
}
196
196
197
197
/// For debugging purposes, returns a pretty-printed string of the points where the `region` is
198
198
/// live.
199
199
pub ( crate ) fn pretty_print_live_points ( & self , region : RegionVid ) -> String {
200
200
pretty_print_region_elements (
201
- self . live_points ( region) . map ( |p| RegionElement :: Location ( self . elements . to_location ( p) ) ) ,
201
+ self . live_points ( region)
202
+ . map ( |p| RegionElement :: Location ( self . location_map . to_location ( p) ) ) ,
202
203
)
203
204
}
204
205
205
206
#[ inline]
206
207
pub ( crate ) fn point_from_location ( & self , location : Location ) -> PointIndex {
207
- self . elements . point_from_location ( location)
208
+ self . location_map . point_from_location ( location)
208
209
}
209
210
210
211
#[ inline]
211
212
pub ( crate ) fn location_from_point ( & self , point : PointIndex ) -> Location {
212
- self . elements . to_location ( point)
213
+ self . location_map . to_location ( point)
213
214
}
214
215
215
216
/// When using `-Zpolonius=next`, returns whether the `loan_idx` is live at the given `point`.
@@ -272,7 +273,7 @@ impl PlaceholderIndices {
272
273
/// because (since it is returned) it must live for at least `'a`. But
273
274
/// it would also contain various points from within the function.
274
275
pub ( crate ) struct RegionValues < N : Idx > {
275
- elements : Rc < DenseLocationMap > ,
276
+ location_map : Rc < DenseLocationMap > ,
276
277
placeholder_indices : PlaceholderIndices ,
277
278
points : SparseIntervalMatrix < N , PointIndex > ,
278
279
free_regions : SparseBitMatrix < N , RegionVid > ,
@@ -287,14 +288,14 @@ impl<N: Idx> RegionValues<N> {
287
288
/// Each of the regions in num_region_variables will be initialized with an
288
289
/// empty set of points and no causal information.
289
290
pub ( crate ) fn new (
290
- elements : Rc < DenseLocationMap > ,
291
+ location_map : Rc < DenseLocationMap > ,
291
292
num_universal_regions : usize ,
292
293
placeholder_indices : PlaceholderIndices ,
293
294
) -> Self {
294
- let num_points = elements . num_points ( ) ;
295
+ let num_points = location_map . num_points ( ) ;
295
296
let num_placeholders = placeholder_indices. len ( ) ;
296
297
Self {
297
- elements ,
298
+ location_map ,
298
299
points : SparseIntervalMatrix :: new ( num_points) ,
299
300
placeholder_indices,
300
301
free_regions : SparseBitMatrix :: new ( num_universal_regions) ,
@@ -336,7 +337,7 @@ impl<N: Idx> RegionValues<N> {
336
337
end : usize ,
337
338
) -> Option < usize > {
338
339
let row = self . points . row ( r) ?;
339
- let block = self . elements . entry_point ( block) ;
340
+ let block = self . location_map . entry_point ( block) ;
340
341
let start = block. plus ( start) ;
341
342
let end = block. plus ( end) ;
342
343
let first_unset = row. first_unset_in ( start..=end) ?;
@@ -375,8 +376,8 @@ impl<N: Idx> RegionValues<N> {
375
376
pub ( crate ) fn locations_outlived_by < ' a > ( & ' a self , r : N ) -> impl Iterator < Item = Location > + ' a {
376
377
self . points . row ( r) . into_iter ( ) . flat_map ( move |set| {
377
378
set. iter ( )
378
- . take_while ( move |& p| self . elements . point_in_range ( p) )
379
- . map ( move |p| self . elements . to_location ( p) )
379
+ . take_while ( move |& p| self . location_map . point_in_range ( p) )
380
+ . map ( move |p| self . location_map . to_location ( p) )
380
381
} )
381
382
}
382
383
@@ -430,12 +431,12 @@ pub(crate) trait ToElementIndex: Debug + Copy {
430
431
431
432
impl ToElementIndex for Location {
432
433
fn add_to_row < N : Idx > ( self , values : & mut RegionValues < N > , row : N ) -> bool {
433
- let index = values. elements . point_from_location ( self ) ;
434
+ let index = values. location_map . point_from_location ( self ) ;
434
435
values. points . insert ( row, index)
435
436
}
436
437
437
438
fn contained_in_row < N : Idx > ( self , values : & RegionValues < N > , row : N ) -> bool {
438
- let index = values. elements . point_from_location ( self ) ;
439
+ let index = values. location_map . point_from_location ( self ) ;
439
440
values. points . contains ( row, index)
440
441
}
441
442
}
@@ -464,14 +465,14 @@ impl ToElementIndex for ty::PlaceholderRegion {
464
465
465
466
/// For debugging purposes, returns a pretty-printed string of the given points.
466
467
pub ( crate ) fn pretty_print_points (
467
- elements : & DenseLocationMap ,
468
+ location_map : & DenseLocationMap ,
468
469
points : impl IntoIterator < Item = PointIndex > ,
469
470
) -> String {
470
471
pretty_print_region_elements (
471
472
points
472
473
. into_iter ( )
473
- . take_while ( |& p| elements . point_in_range ( p) )
474
- . map ( |p| elements . to_location ( p) )
474
+ . take_while ( |& p| location_map . point_in_range ( p) )
475
+ . map ( |p| location_map . to_location ( p) )
475
476
. map ( RegionElement :: Location ) ,
476
477
)
477
478
}
0 commit comments