diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2015-06-25 17:05:47 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2015-06-25 17:05:47 +0000 |
commit | 08ec27543d91cff797fc8dd0a8eb47cda2c843f7 (patch) | |
tree | ca64d02be9c4087e4dadaeef0f61260ee7abcc17 /gcc/hash-table.h | |
parent | f11c37791e904dac9f2b24bc8222c39221596eed (diff) |
decl.c (value_annotation_hasher::handle_cache_entry): Delete.
gcc/ada/
* gcc-interface/decl.c (value_annotation_hasher::handle_cache_entry):
Delete.
(value_annotation_hasher::keep_cache_entry): New function.
* gcc-interface/utils.c (pad_type_hasher::handle_cache_entry):
Delete.
(pad_type_hasher::keep_cache_entry): New function.
gcc/
* hash-table.h (hash_table): Add gt_cleare_cache as a friend.
(gt_cleare_cache): Check here for deleted and empty entries.
Replace handle_cache_entry with a call to keep_cache_entry.
* hash-traits.h (ggc_cache_hasher::handle_cache_entry): Delete.
(ggc_cache_hasher::keep_cache_entry): New function.
* trans-mem.c (tm_wrapper_hasher::handle_cache_entry): Delete.
(tm_wrapper_hasher::keep_cache_entry): New function.
* tree.h (tree_decl_map_cache_hasher::handle_cache_entry): Delete.
(tree_vec_map_cache_hasher::keep_cache_entry): New function.
* tree.c (type_cache_hasher::handle_cache_entry): Delete.
(type_cache_hasher::keep_cache_entry): New function.
(tree_vec_map_cache_hasher::handle_cache_entry): Delete.
(tree_vec_map_cache_hasher::keep_cache_entry): New function.
* ubsan.c (tree_type_map_cache_hasher::handle_cache_entry): Delete.
(tree_type_map_cache_hasher::keep_cache_entry): New function.
* varasm.c (tm_clone_hasher::handle_cache_entry): Delete.
(tm_clone_hasher::keep_cache_entry): New function.
* config/i386/i386.c (dllimport_hasher::handle_cache_entry): Delete.
(dllimport_hasher::keep_cache_entry): New function.
From-SVN: r224954
Diffstat (limited to 'gcc/hash-table.h')
-rw-r--r-- | gcc/hash-table.h | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/gcc/hash-table.h b/gcc/hash-table.h index 71c0f63ec9a..d0d93a353ac 100644 --- a/gcc/hash-table.h +++ b/gcc/hash-table.h @@ -52,6 +52,16 @@ along with GCC; see the file COPYING3. If not see individual elements of the table need to be disposed of (e.g., when deleting a hash table, removing elements from the table, etc). + - An optional static function named 'keep_cache_entry'. This + function is provided only for garbage-collected elements that + are not marked by the normal gc mark pass. It describes what + what should happen to the element at the end of the gc mark phase. + The return value should be: + - 0 if the element should be deleted + - 1 if the element should be kept and needs to be marked + - -1 if the element should be kept and is already marked. + Returning -1 rather than 1 is purely an optimization. + 3. The type of the hash table itself. (More later.) In very special circumstances, users may need to know about a fourth type. @@ -584,6 +594,8 @@ private: template<typename T> friend void gt_pch_nx (hash_table<T> *, gt_pointer_operator, void *); + template<typename T> friend void gt_cleare_cache (hash_table<T> *); + value_type *alloc_entries (size_t n CXX_MEM_STAT_INFO) const; value_type *find_empty_slot_for_expand (hashval_t); void expand (); @@ -1131,12 +1143,20 @@ template<typename H> inline void gt_cleare_cache (hash_table<H> *h) { + extern void gt_ggc_mx (typename H::value_type &t); + typedef hash_table<H> table; if (!h) return; - for (typename hash_table<H>::iterator iter = h->begin (); iter != h->end (); - ++iter) - H::handle_cache_entry (*iter); + for (typename table::iterator iter = h->begin (); iter != h->end (); ++iter) + if (!table::is_empty (*iter) && !table::is_deleted (*iter)) + { + int res = H::keep_cache_entry (*iter); + if (res == 0) + h->clear_slot (&*iter); + else if (res != -1) + gt_ggc_mx (*iter); + } } #endif /* TYPED_HASHTAB_H */ |