Skip to content

Commit 9498b7f

Browse files
authored
fix ENABLE_TIMINGS after codegen refactoring (JuliaLang#35401)
1 parent 726c8d2 commit 9498b7f

File tree

1 file changed

+30
-28
lines changed

1 file changed

+30
-28
lines changed

src/jitlayers.cpp

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ static jl_callptr_t _jl_compile_codeinst(
7272

7373
// caller must hold codegen_lock
7474
// and have disabled finalizers
75-
JL_TIMING(CODEGEN);
7675
uint64_t start_time = 0;
7776
if (dump_compiles_stream != NULL)
7877
start_time = jl_hrtime();
@@ -88,36 +87,39 @@ static jl_callptr_t _jl_compile_codeinst(
8887
params.cache = true;
8988
params.world = world;
9089
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;
108102
}
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+
}
114116
}
115117
}
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+
}
121123
}
122124
JL_TIMING(LLVM_MODULE_FINISH);
123125

0 commit comments

Comments
 (0)