diff options
author | Jason Merrill <jason@redhat.com> | 2017-11-14 11:02:57 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2017-11-14 11:02:57 -0500 |
commit | 21faa10189001f70361ca13133b01a815d2b342c (patch) | |
tree | 931e4ec35ba245c1ce72ae664a03ce5b25f38cb6 /gcc/hash-map.h | |
parent | 55518e0f5df1f1693e060ddd595a86ac816ec291 (diff) | |
download | gcc-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.h')
-rw-r--r-- | gcc/hash-map.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/hash-map.h b/gcc/hash-map.h index 73f1c542..6b8365a9d 100644 --- a/gcc/hash-map.h +++ b/gcc/hash-map.h @@ -62,6 +62,12 @@ class GTY((user)) hash_map gt_ggc_mx (e.m_value); } + static void ggc_maybe_mx (hash_entry &e) + { + if (Traits::maybe_mx) + ggc_mx (e); + } + static void pch_nx (hash_entry &e) { gt_pch_nx (e.m_key); @@ -74,6 +80,11 @@ class GTY((user)) hash_map pch_nx_helper (e.m_value, op, c); } + static int keep_cache_entry (hash_entry &e) + { + return ggc_marked_p (e.m_key); + } + private: template<typename T> static void @@ -237,7 +248,8 @@ private: template<typename T, typename U, typename V> friend void gt_ggc_mx (hash_map<T, U, V> *); template<typename T, typename U, typename V> friend void gt_pch_nx (hash_map<T, U, V> *); - template<typename T, typename U, typename V> friend void gt_pch_nx (hash_map<T, U, V> *, gt_pointer_operator, void *); + template<typename T, typename U, typename V> friend void gt_pch_nx (hash_map<T, U, V> *, gt_pointer_operator, void *); + template<typename T, typename U, typename V> friend void gt_cleare_cache (hash_map<T, U, V> *); hash_table<hash_entry> m_table; }; @@ -260,6 +272,13 @@ gt_pch_nx (hash_map<K, V, H> *h) template<typename K, typename V, typename H> static inline void +gt_cleare_cache (hash_map<K, V, H> *h) +{ + gt_cleare_cache (&h->m_table); +} + +template<typename K, typename V, typename H> +static inline void gt_pch_nx (hash_map<K, V, H> *h, gt_pointer_operator op, void *cookie) { op (&h->m_table.m_entries, cookie); |