Skip to content
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

fix #47662, broken --compile=all on 1.8.x #47678

Merged
merged 1 commit into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
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
17 changes: 13 additions & 4 deletions src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1951,13 +1951,22 @@ JL_DLLEXPORT jl_value_t *jl_matching_methods(jl_tupletype_t *types, jl_value_t *
return ml_matches((jl_methtable_t*)mt, types, lim, include_ambiguous, 1, world, 1, min_valid, max_valid, ambig);
}

jl_method_instance_t *jl_get_unspecialized(jl_method_instance_t *method JL_PROPAGATES_ROOT)
jl_method_instance_t *jl_get_unspecialized_from_mi(jl_method_instance_t *method JL_PROPAGATES_ROOT)
{
// one unspecialized version of a function can be shared among all cached specializations
jl_method_t *def = method->def.method;
jl_method_instance_t *mi = jl_get_unspecialized(def);
if (mi == NULL) {
return method;
}
return mi;
}

jl_method_instance_t *jl_get_unspecialized(jl_method_t *def JL_PROPAGATES_ROOT)
{
// one unspecialized version of a function can be shared among all cached specializations
if (!jl_is_method(def) || def->source == NULL) {
// generated functions might instead randomly just never get inferred, sorry
return method;
return NULL;
}
if (def->unspecialized == NULL) {
JL_LOCK(&def->writelock);
Expand Down Expand Up @@ -2078,7 +2087,7 @@ jl_code_instance_t *jl_compile_method_internal(jl_method_instance_t *mi, size_t

codeinst = jl_generate_fptr(mi, world);
if (!codeinst) {
jl_method_instance_t *unspec = jl_get_unspecialized(mi);
jl_method_instance_t *unspec = jl_get_unspecialized_from_mi(mi);
jl_code_instance_t *ucache = jl_get_method_inferred(unspec, (jl_value_t*)jl_any_type, 1, ~(size_t)0);
// ask codegen to make the fptr for unspec
if (jl_atomic_load_relaxed(&ucache->invoke) == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ void jl_generate_fptr_for_unspecialized(jl_code_instance_t *unspec);
JL_DLLEXPORT jl_code_instance_t *jl_get_method_inferred(
jl_method_instance_t *mi JL_PROPAGATES_ROOT, jl_value_t *rettype,
size_t min_world, size_t max_world);
jl_method_instance_t *jl_get_unspecialized(jl_method_instance_t *method JL_PROPAGATES_ROOT);
jl_method_instance_t *jl_get_unspecialized(jl_method_t *def JL_PROPAGATES_ROOT);

JL_DLLEXPORT int jl_compile_hint(jl_tupletype_t *types);
jl_code_info_t *jl_code_for_interpreter(jl_method_instance_t *lam JL_PROPAGATES_ROOT);
Expand Down