Skip to content

Commit f4a983d

Browse files
committed
remove incorrect assertion
Since we are doing a subtype search (like a the top of the function), the resulting object from the search does not need to be the same.
1 parent 166031c commit f4a983d

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

src/gf.c

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,26 +1072,15 @@ static jl_method_instance_t *cache_method(
10721072
temp2 = (jl_value_t*)simplett;
10731073
}
10741074

1075-
// short-circuit if this exact entry is already present
1076-
// to avoid adding a new duplicate copy of it
1077-
if (cachett != tt && simplett == NULL) {
1078-
struct jl_typemap_assoc search = {(jl_value_t*)cachett, min_valid, NULL, 0, ~(size_t)0};
1075+
// short-circuit if an existing entry is already present
1076+
// that satisfies our requirements
1077+
if (cachett != tt) {
1078+
struct jl_typemap_assoc search = {(jl_value_t*)cachett, world, NULL, 0, ~(size_t)0};
10791079
jl_typemap_entry_t *entry = jl_typemap_assoc_by_type(*cache, &search, offs, /*subtype*/1);
1080-
if (entry && (jl_value_t*)entry->simplesig == jl_nothing) {
1081-
if (jl_egal((jl_value_t*)guardsigs, (jl_value_t*)entry->guardsigs)) {
1082-
// just update the existing entry to reflect new knowledge
1083-
if (entry->min_world > min_valid)
1084-
entry->min_world = min_valid;
1085-
if (entry->max_world < max_valid)
1086-
entry->max_world = max_valid;
1087-
if (entry->func.linfo == NULL) {
1088-
entry->func.linfo = newmeth;
1089-
jl_gc_wb(entry, newmeth);
1090-
}
1091-
assert(entry->func.linfo == newmeth);
1092-
JL_GC_POP();
1093-
return newmeth;
1094-
}
1080+
if (entry && jl_egal((jl_value_t*)entry->simplesig, simplett ? (jl_value_t*)simplett : jl_nothing) &&
1081+
jl_egal((jl_value_t*)guardsigs, (jl_value_t*)entry->guardsigs)) {
1082+
JL_GC_POP();
1083+
return entry->func.linfo;
10951084
}
10961085
}
10971086

0 commit comments

Comments
 (0)