@@ -962,7 +962,7 @@ static void jl_method_list_insert_sorted(jl_methlist_t **pml, jl_tupletype_t *ty
962
962
}
963
963
964
964
// 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 )
966
966
{
967
967
jl_methlist_t * * pl ;
968
968
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)
971
971
for (int i = 0 ; i < jl_array_len (cache -> arg1 ); i ++ ) {
972
972
union _jl_opaque_cache_t * pl = & ((union _jl_opaque_cache_t * )jl_array_data (cache -> arg1 ))[i ];
973
973
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 );
976
975
}
977
976
}
978
977
}
979
978
if (cache -> targ != (void * )jl_nothing ) {
980
979
for (int i = 0 ; i < jl_array_len (cache -> targ ); i ++ ) {
981
980
union _jl_opaque_cache_t * pl = & ((union _jl_opaque_cache_t * )jl_array_data (cache -> targ ))[i ];
982
981
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 );
985
983
}
986
984
}
987
985
}
988
986
pl = & cache -> list ;
987
+ parent = (jl_value_t * )cache ;
989
988
}
990
989
else {
991
990
pl = & pml -> list ;
992
991
}
993
992
jl_methlist_t * l = * pl ;
994
- // TODO: this needs a jl_gc_wb
995
993
while (l != (void * )jl_nothing ) {
996
994
if (jl_type_intersection (type , (jl_value_t * )l -> sig ) !=
997
995
(jl_value_t * )jl_bottom_type ) {
998
996
* pl = l -> next ;
997
+ jl_gc_wb (parent , * pl );
999
998
}
1000
999
else {
1001
1000
pl = & l -> next ;
1001
+ parent = (jl_value_t * )l ;
1002
1002
}
1003
1003
l = l -> next ;
1004
1004
}
@@ -1602,7 +1602,7 @@ void jl_method_table_insert(jl_methtable_t *mt, jl_tupletype_t *type,
1602
1602
tvars = (jl_svec_t * )jl_svecref (tvars ,0 );
1603
1603
JL_SIGATOMIC_BEGIN ();
1604
1604
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 );
1606
1606
update_max_args (mt , type );
1607
1607
JL_SIGATOMIC_END ();
1608
1608
}
0 commit comments