diff options
author | Gabriel Dos Reis <gdr@integrable-solutions.net> | 2003-05-18 13:40:54 +0000 |
---|---|---|
committer | Gabriel Dos Reis <gdr@gcc.gnu.org> | 2003-05-18 13:40:54 +0000 |
commit | 5e0c54e5141d403804aad85725680b1791790ed6 (patch) | |
tree | 48d321513a6f0b49445946dd5e60ead3215660ad /gcc/hashtable.c | |
parent | 5c9acdf71aa42826ff7cd5d54f11214102949ae9 (diff) | |
download | gcc-5e0c54e5141d403804aad85725680b1791790ed6.zip gcc-5e0c54e5141d403804aad85725680b1791790ed6.tar.gz gcc-5e0c54e5141d403804aad85725680b1791790ed6.tar.bz2 |
hashtable.h (struct ht_identifier): Add data member "hash_value".
* hashtable.h (struct ht_identifier): Add data member "hash_value".
* hashtable.c (ht_lookup): Use it when searching, remember.
(ht_expand): Do not recompute.
* tree.h (IDENTIFIER_HASH_VALUE): New macro.
cp/
* cp-tree.h (struct lang_type_class): Replace data member tags
with hash-table nested_udts.
(CLASSTYPE_NESTED_UTDS): Rename from CLASSTYPE_TAGS.
* class.c (unreverse_member_declarations): Don't touch
CLASSTYPE_TAGS.
(pushclass): Use cxx_remember_type_decls.
* decl.c (struct cp_binding_level): Replace data member tags with
hash-table type_decls.
(pop_binding_level): Handle level->type_decls.
(kept_level_p): Adjust.
(poplevel): Remove unused local variable.
(bt_print_entry): New function.
(print_binding_level): Use it.
(push_namespace): Build current_binding_level->type_decls.
(maybe_process_template_type_declaration): Adjust.
(pushtag): Likewise.
(clear_anon_tags): Use binding_table_remove_anonymous_types.
(gettags): Remove.
(cxx_remember_type_decls): Rename from storetags. Adjust.
(lookup_tag): Use binding_table_find_anon_type. Tidy.
(lookup_tag_reverse): Use binding_table_reverse_maybe_remap.
(cxx_init_decl_processing): Build global_binding_level->type_decls.
(store_parm_decls): Remove pointless code.
* name-lookup.c (free_binding_entry): New variable.
(ENTRY_INDEX): New macro.
(struct binding_table_s): New datatype.
(binding_entry_make): New function.
(binding_entry_free): Likewise.
(binding_table_construct): Likewise.
(binding_table_free): Likewise.
(binding_table_new): Likewise.
(binding_table_expand): Likewise.
(binding_table_insert): Likewise.
(binding_table_find): Likewise.
(binding_table_find_anon_type): Likewise.
(binding_table_reverse_maybe_remap): Likewise.
(binding_table_remove_anonymous_types): Likewise.
(binding_table_foreach): Likewise.
* name-lookup.h (binding_table): New type.
(binding_entry): Likewise.
(bt_foreach_proc): Likewise.
(struct binding_entry_s): New datatype.
(SCOPE_DEFAULT_HT_SIZE): New macro.
(CLASS_SCOPE_HT_SIZE): Likewise.
(NAMESPACE_ORDINARY_HT_SIZE): Likewise.
(NAMESPACE_STD_HT_SIZE): Likewise.
(GLOBAL_SCOPE_HT_SIZE): Likewise.
(binding_table_new): Declare.
(binding_table_free): Likewise.
(binding_table_insert): Likewise.
(binding_table_find_anon_type): Likewise.
(binding_table_reverse_maybe_remap): Likewise.
(binding_table_remove_anonymous_types): Likewise.
(binding_table_foreach): Likewise.
(binding_table_find): Likewise.
(cxx_remember_type_decls): Likewise.
* pt.c (bt_instantiate_type_proc): New function.
(do_type_instantiation): Use it.
* search.c (lookup_field_r): Use binding_table_find.
From-SVN: r66930
Diffstat (limited to 'gcc/hashtable.c')
-rw-r--r-- | gcc/hashtable.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/hashtable.c b/gcc/hashtable.c index 63df6ff..b3f6404 100644 --- a/gcc/hashtable.c +++ b/gcc/hashtable.c @@ -121,7 +121,8 @@ ht_lookup (table, str, len, insert) if (node == NULL) break; - if (HT_LEN (node) == len && !memcmp (HT_STR (node), str, len)) + if (node->hash_value == hash && HT_LEN (node) == len + && !memcmp (HT_STR (node), str, len)) { if (insert == HT_ALLOCED) /* The string we search for was placed at the end of the @@ -141,6 +142,7 @@ ht_lookup (table, str, len, insert) table->entries[index] = node; HT_LEN (node) = len; + node->hash_value = hash; if (insert == HT_ALLOC) HT_STR (node) = obstack_copy0 (&table->stack, str, len); else @@ -173,7 +175,7 @@ ht_expand (table) { unsigned int index, hash, hash2; - hash = calc_hash (HT_STR (*p), HT_LEN (*p)); + hash = (*p)->hash_value; hash2 = ((hash * 17) & sizemask) | 1; index = hash & sizemask; |