@@ -596,16 +596,25 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
596
596
return Ok ( layout) ;
597
597
}
598
598
599
- let layout = from_known_layout ( self . tcx , self . param_env , layout, || {
600
- let local_ty = frame. body . local_decls [ local] . ty ;
601
- let local_ty =
602
- self . instantiate_from_frame_and_normalize_erasing_regions ( frame, local_ty) ?;
603
- self . layout_of ( local_ty)
604
- } ) ?;
605
-
606
599
// Layouts of locals are requested a lot, so we cache them.
600
+ let layout = cold ( self , frame, local, layout) ?;
607
601
state. layout . set ( Some ( layout) ) ;
608
- Ok ( layout)
602
+ return Ok ( layout) ;
603
+
604
+ #[ cold]
605
+ fn cold < ' tcx , M : Machine < ' tcx > > (
606
+ this : & InterpCx < ' tcx , M > ,
607
+ frame : & Frame < ' tcx , M :: Provenance , M :: FrameExtra > ,
608
+ local : mir:: Local ,
609
+ layout : Option < TyAndLayout < ' tcx > > ,
610
+ ) -> InterpResult < ' tcx , TyAndLayout < ' tcx > > {
611
+ from_known_layout ( this. tcx , this. param_env , layout, || {
612
+ let local_ty = frame. body . local_decls [ local] . ty ;
613
+ let local_ty =
614
+ this. instantiate_from_frame_and_normalize_erasing_regions ( frame, local_ty) ?;
615
+ this. layout_of ( local_ty)
616
+ } )
617
+ }
609
618
}
610
619
}
611
620
0 commit comments