Skip to content

[1.11 backport] trace-compile: don't generate precompile statements for OpaqueClosure methods (#55072) #55225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2393,6 +2393,8 @@ static void record_precompile_statement(jl_method_instance_t *mi)
return;
if (!jl_is_method(def))
return;
if (def->is_for_opaque_closure)
return; // OpaqueClosure methods cannot be looked up by their types, so are incompatible with `precompile(...)`

JL_LOCK(&precomp_statement_out_lock);
if (s_precompile == NULL) {
Expand Down Expand Up @@ -2569,7 +2571,7 @@ jl_code_instance_t *jl_compile_method_internal(jl_method_instance_t *mi, size_t
jl_atomic_store_release(&codeinst->invoke, ucache_invoke);
jl_mi_cache_insert(mi, codeinst);
}
else if (did_compile) {
else if (did_compile && codeinst->owner == jl_nothing) {
record_precompile_statement(mi);
}
jl_atomic_store_relaxed(&codeinst->precompile, 1);
Expand Down