Skip to content

Commit

Permalink
fixing conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jul 1, 2011
1 parent ffd4e83 commit b125ac3
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
34 changes: 33 additions & 1 deletion src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ static int cache_match_by_type(jl_value_t **types, size_t n, jl_tuple_t *sig,
}
}
}
//else if (decl == (jl_value_t*)jl_any_type) {
//}
else {
if (!jl_types_equal(a, decl))
return 0;
Expand Down Expand Up @@ -124,6 +126,9 @@ static inline int cache_match(jl_value_t **args, size_t n, jl_tuple_t *sig,
return 0;
}
}
else if (decl == (jl_value_t*)jl_any_type) {
assert(0);
}
else {
/*
we know there are only concrete types here, and types are
Expand Down Expand Up @@ -337,7 +342,34 @@ static jl_function_t *cache_method(jl_methtable_t *mt, jl_tuple_t *type,
size_t i;
for (i=0; i < type->length; i++) {
jl_value_t *elt = jl_tupleref(type,i);
if (jl_is_tuple(elt)) {
int set_to_any = 0;
if (0 && nth_slot_type(decl,i) == jl_ANY_flag) {
// don't specialize on slots marked ANY
jl_value_t *orig = jl_tupleref(type, i);
jl_tupleset(type, i, (jl_value_t*)jl_any_type);
int nintr=0;
jl_methlist_t *curr = mt->defs;
// if this method is the only match even with the current slot
// set to Any, then it is safe to cache it that way.
while (curr != NULL && curr->func!=method) {
if (jl_type_intersection((jl_value_t*)curr->sig,
(jl_value_t*)type) !=
(jl_value_t*)jl_bottom_type) {
nintr++;
break;
}
curr = curr->next;
}
if (nintr) {
jl_tupleset(type, i, orig);
}
else {
set_to_any = 1;
}
}
if (set_to_any) {
}
else if (jl_is_tuple(elt)) {
/*
don't cache tuple type exactly; just remember that it was
a tuple, unless the declaration asks for something more
Expand Down
1 change: 1 addition & 0 deletions src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ extern jl_tag_type_t *jl_any_type;
extern jl_tag_type_t *jl_type_type;
extern jl_tvar_t *jl_typetype_tvar;
extern jl_tag_type_t *jl_typetype_type;
extern jl_value_t *jl_ANY_flag;
extern jl_tag_type_t *jl_undef_type;
extern jl_struct_type_t *jl_typename_type;
extern jl_struct_type_t *jl_typector_type;
Expand Down

0 comments on commit b125ac3

Please sign in to comment.