@@ -72,7 +72,6 @@ static jl_callptr_t _jl_compile_codeinst(
72
72
73
73
// caller must hold codegen_lock
74
74
// and have disabled finalizers
75
- JL_TIMING (CODEGEN);
76
75
uint64_t start_time = 0 ;
77
76
if (dump_compiles_stream != NULL )
78
77
start_time = jl_hrtime ();
@@ -88,36 +87,39 @@ static jl_callptr_t _jl_compile_codeinst(
88
87
params.cache = true ;
89
88
params.world = world;
90
89
std::map<jl_code_instance_t *, jl_compile_result_t > emitted;
91
- jl_compile_result_t result = jl_emit_codeinst (codeinst, src, params);
92
- if (std::get<0 >(result))
93
- emitted[codeinst] = std::move (result);
94
- jl_compile_workqueue (emitted, params);
95
-
96
- jl_add_to_ee ();
97
- StringMap<std::unique_ptr<Module>*> NewExports;
98
- StringMap<void *> NewGlobals;
99
- for (auto &global : params.globals ) {
100
- NewGlobals[global.second ->getName ()] = global.first ;
101
- }
102
- for (auto &def : emitted) {
103
- std::unique_ptr<Module> &M = std::get<0 >(def.second );
104
- for (auto &F : M->global_objects ()) {
105
- if (!F.isDeclaration () && F.getLinkage () == GlobalValue::ExternalLinkage) {
106
- NewExports[F.getName ()] = &M;
107
- }
90
+ {
91
+ JL_TIMING (CODEGEN);
92
+ jl_compile_result_t result = jl_emit_codeinst (codeinst, src, params);
93
+ if (std::get<0 >(result))
94
+ emitted[codeinst] = std::move (result);
95
+ jl_compile_workqueue (emitted, params);
96
+
97
+ jl_add_to_ee ();
98
+ StringMap<std::unique_ptr<Module>*> NewExports;
99
+ StringMap<void *> NewGlobals;
100
+ for (auto &global : params.globals ) {
101
+ NewGlobals[global.second ->getName ()] = global.first ;
108
102
}
109
- // Let's link all globals here also (for now)
110
- for (auto &GV : M->globals ()) {
111
- auto InitValue = NewGlobals.find (GV.getName ());
112
- if (InitValue != NewGlobals.end ()) {
113
- jl_link_global (&GV, InitValue->second );
103
+ for (auto &def : emitted) {
104
+ std::unique_ptr<Module> &M = std::get<0 >(def.second );
105
+ for (auto &F : M->global_objects ()) {
106
+ if (!F.isDeclaration () && F.getLinkage () == GlobalValue::ExternalLinkage) {
107
+ NewExports[F.getName ()] = &M;
108
+ }
109
+ }
110
+ // Let's link all globals here also (for now)
111
+ for (auto &GV : M->globals ()) {
112
+ auto InitValue = NewGlobals.find (GV.getName ());
113
+ if (InitValue != NewGlobals.end ()) {
114
+ jl_link_global (&GV, InitValue->second );
115
+ }
114
116
}
115
117
}
116
- }
117
- for ( auto &def : emitted) {
118
- // Add the results to the execution engine now
119
- std::unique_ptr<Module> &M = std::get< 0 >(def. second );
120
- jl_add_to_ee (M, NewExports);
118
+ for ( auto &def : emitted) {
119
+ // Add the results to the execution engine now
120
+ std::unique_ptr<Module> &M = std::get< 0 >(def. second );
121
+ jl_add_to_ee (M, NewExports );
122
+ }
121
123
}
122
124
JL_TIMING (LLVM_MODULE_FINISH);
123
125
0 commit comments