Skip to content

Commit

Permalink
fix #47662, broken --compile=all on 1.8.x (#47678)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored and KristofferC committed Dec 14, 2022
1 parent 70c8dc2 commit 8abef03
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
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

0 comments on commit 8abef03

Please sign in to comment.