File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
rustc_monomorphize/src/partitioning Expand file tree Collapse file tree 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> {
318318 base_n:: encode ( hash, base_n:: CASE_INSENSITIVE )
319319 }
320320
321- pub fn estimate_size ( & mut self , tcx : TyCtxt < ' tcx > ) {
321+ pub fn create_size_estimate ( & mut self , tcx : TyCtxt < ' tcx > ) {
322322 // Estimate the size of a codegen unit as (approximately) the number of MIR
323323 // statements it corresponds to.
324324 self . size_estimate = Some ( self . items . keys ( ) . map ( |mi| mi. size_estimate ( tcx) ) . sum ( ) ) ;
325325 }
326326
327327 #[ inline]
328+ /// Should only be called if [`create_size_estimate`] has previously been called.
329+ ///
330+ /// [`create_size_estimate`]: Self::create_size_estimate
328331 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" )
331334 }
332335
333336 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>(
180180 partitioner. place_root_mono_items ( cx, mono_items)
181181 } ;
182182
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) ) ;
184184
185185 debug_dump ( tcx, "INITIAL PARTITIONING:" , initial_partitioning. codegen_units . iter ( ) ) ;
186186
@@ -200,7 +200,7 @@ pub fn partition<'tcx>(
200200 partitioner. place_inlined_mono_items ( cx, initial_partitioning)
201201 } ;
202202
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) ) ;
204204
205205 debug_dump ( tcx, "POST INLINING:" , post_inlining. codegen_units . iter ( ) ) ;
206206
You can’t perform that action at this time.
0 commit comments