Skip to content

Commit 46e4740

Browse files
authored
[1.11 backport] trace-compile: don't generate precompile statements for OpaqueClosure methods (#55072) (#55225)
These Methods cannot be looked up via their type signature, so they are incompatible with the `precompile(...)` mechanism.
1 parent 3a35aec commit 46e4740

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/gf.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2393,6 +2393,8 @@ static void record_precompile_statement(jl_method_instance_t *mi)
23932393
return;
23942394
if (!jl_is_method(def))
23952395
return;
2396+
if (def->is_for_opaque_closure)
2397+
return; // OpaqueClosure methods cannot be looked up by their types, so are incompatible with `precompile(...)`
23962398

23972399
JL_LOCK(&precomp_statement_out_lock);
23982400
if (s_precompile == NULL) {
@@ -2569,7 +2571,7 @@ jl_code_instance_t *jl_compile_method_internal(jl_method_instance_t *mi, size_t
25692571
jl_atomic_store_release(&codeinst->invoke, ucache_invoke);
25702572
jl_mi_cache_insert(mi, codeinst);
25712573
}
2572-
else if (did_compile) {
2574+
else if (did_compile && codeinst->owner == jl_nothing) {
25732575
record_precompile_statement(mi);
25742576
}
25752577
jl_atomic_store_relaxed(&codeinst->precompile, 1);

0 commit comments

Comments
 (0)