Skip to content

Commit d7609d8

Browse files
authored
trace-compile: don't generate precompile statements for OpaqueClosure methods (#55072)
These Methods cannot be looked up via their type signature, so they are incompatible with the `precompile(...)` mechanism.
1 parent 40966f2 commit d7609d8

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
@@ -2523,6 +2523,8 @@ static void record_precompile_statement(jl_method_instance_t *mi, double compila
25232523
return;
25242524
if (!jl_is_method(def))
25252525
return;
2526+
if (def->is_for_opaque_closure)
2527+
return; // OpaqueClosure methods cannot be looked up by their types, so are incompatible with `precompile(...)`
25262528

25272529
JL_LOCK(&precomp_statement_out_lock);
25282530
if (s_precompile == NULL) {
@@ -2702,7 +2704,7 @@ jl_code_instance_t *jl_compile_method_internal(jl_method_instance_t *mi, size_t
27022704
// Something went wrong. Bail to the fallback path.
27032705
codeinst = NULL;
27042706
}
2705-
else if (did_compile) {
2707+
else if (did_compile && codeinst->owner == jl_nothing) {
27062708
record_precompile_statement(mi, compile_time);
27072709
}
27082710
JL_GC_POP();

0 commit comments

Comments
 (0)