Skip to content

Commit 39e561b

Browse files
committed
add missing gc wb for removing conflicting entries from the method table
1 parent ba9454a commit 39e561b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/gf.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ static void jl_method_list_insert_sorted(jl_methlist_t **pml, jl_tupletype_t *ty
962962
}
963963

964964
// invalidate cached methods that overlap this definition
965-
static void remove_conflicting(union _jl_opaque_cache_t *pml, jl_value_t *type)
965+
static void invalidate_conflicting(union _jl_opaque_cache_t *pml, jl_value_t *type, jl_value_t *parent)
966966
{
967967
jl_methlist_t **pl;
968968
if (jl_typeof(pml->cache) == (jl_value_t*)jl_methcache_type) {
@@ -971,34 +971,34 @@ static void remove_conflicting(union _jl_opaque_cache_t *pml, jl_value_t *type)
971971
for(int i=0; i < jl_array_len(cache->arg1); i++) {
972972
union _jl_opaque_cache_t *pl = &((union _jl_opaque_cache_t*)jl_array_data(cache->arg1))[i];
973973
if (pl->nothing && pl->nothing != jl_nothing) {
974-
remove_conflicting(pl, type);
975-
jl_gc_wb(cache->arg1, jl_cellref(cache->arg1, i));
974+
invalidate_conflicting(pl, type, (jl_value_t*)cache->arg1);
976975
}
977976
}
978977
}
979978
if (cache->targ != (void*)jl_nothing) {
980979
for(int i=0; i < jl_array_len(cache->targ); i++) {
981980
union _jl_opaque_cache_t *pl = &((union _jl_opaque_cache_t*)jl_array_data(cache->targ))[i];
982981
if (pl->nothing && pl->nothing != jl_nothing) {
983-
remove_conflicting(pl, type);
984-
jl_gc_wb(cache->targ, jl_cellref(cache->targ, i));
982+
invalidate_conflicting(pl, type, (jl_value_t*)cache->targ);
985983
}
986984
}
987985
}
988986
pl = &cache->list;
987+
parent = (jl_value_t*)cache;
989988
}
990989
else {
991990
pl = &pml->list;
992991
}
993992
jl_methlist_t *l = *pl;
994-
// TODO: this needs a jl_gc_wb
995993
while (l != (void*)jl_nothing) {
996994
if (jl_type_intersection(type, (jl_value_t*)l->sig) !=
997995
(jl_value_t*)jl_bottom_type) {
998996
*pl = l->next;
997+
jl_gc_wb(parent, *pl);
999998
}
1000999
else {
10011000
pl = &l->next;
1001+
parent = (jl_value_t*)l;
10021002
}
10031003
l = l->next;
10041004
}
@@ -1602,7 +1602,7 @@ void jl_method_table_insert(jl_methtable_t *mt, jl_tupletype_t *type,
16021602
tvars = (jl_svec_t*)jl_svecref(tvars,0);
16031603
JL_SIGATOMIC_BEGIN();
16041604
jl_method_list_insert_sorted(&mt->defs, type, method, tvars, (jl_value_t*)mt);
1605-
remove_conflicting(&mt->cache, (jl_value_t*)type);
1605+
invalidate_conflicting(&mt->cache, (jl_value_t*)type, (jl_value_t*)mt);
16061606
update_max_args(mt, type);
16071607
JL_SIGATOMIC_END();
16081608
}

0 commit comments

Comments
 (0)