@@ -604,40 +604,41 @@ pub(crate) fn run_aot(
604
604
605
605
let global_asm_config = Arc :: new ( crate :: global_asm:: GlobalAsmConfig :: new ( tcx) ) ;
606
606
607
- let mut concurrency_limiter = ConcurrencyLimiter :: new ( tcx. sess , cgus. len ( ) ) ;
608
-
609
- let modules = tcx. sess . time ( "codegen mono items" , || {
610
- cgus. iter ( )
611
- . enumerate ( )
612
- . map ( |( i, cgu) | {
613
- let cgu_reuse =
614
- if backend_config. disable_incr_cache { CguReuse :: No } else { cgu_reuse[ i] } ;
615
- match cgu_reuse {
616
- CguReuse :: No => {
617
- let dep_node = cgu. codegen_dep_node ( tcx) ;
618
- tcx. dep_graph
619
- . with_task (
620
- dep_node,
621
- tcx,
622
- (
623
- backend_config. clone ( ) ,
624
- global_asm_config. clone ( ) ,
625
- cgu. name ( ) ,
626
- concurrency_limiter. acquire ( tcx. dcx ( ) ) ,
627
- ) ,
628
- module_codegen,
629
- Some ( rustc_middle:: dep_graph:: hash_result) ,
630
- )
631
- . 0
632
- }
633
- CguReuse :: PreLto | CguReuse :: PostLto => {
634
- concurrency_limiter. job_already_done ( ) ;
635
- OngoingModuleCodegen :: Sync ( reuse_workproduct_for_cgu ( tcx, cgu) )
636
- }
637
- }
638
- } )
639
- . collect :: < Vec < _ > > ( )
640
- } ) ;
607
+ let ( todo_cgus, done_cgus) =
608
+ cgus. into_iter ( ) . enumerate ( ) . partition :: < Vec < _ > , _ > ( |& ( i, _) | match cgu_reuse[ i] {
609
+ _ if backend_config. disable_incr_cache => true ,
610
+ CguReuse :: No => true ,
611
+ CguReuse :: PreLto | CguReuse :: PostLto => false ,
612
+ } ) ;
613
+
614
+ let mut concurrency_limiter = ConcurrencyLimiter :: new ( tcx. sess , todo_cgus. len ( ) ) ;
615
+
616
+ let modules =
617
+ tcx. sess . time ( "codegen mono items" , || {
618
+ todo_cgus
619
+ . into_iter ( )
620
+ . map ( |( _, cgu) | {
621
+ let dep_node = cgu. codegen_dep_node ( tcx) ;
622
+ tcx. dep_graph
623
+ . with_task (
624
+ dep_node,
625
+ tcx,
626
+ (
627
+ backend_config. clone ( ) ,
628
+ global_asm_config. clone ( ) ,
629
+ cgu. name ( ) ,
630
+ concurrency_limiter. acquire ( tcx. dcx ( ) ) ,
631
+ ) ,
632
+ module_codegen,
633
+ Some ( rustc_middle:: dep_graph:: hash_result) ,
634
+ )
635
+ . 0
636
+ } )
637
+ . chain ( done_cgus. into_iter ( ) . map ( |( _, cgu) | {
638
+ OngoingModuleCodegen :: Sync ( reuse_workproduct_for_cgu ( tcx, cgu) )
639
+ } ) )
640
+ . collect :: < Vec < _ > > ( )
641
+ } ) ;
641
642
642
643
let mut allocator_module = make_module ( tcx. sess , & backend_config, "allocator_shim" . to_string ( ) ) ;
643
644
let mut allocator_unwind_context = UnwindContext :: new ( allocator_module. isa ( ) , true ) ;
0 commit comments