@@ -1072,26 +1072,15 @@ static jl_method_instance_t *cache_method(
1072
1072
temp2 = (jl_value_t * )simplett ;
1073
1073
}
1074
1074
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 };
1079
1079
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 ;
1095
1084
}
1096
1085
}
1097
1086
0 commit comments