@@ -69,32 +69,36 @@ pub(super) fn run_jit(tcx: TyCtxt<'_>) -> ! {
69
69
70
70
let mut cx = crate :: CodegenCx :: new ( tcx, jit_module, false , false ) ;
71
71
72
- let ( mut jit_module, global_asm, _debug, mut unwind_context) =
73
- super :: time ( tcx, "codegen mono items" , || {
74
- super :: predefine_mono_items ( & mut cx, & mono_items) ;
75
- for ( mono_item, ( linkage, visibility) ) in mono_items {
76
- let linkage = crate :: linkage:: get_clif_linkage ( mono_item, linkage, visibility) ;
77
- match mono_item {
78
- MonoItem :: Fn ( inst) => {
79
- cx. tcx . sess . time ( "codegen fn" , || {
80
- crate :: base:: codegen_fn ( & mut cx, inst, linkage)
81
- } ) ;
82
- }
83
- MonoItem :: Static ( def_id) => {
84
- crate :: constant:: codegen_static ( & mut cx. constants_cx , def_id)
85
- }
86
- MonoItem :: GlobalAsm ( hir_id) => {
87
- let item = cx. tcx . hir ( ) . expect_item ( hir_id) ;
88
- tcx. sess
89
- . span_fatal ( item. span , "Global asm is not supported in JIT mode" ) ;
90
- }
72
+ super :: time ( tcx, "codegen mono items" , || {
73
+ super :: predefine_mono_items ( & mut cx, & mono_items) ;
74
+ for ( mono_item, ( linkage, visibility) ) in mono_items {
75
+ let linkage = crate :: linkage:: get_clif_linkage ( mono_item, linkage, visibility) ;
76
+ match mono_item {
77
+ MonoItem :: Fn ( inst) => {
78
+ cx. tcx . sess . time ( "codegen fn" , || {
79
+ crate :: base:: codegen_fn ( & mut cx, inst, linkage)
80
+ } ) ;
81
+ }
82
+ MonoItem :: Static ( def_id) => {
83
+ crate :: constant:: codegen_static ( & mut cx. constants_cx , def_id)
84
+ }
85
+ MonoItem :: GlobalAsm ( hir_id) => {
86
+ let item = cx. tcx . hir ( ) . expect_item ( hir_id) ;
87
+ tcx. sess
88
+ . span_fatal ( item. span , "Global asm is not supported in JIT mode" ) ;
91
89
}
92
90
}
93
- tcx. sess . time ( "finalize CodegenCx" , || cx. finalize ( ) )
94
- } ) ;
91
+ }
92
+ } ) ;
93
+
94
+ let ( mut jit_module, global_asm, _debug, mut unwind_context) =
95
+ tcx. sess . time ( "finalize CodegenCx" , || cx. finalize ( ) ) ;
96
+ jit_module. finalize_definitions ( ) ;
97
+
95
98
if !global_asm. is_empty ( ) {
96
99
tcx. sess . fatal ( "Inline asm is not supported in JIT mode" ) ;
97
100
}
101
+
98
102
crate :: main_shim:: maybe_create_entry_wrapper ( tcx, & mut jit_module, & mut unwind_context, true ) ;
99
103
crate :: allocator:: codegen ( tcx, & mut jit_module, & mut unwind_context) ;
100
104
0 commit comments