Commit e0422ed0 by Alexandre Petit-Bianco Committed by Alexandre Petit-Bianco

class.c: (java_hash_hash_tree_node): Renamed from `decl_hash', made global.

2000-04-05  Alexandre Petit-Bianco  <apbianco@cygnus.com>

        * class.c: (java_hash_hash_tree_node): Renamed from `decl_hash',
        made global.
        (java_hash_compare_tree_node): Renamed from `decl_compare, made
        global.
        (add_method_1): Use `java_hash_hash_tree_node' and
        `java_hash_compare_tree_node'.
        * java-tree.h: (java_hash_hash_tree_node): Prototyped.
        (java_hash_compare_tree_node): Likewise.
        * parse.y (find_applicable_accessible_methods_list): Create,
        delete and use a hash table to remember already searched interfaces.

From-SVN: r32947
parent 007baa49
2000-04-05 Alexandre Petit-Bianco <apbianco@cygnus.com>
* class.c: (java_hash_hash_tree_node): Renamed from `decl_hash',
made global.
(java_hash_compare_tree_node): Renamed from `decl_compare, made
global.
(add_method_1): Use `java_hash_hash_tree_node' and
`java_hash_compare_tree_node'.
* java-tree.h: (java_hash_hash_tree_node): Prototyped.
(java_hash_compare_tree_node): Likewise.
* parse.y (find_applicable_accessible_methods_list): Create,
delete and use a hash table to remember already searched interfaces.
2000-04-03 Matt Welsh <mdw@cs.berkeley.edu>
* jcf-depend.c (add_entry): Fixed bug where list was always replaced
......
......@@ -594,22 +594,25 @@ init_test_hash_newfunc (entry, table, string)
return (struct hash_entry *) ret;
}
static unsigned long
decl_hash (k)
/* Hash table helpers. Also reused in find_applicable_accessible_methods_list
(parse.y). The hash of a tree node is it's pointer value,
comparison is direct. */
unsigned long
java_hash_hash_tree_node (k)
hash_table_key k;
{
return (long) k;
}
static boolean
decl_compare (k1, k2)
boolean
java_hash_compare_tree_node (k1, k2)
hash_table_key k1;
hash_table_key k2;
{
return ((char*) k1 == (char*) k2);
}
tree
add_method_1 (handle_class, access_flags, name, function_type)
tree handle_class;
......@@ -632,8 +635,8 @@ add_method_1 (handle_class, access_flags, name, function_type)
/* Initialize the static initializer test table. */
hash_table_init (&DECL_FUNCTION_INIT_TEST_TABLE (fndecl),
init_test_hash_newfunc, decl_hash,
decl_compare);
init_test_hash_newfunc, java_hash_hash_tree_node,
java_hash_compare_tree_node);
TREE_CHAIN (fndecl) = TYPE_METHODS (handle_class);
TYPE_METHODS (handle_class) = fndecl;
......
......@@ -753,6 +753,9 @@ void java_debug_context PARAMS ((void));
void safe_layout_class PARAMS ((tree));
extern tree get_boehm_type_descriptor PARAMS ((tree));
extern unsigned long java_hash_hash_tree_node PARAMS ((hash_table_key));
extern boolean java_hash_compare_tree_node PARAMS ((hash_table_key,
hash_table_key));
/* We use ARGS_SIZE_RTX to indicate that gcc/expr.h has been included
to declare `enum expand_modifier'. */
......
......@@ -9839,22 +9839,29 @@ find_applicable_accessible_methods_list (lc, class, name, arglist)
/* Search interfaces */
if (CLASS_INTERFACE (TYPE_NAME (class)))
{
static tree searched_interfaces = NULL_TREE;
static struct hash_table t, *searched_interfaces = NULL;
static int search_not_done = 0;
int i, n;
tree basetype_vec = TYPE_BINFO_BASETYPES (class);
/* Have we searched this interface already? We shoud use a hash
table, FIXME */
/* Search in the hash table, otherwise create a new one if
necessary and insert the new entry. */
if (searched_interfaces)
{
tree current;
for (current = searched_interfaces;
current; current = TREE_CHAIN (current))
if (TREE_VALUE (current) == class)
return NULL;
{
if (hash_lookup (searched_interfaces,
(const hash_table_key) class, FALSE, NULL))
return NULL;
}
searched_interfaces = tree_cons (NULL_TREE, class, searched_interfaces);
else
{
hash_table_init (&t, hash_newfunc, java_hash_hash_tree_node,
java_hash_compare_tree_node);
searched_interfaces = &t;
}
hash_lookup (searched_interfaces,
(const hash_table_key) class, TRUE, NULL);
search_applicable_methods_list (lc, TYPE_METHODS (class),
name, arglist, &list, &all_list);
......@@ -9879,7 +9886,8 @@ find_applicable_accessible_methods_list (lc, class, name, arglist)
search_applicable_methods_list (lc,
TYPE_METHODS (object_type_node),
name, arglist, &list, &all_list);
searched_interfaces = NULL_TREE;
hash_table_free (searched_interfaces);
searched_interfaces = NULL;
}
}
/* Search classes */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment