@@ -2636,7 +2636,7 @@ static int has_key(jl_genericmemory_t *keys, jl_value_t *key)
2636
2636
}
2637
2637
2638
2638
// Check if m2 is in m1's interferences set, which means !morespecific(m1, m2)
2639
- static int method_in_interferences (jl_method_t * m1 , jl_method_t * m2 )
2639
+ static int method_in_interferences (jl_method_t * m2 , jl_method_t * m1 )
2640
2640
{
2641
2641
return has_key (jl_atomic_load_relaxed (& m1 -> interferences ), (jl_value_t * )m2 );
2642
2642
}
@@ -2672,7 +2672,7 @@ static int check_interferences_covers(jl_method_t *m, jl_value_t *ti, jl_array_t
2672
2672
int idx = find_method_in_matches (t , m2 );
2673
2673
if (idx < 0 )
2674
2674
continue ;
2675
- if (method_in_interferences (m2 , m ))
2675
+ if (method_in_interferences (m , m2 ))
2676
2676
continue ; // ambiguous
2677
2677
assert (visited -> items [idx ] != (void * )0 );
2678
2678
if (visited -> items [idx ] != (void * )1 )
@@ -2696,7 +2696,7 @@ static int check_fully_ambiguous(jl_method_t *m, jl_value_t *ti, jl_array_t *t,
2696
2696
int idx = find_method_in_matches (t , m2 );
2697
2697
if (idx < 0 )
2698
2698
continue ;
2699
- if (!method_in_interferences (m2 , m ))
2699
+ if (!method_in_interferences (m , m2 ))
2700
2700
continue ;
2701
2701
* has_ambiguity = 1 ;
2702
2702
if (!include_ambiguous && jl_subtype (ti , m2 -> sig ))
@@ -2705,13 +2705,13 @@ static int check_fully_ambiguous(jl_method_t *m, jl_value_t *ti, jl_array_t *t,
2705
2705
return 0 ;
2706
2706
}
2707
2707
2708
- // Recursively check if target_method is in the interferences of (morespecific than) start_method
2709
- static int method_in_interferences_recursive (jl_method_t * start_method , jl_method_t * target_method , arraylist_t * seen )
2708
+ // Recursively check if target_method is in the interferences of (morespecific than) start_method, but not the reverse
2709
+ static int method_in_interferences_recursive (jl_method_t * target_method , jl_method_t * start_method , arraylist_t * seen )
2710
2710
{
2711
2711
// Check direct interferences first
2712
- if (method_in_interferences (target_method , start_method ))
2713
- return 0 ;
2714
2712
if (method_in_interferences (start_method , target_method ))
2713
+ return 0 ;
2714
+ if (method_in_interferences (target_method , start_method ))
2715
2715
return 1 ;
2716
2716
2717
2717
// Check if we're already visiting this method (cycle prevention and memoization)
@@ -2727,9 +2727,9 @@ static int method_in_interferences_recursive(jl_method_t *start_method, jl_metho
2727
2727
jl_method_t * interference_method = (jl_method_t * )jl_genericmemory_ptr_ref (interferences , i );
2728
2728
if (interference_method == NULL )
2729
2729
continue ;
2730
- if (method_in_interferences (interference_method , start_method ))
2730
+ if (method_in_interferences (start_method , interference_method ))
2731
2731
continue ; // only follow edges to morespecific methods in search of morespecific target (skip ambiguities)
2732
- if (method_in_interferences_recursive (interference_method , target_method , seen ))
2732
+ if (method_in_interferences_recursive (target_method , interference_method , seen ))
2733
2733
return 1 ;
2734
2734
}
2735
2735
@@ -2742,7 +2742,7 @@ static int method_morespecific_via_interferences(jl_method_t *target_method, jl_
2742
2742
return 0 ;
2743
2743
arraylist_t seen ;
2744
2744
arraylist_new (& seen , 0 );
2745
- int result = method_in_interferences_recursive (start_method , target_method , & seen );
2745
+ int result = method_in_interferences_recursive (target_method , start_method , & seen );
2746
2746
arraylist_free (& seen );
2747
2747
//assert(result == jl_method_morespecific(target_method, start_method) || jl_has_empty_intersection(target_method->sig, start_method->sig) || jl_has_empty_intersection(start_method->sig, target_method->sig));
2748
2748
return result ;
@@ -2837,7 +2837,7 @@ void jl_method_table_activate(jl_typemap_entry_t *newentry)
2837
2837
jl_gc_wb (m , m_interferences );
2838
2838
for (j = 0 ; j < n ; j ++ ) {
2839
2839
jl_method_t * m2 = d [j ];
2840
- if (m2 && method_in_interferences (m2 , m )) {
2840
+ if (m2 && method_in_interferences (m , m2 )) {
2841
2841
jl_genericmemory_t * m2_interferences = jl_atomic_load_relaxed (& m2 -> interferences );
2842
2842
ssize_t idx ;
2843
2843
m2_interferences = jl_idset_put_key (m2_interferences , (jl_value_t * )method , & idx );
@@ -4489,7 +4489,7 @@ static int sort_mlmatches(jl_array_t *t, size_t idx, arraylist_t *visited, array
4489
4489
continue ; // already handled
4490
4490
if (child_cycle != 0 && child_cycle - 1 >= cycle )
4491
4491
continue ; // already part of this cycle
4492
- if (method_in_interferences (m2 , m ))
4492
+ if (method_in_interferences (m , m2 ))
4493
4493
continue ;
4494
4494
// m2 is morespecific, so attempt to visit it first
4495
4495
child_cycle = sort_mlmatches (t , childidx , visited , stack , result , recursion_stack , lim , include_ambiguous , has_ambiguity , found_minmax );
@@ -4737,7 +4737,7 @@ static jl_value_t *ml_matches(jl_methtable_t *mt, jl_methcache_t *mc,
4737
4737
matc -> fully_covers = SENTINEL ; // put a sentinel value here for sorting
4738
4738
continue ;
4739
4739
}
4740
- if (method_in_interferences (m , minmaxm )) // !morespecific(m, minmaxm)
4740
+ if (method_in_interferences (minmaxm , m )) // !morespecific(m, minmaxm)
4741
4741
has_ambiguity = 1 ;
4742
4742
}
4743
4743
all_subtypes = 0 ;
0 commit comments