Skip to content

Commit 30717a9

Browse files
committed
And another
1 parent 2bfd9ff commit 30717a9

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

src/staticdata_utils.c

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,23 +1140,25 @@ static void jl_insert_backedges(jl_array_t *edges, jl_array_t *ext_targets, jl_a
11401140
if (maxvalid == ~(size_t)0) {
11411141
// if this callee is still valid, add all the backedges
11421142
jl_array_t *callee_ids = (jl_array_t*)jl_array_ptr_ref(edges, 2 * i + 1);
1143-
int32_t *idxs = (int32_t*)jl_array_data(callee_ids);
1144-
for (size_t j = 0; j < idxs[0]; j++) {
1145-
int32_t idx = idxs[j + 1];
1146-
jl_value_t *invokesig = jl_array_ptr_ref(ext_targets, idx * 3);
1147-
jl_value_t *callee = jl_array_ptr_ref(ext_targets, idx * 3 + 1);
1148-
if (callee && jl_is_method_instance(callee)) {
1149-
jl_method_instance_add_backedge((jl_method_instance_t*)callee, invokesig, caller);
1150-
}
1151-
else {
1152-
jl_value_t *sig = callee == NULL ? invokesig : callee;
1153-
jl_methtable_t *mt = jl_method_table_for(sig);
1154-
// FIXME: rarely, `callee` has an unexpected `Union` signature,
1155-
// see https://github.com/JuliaLang/julia/pull/43990#issuecomment-1030329344
1156-
// Fix the issue and turn this back into an `assert((jl_value_t*)mt != jl_nothing)`
1157-
// This workaround exposes us to (rare) 265-violations.
1158-
if ((jl_value_t*)mt != jl_nothing)
1159-
jl_method_table_add_backedge(mt, sig, (jl_value_t*)caller);
1143+
if (jl_array_len(callee_ids) > 0) {
1144+
int32_t *idxs = (int32_t*)jl_array_data(callee_ids);
1145+
for (size_t j = 0; j < idxs[0]; j++) {
1146+
int32_t idx = idxs[j + 1];
1147+
jl_value_t *invokesig = jl_array_ptr_ref(ext_targets, idx * 3);
1148+
jl_value_t *callee = jl_array_ptr_ref(ext_targets, idx * 3 + 1);
1149+
if (callee && jl_is_method_instance(callee)) {
1150+
jl_method_instance_add_backedge((jl_method_instance_t*)callee, invokesig, caller);
1151+
}
1152+
else {
1153+
jl_value_t *sig = callee == NULL ? invokesig : callee;
1154+
jl_methtable_t *mt = jl_method_table_for(sig);
1155+
// FIXME: rarely, `callee` has an unexpected `Union` signature,
1156+
// see https://github.com/JuliaLang/julia/pull/43990#issuecomment-1030329344
1157+
// Fix the issue and turn this back into an `assert((jl_value_t*)mt != jl_nothing)`
1158+
// This workaround exposes us to (rare) 265-violations.
1159+
if ((jl_value_t*)mt != jl_nothing)
1160+
jl_method_table_add_backedge(mt, sig, (jl_value_t*)caller);
1161+
}
11601162
}
11611163
}
11621164
}

0 commit comments

Comments
 (0)