@@ -658,10 +658,29 @@ pub(crate) fn run_aot(
658
658
modules
659
659
} ) ;
660
660
661
+ let allocator_module = emit_allocator_module ( tcx, & backend_config) ;
662
+
663
+ let metadata_module =
664
+ if need_metadata_module { Some ( emit_metadata_module ( tcx, & metadata) ) } else { None } ;
665
+
666
+ Box :: new ( OngoingCodegen {
667
+ modules,
668
+ allocator_module,
669
+ metadata_module,
670
+ metadata,
671
+ crate_info : CrateInfo :: new ( tcx, target_cpu) ,
672
+ concurrency_limiter : concurrency_limiter. 0 ,
673
+ } )
674
+ }
675
+
676
+ fn emit_allocator_module (
677
+ tcx : TyCtxt < ' _ > ,
678
+ backend_config : & BackendConfig ,
679
+ ) -> Option < CompiledModule > {
661
680
let mut allocator_module = make_module ( tcx. sess , & backend_config, "allocator_shim" . to_string ( ) ) ;
662
681
let created_alloc_shim = crate :: allocator:: codegen ( tcx, & mut allocator_module) ;
663
682
664
- let allocator_module = if created_alloc_shim {
683
+ if created_alloc_shim {
665
684
let product = allocator_module. finish ( ) ;
666
685
667
686
match emit_module (
@@ -677,19 +696,7 @@ pub(crate) fn run_aot(
677
696
}
678
697
} else {
679
698
None
680
- } ;
681
-
682
- let metadata_module =
683
- if need_metadata_module { Some ( emit_metadata_module ( tcx, & metadata) ) } else { None } ;
684
-
685
- Box :: new ( OngoingCodegen {
686
- modules,
687
- allocator_module,
688
- metadata_module,
689
- metadata,
690
- crate_info : CrateInfo :: new ( tcx, target_cpu) ,
691
- concurrency_limiter : concurrency_limiter. 0 ,
692
- } )
699
+ }
693
700
}
694
701
695
702
fn emit_metadata_module ( tcx : TyCtxt < ' _ > , metadata : & EncodedMetadata ) -> CompiledModule {
0 commit comments