Skip to content

Commit 56c7c58

Browse files
Don't report only-inferred methods as recompiles (#56914)
(cherry picked from commit 6e28217)
1 parent 568b192 commit 56c7c58

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/jitlayers.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,15 @@ jl_code_instance_t *jl_generate_fptr_impl(jl_method_instance_t *mi JL_PROPAGATES
493493
}
494494
else {
495495
// identify whether this is an invalidated method that is being recompiled
496-
is_recompile = jl_atomic_load_relaxed(&mi->cache) != NULL;
496+
// Is a recompile if there is cached code, and it was compiled (not only inferred) before
497+
jl_code_instance_t *codeinst_old = jl_atomic_load_relaxed(&mi->cache);
498+
while (codeinst_old != NULL) {
499+
if (jl_atomic_load_relaxed(&codeinst_old->invoke) != NULL) {
500+
is_recompile = 1;
501+
break;
502+
}
503+
codeinst_old = jl_atomic_load_relaxed(&codeinst_old->next);
504+
}
497505
}
498506
if (src == NULL && jl_is_method(mi->def.method) &&
499507
jl_symbol_name(mi->def.method->name)[0] != '@') {

0 commit comments

Comments
 (0)