aboutsummaryrefslogtreecommitdiff
path: root/gcc/hash-map-traits.h
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-11-14 11:02:57 -0500
committerJason Merrill <jason@gcc.gnu.org>2017-11-14 11:02:57 -0500
commit21faa10189001f70361ca13133b01a815d2b342c (patch)
tree931e4ec35ba245c1ce72ae664a03ce5b25f38cb6 /gcc/hash-map-traits.h
parent55518e0f5df1f1693e060ddd595a86ac816ec291 (diff)
downloadgcc-21faa10189001f70361ca13133b01a815d2b342c.zip
gcc-21faa10189001f70361ca13133b01a815d2b342c.tar.gz
gcc-21faa10189001f70361ca13133b01a815d2b342c.tar.bz2
Support GTY((cache)) on hash_map.
gcc/ * hash-traits.h (ggc_remove): Add ggc_maybe_mx member function. (ggc_cache_remove): Override it instead of ggc_mx. * hash-table.h (gt_ggc_mx): Call it instead of ggc_mx. (gt_cleare_cache): Call ggc_mx instead of gt_ggc_mx. * hash-map-traits.h (simple_hashmap_traits): Add maybe_mx member. (simple_cache_map_traits): Override maybe_mx. * hash-map.h (hash_entry): Add ggc_maybe_mx and keep_cache_entry. (hash_map): Friend gt_cleare_cache. (gt_cleare_cache): New. * tree.h (tree_cache_traits): New hash_map traits class. (tree_cache_map): New typedef. gcc/cp/ * decl.c (decomp_type_table): Use tree_cache_map. * init.c (nsdmi_inst): Likewise. * pt.c (defarg_ints): Likewise. * cp-objcp-common.c (cp_get_debug_type): Likewise. From-SVN: r254731
Diffstat (limited to 'gcc/hash-map-traits.h')
-rw-r--r--gcc/hash-map-traits.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/hash-map-traits.h b/gcc/hash-map-traits.h
index 2b5fddf..a92f0cb 100644
--- a/gcc/hash-map-traits.h
+++ b/gcc/hash-map-traits.h
@@ -32,6 +32,7 @@ template <typename H, typename Value>
struct simple_hashmap_traits
{
typedef typename H::value_type key_type;
+ static const bool maybe_mx = true;
static inline hashval_t hash (const key_type &);
static inline bool equal_keys (const key_type &, const key_type &);
template <typename T> static inline void remove (T &);
@@ -97,6 +98,12 @@ simple_hashmap_traits <H, Value>::mark_deleted (T &entry)
H::mark_deleted (entry.m_key);
}
+template <typename H, typename Value>
+struct simple_cache_map_traits: public simple_hashmap_traits<H,Value>
+{
+ static const bool maybe_mx = false;
+};
+
/* Implement traits for a hash_map with values of type Value for cases
in which the key cannot represent empty and deleted slots. Instead
record empty and deleted entries in Value. Derived classes must