File tree 2 files changed +8
-5
lines changed
rustc_monomorphize/src/partitioning
2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -318,16 +318,19 @@ impl<'tcx> CodegenUnit<'tcx> {
318
318
base_n:: encode ( hash, base_n:: CASE_INSENSITIVE )
319
319
}
320
320
321
- pub fn estimate_size ( & mut self , tcx : TyCtxt < ' tcx > ) {
321
+ pub fn create_size_estimate ( & mut self , tcx : TyCtxt < ' tcx > ) {
322
322
// Estimate the size of a codegen unit as (approximately) the number of MIR
323
323
// statements it corresponds to.
324
324
self . size_estimate = Some ( self . items . keys ( ) . map ( |mi| mi. size_estimate ( tcx) ) . sum ( ) ) ;
325
325
}
326
326
327
327
#[ inline]
328
+ /// Should only be called if [`create_size_estimate`] has previously been called.
329
+ ///
330
+ /// [`create_size_estimate`]: Self::create_size_estimate
328
331
pub fn size_estimate ( & self ) -> usize {
329
- // Should only be called if `estimate_size` has previously been called.
330
- self . size_estimate . expect ( "estimate_size must be called before getting a size_estimate" )
332
+ self . size_estimate
333
+ . expect ( "create_size_estimate must be called before getting a size_estimate" )
331
334
}
332
335
333
336
pub fn modify_size_estimate ( & mut self , delta : usize ) {
Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ pub fn partition<'tcx>(
180
180
partitioner. place_root_mono_items ( cx, mono_items)
181
181
} ;
182
182
183
- initial_partitioning. codegen_units . iter_mut ( ) . for_each ( |cgu| cgu. estimate_size ( tcx) ) ;
183
+ initial_partitioning. codegen_units . iter_mut ( ) . for_each ( |cgu| cgu. create_size_estimate ( tcx) ) ;
184
184
185
185
debug_dump ( tcx, "INITIAL PARTITIONING:" , initial_partitioning. codegen_units . iter ( ) ) ;
186
186
@@ -200,7 +200,7 @@ pub fn partition<'tcx>(
200
200
partitioner. place_inlined_mono_items ( cx, initial_partitioning)
201
201
} ;
202
202
203
- post_inlining. codegen_units . iter_mut ( ) . for_each ( |cgu| cgu. estimate_size ( tcx) ) ;
203
+ post_inlining. codegen_units . iter_mut ( ) . for_each ( |cgu| cgu. create_size_estimate ( tcx) ) ;
204
204
205
205
debug_dump ( tcx, "POST INLINING:" , post_inlining. codegen_units . iter ( ) ) ;
206
206
You can’t perform that action at this time.
0 commit comments