diff options
author | crowl <crowl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-09 21:21:36 +0000 |
---|---|---|
committer | crowl <crowl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-09 21:21:36 +0000 |
commit | d1455aa3757cdf92c69e09e9d5fc8914257809c6 (patch) | |
tree | 6b83efb5a5d730e31c6760ce9e20be32071b13a4 /gcc/hash-table.h | |
parent | 981934828da13c50a4a58264cd6182664186dbb1 (diff) | |
download | gcc-d1455aa3757cdf92c69e09e9d5fc8914257809c6.tar.gz |
Change more non-GTY hash tables to use the new type-safe template hash table.
Constify member function parameters that can be const.
Correct a couple of expressions in formerly uninstantiated templates.
The new code is 0.362% faster in bootstrap, with a 99.5% confidence of
being faster.
Tested on x86-64.
Index: gcc/java/ChangeLog
2012-10-01 Lawrence Crowl <crowl@google.com>
* Make-lang.in (JAVA_OBJS): Add dependence on hash-table.o.
(JCFDUMP_OBJS): Add dependence on hash-table.o.
(jcf-io.o): Add dependence on hash-table.h.
* jcf-io.c (memoized_class_lookups): Change to use type-safe hash table.
Index: gcc/c/ChangeLog
2012-10-09 Lawrence Crowl <crowl@google.com>
* Make-lang.in (c-decl.o): Add dependence on hash-table.h.
* c-decl.c (detect_field_duplicates_hash): Change to new type-safe
hash table.
Index: gcc/objc/ChangeLog
2012-10-01 Lawrence Crowl <crowl@google.com>
* Make-lang.in (OBJC_OBJS): Add dependence on hash-table.o.
(objc-act.o): Add dependence on hash-table.h.
* objc-act.c (objc_detect_field_duplicates): Change to new type-safe
hash table.
Index: gcc/ChangeLog
2012-10-09 Lawrence Crowl <crowl@google.com>
* Makefile.in (fold-const.o): Add depencence on hash-table.h.
(dse.o): Likewise.
(cfg.o): Likewise.
* fold-const.c (fold_checksum_tree): Change to new type-safe hash table.
* (print_fold_checksum): Likewise.
* cfg.c (var bb_original): Likewise.
* (var bb_copy): Likewise.
* (var loop_copy): Likewise.
* hash-table.h (template hash_table): Constify parameters for find...
and remove_elt... member functions.
(hash_table::empty) Correct size expression.
(hash_table::clear_slot) Correct deleted entry assignment.
* dse.c (var rtx_group_table): Change to new type-safe hash table.
Index: gcc/cp/ChangeLog
2012-10-09 Lawrence Crowl <crowl@google.com>
* Make-lang.in (class.o): Add dependence on hash-table.h.
(tree.o): Likewise.
(semantics.o): Likewise.
* class.c (fixed_type_or_null): Change to new type-safe hash table.
* tree.c (verify_stmt_tree): Likewise.
(verify_stmt_tree_r): Likewise.
* semantics.c (struct nrv_data): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192273 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/hash-table.h')
-rw-r--r-- | gcc/hash-table.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/gcc/hash-table.h b/gcc/hash-table.h index 91231a21c33..3aa66a797cf 100644 --- a/gcc/hash-table.h +++ b/gcc/hash-table.h @@ -223,15 +223,15 @@ public: void create (size_t initial_slots); bool is_created (); void dispose (); - T *find (T *comparable); - T *find_with_hash (T *comparable, hashval_t hash); - T **find_slot (T *comparable, enum insert_option insert); - T **find_slot_with_hash (T *comparable, hashval_t hash, + T *find (const T *comparable); + T *find_with_hash (const T *comparable, hashval_t hash); + T **find_slot (const T *comparable, enum insert_option insert); + T **find_slot_with_hash (const T *comparable, hashval_t hash, enum insert_option insert); void empty (); void clear_slot (T **slot); - void remove_elt (T *comparable); - void remove_elt_with_hash (T *comparable, hashval_t hash); + void remove_elt (const T *comparable); + void remove_elt_with_hash (const T *comparable, hashval_t hash); size_t size(); size_t elements(); double collisions(); @@ -273,7 +273,7 @@ hash_table <Descr, Allocator>::is_created () template <typename Descr, template <typename Type> class Allocator> inline typename Descr::T * -hash_table <Descr, Allocator>::find (T *comparable) +hash_table <Descr, Allocator>::find (const T *comparable) { return find_with_hash (comparable, Descr::hash (comparable)); } @@ -285,7 +285,7 @@ template <typename Descr, template <typename Type> class Allocator> inline typename Descr::T ** hash_table <Descr, Allocator> -::find_slot (T *comparable, enum insert_option insert) +::find_slot (const T *comparable, enum insert_option insert) { return find_slot_with_hash (comparable, Descr::hash (comparable), insert); } @@ -297,7 +297,7 @@ template <typename Descr, template <typename Type> class Allocator> inline void hash_table <Descr, Allocator> -::remove_elt (T *comparable) +::remove_elt (const T *comparable) { remove_elt_with_hash (comparable, Descr::hash (comparable)); } @@ -495,7 +495,7 @@ template <typename Descr, template <typename Type> class Allocator> typename Descr::T * hash_table <Descr, Allocator> -::find_with_hash (T *comparable, hashval_t hash) +::find_with_hash (const T *comparable, hashval_t hash) { hashval_t index, hash2; size_t size; @@ -538,7 +538,7 @@ template <typename Descr, template <typename Type> class Allocator> typename Descr::T ** hash_table <Descr, Allocator> -::find_slot_with_hash (T *comparable, hashval_t hash, +::find_slot_with_hash (const T *comparable, hashval_t hash, enum insert_option insert) { T **first_deleted_slot; @@ -609,7 +609,7 @@ template <typename Descr, void hash_table <Descr, Allocator>::empty () { - size_t size = htab_size (htab); + size_t size = htab->size; T **entries = htab->entries; int i; @@ -651,7 +651,7 @@ hash_table <Descr, Allocator> Descr::remove (*slot); - *slot = HTAB_DELETED_ENTRY; + *slot = static_cast <T *> (HTAB_DELETED_ENTRY); htab->n_deleted++; } @@ -664,7 +664,7 @@ template <typename Descr, template <typename Type> class Allocator> void hash_table <Descr, Allocator> -::remove_elt_with_hash (T *comparable, hashval_t hash) +::remove_elt_with_hash (const T *comparable, hashval_t hash) { T **slot; |