36template<
typename KeyId,
typename Value,
41 typedef typename Traits::key_type
Key;
52 return Traits::hash (e.
m_key);
57 return Traits::equal_keys (
a.m_key,
b);
66 return Traits::is_deleted (e);
69 static const bool empty_zero_p = Traits::empty_zero_p;
93 pch_nx_helper (e.
m_key, op, c);
94 pch_nx_helper (e.
m_value, op, c);
114 op (&x,
NULL, cookie);
118#define DEFINE_PCH_HELPER(T) \
119 static void pch_nx_helper (T, gt_pointer_operator, void *) { }
134#undef DEFINE_PCH_HELPER
139 bool sanitize_eq_and_hash =
true,
140 bool gather_mem_stats = GATHER_STATISTICS
142 : m_table (n, ggc, sanitize_eq_and_hash, gather_mem_stats,
148 bool sanitize_eq_and_hash =
true,
149 bool gather_mem_stats = GATHER_STATISTICS
151 : m_table (h.m_table, ggc, sanitize_eq_and_hash, gather_mem_stats,
156 bool gather_mem_stats = GATHER_STATISTICS
170 hash_entry *e = m_table.find_slot_with_hash (k, Traits::hash (k),
172 bool ins = Traits::is_empty (*e);
176 new ((
void *)&e->
m_value) Value (v);
178 && !Traits::is_deleted (*e));
191 hash_entry &e = m_table.find_with_hash (k, Traits::hash (k));
201 hash_entry *e = m_table.find_slot_with_hash (k, Traits::hash (k),
203 bool ins = Traits::is_empty (*e);
207 new ((
void *)&e->
m_value) Value ();
209 && !Traits::is_deleted (*e));
220 m_table.remove_elt_with_hash (k, Traits::hash (k));
227 template<
typename Arg,
bool (*f)(
const typename Traits::key_type &,
229 void traverse (Arg
a)
const
232 iter != m_table.end (); ++iter)
233 if (!f ((*iter).m_key, (*iter).m_value,
a))
237 template<
typename Arg,
bool (*f)(
const typename Traits::key_type &,
239 void traverse (Arg
a)
const
242 iter != m_table.end (); ++iter)
243 if (!f ((*iter).m_key, &(*iter).m_value,
a))
247 size_t elements ()
const {
return m_table.elements (); }
252 bool is_empty ()
const {
return m_table.is_empty (); }
276 template <
typename K,
typename V>
277 operator std::pair<K, V> ()
const {
return std::pair<K, V> (first, second); }
288 return m_iter == other.
m_iter;
293 return m_iter != other.
m_iter;
317template<
typename K,
typename V,
typename H>
324template<
typename K,
typename V,
typename H>
331template<
typename K,
typename V,
typename H>
339template<
typename K,
typename V,
typename H>
347template<
bool ggc,
typename K,
typename V,
typename H>
363template<
typename K,
typename V,
typename H>
371template<
bool ggc,
typename K,
typename V,
typename H>
380template<
bool ggc,
typename K,
typename V,
typename H>
void gt_pch_nx(bbitmap< N > *)
Definition bbitmap.h:226
void gt_ggc_mx(bbitmap< N > *)
Definition bbitmap.h:220
Definition hash-map.h:269
reference_pair(const Key &key, Value &value)
Definition hash-map.h:274
const Key & first
Definition hash-map.h:271
Value & second
Definition hash-map.h:272
Definition hash-map.h:255
hash_table< hash_entry >::iterator m_iter
Definition hash-map.h:297
iterator(const typename hash_table< hash_entry >::iterator &iter)
Definition hash-map.h:257
hash_table< hash_entry > m_table
Definition hash-map.h:312
bool is_empty() const
Definition hash-map.h:252
Traits::key_type Key
Definition hash-map.h:41
iterator begin() const
Definition hash-map.h:302
Value * get(const Key &k)
Definition hash-map.h:189
void empty()
Definition hash-map.h:249
size_t elements() const
Definition hash-map.h:247
void remove(const Key &k)
Definition hash-map.h:218
void traverse(Arg a) const
Definition hash-map.h:229
iterator end() const
Definition hash-map.h:303
hash_map(size_t n=default_hash_map_size, bool ggc=false, bool sanitize_eq_and_hash=true, bool gather_mem_stats=GATHER_STATISTICS CXX_MEM_STAT_INFO)
Definition hash-map.h:138
friend void gt_cleare_cache(hash_map< T, U, V > *)
friend void gt_ggc_mx(hash_map< T, U, V > *)
friend void gt_pch_nx(hash_map< T, U, V > *, gt_pointer_operator, void *)
bool put(const Key &k, const Value &v)
Definition hash-map.h:168
hash_map(const hash_map &h, bool ggc=false, bool sanitize_eq_and_hash=true, bool gather_mem_stats=GATHER_STATISTICS CXX_MEM_STAT_INFO)
Definition hash-map.h:147
friend void gt_pch_nx(hash_map< T, U, V > *)
static hash_map * create_ggc(size_t size=default_hash_map_size, bool gather_mem_stats=GATHER_STATISTICS CXX_MEM_STAT_INFO)
Definition hash-map.h:155
Value & get_or_insert(const Key &k, bool *existed=NULL)
Definition hash-map.h:199
Definition hash-table.h:474
Definition hash-table.h:375
#define GTY(x)
Definition coretypes.h:41
void(* gt_pointer_operator)(void *, void *, void *)
Definition coretypes.h:473
static struct string2counter_map map[debug_counter_number_of_counters]
Definition dbgcnt.cc:39
bool operator==(const nowarn_spec_t &lhs, const nowarn_spec_t &rhs)
Definition diagnostic-spec.h:131
bool operator!=(const nowarn_spec_t &lhs, const nowarn_spec_t &rhs)
Definition diagnostic-spec.h:139
bool ggc_marked_p(const void *p)
Definition ggc-page.cc:1581
T * ggc_alloc(ALONE_CXX_MEM_STAT_INFO)
Definition ggc.h:184
V & hash_map_safe_get_or_insert(hash_map< K, V, H > *&h, const K &k, bool *e=NULL, size_t size=default_hash_map_size)
Definition hash-map.h:373
void gt_cleare_cache(hash_map< K, V, H > *h)
Definition hash-map.h:333
bool hash_map_safe_put(hash_map< K, V, H > *&h, const K &k, const V &v, size_t size=default_hash_map_size)
Definition hash-map.h:382
void gt_pch_nx(hash_map< K, V, H > *h)
Definition hash-map.h:326
const size_t default_hash_map_size
Definition hash-map.h:35
V * hash_map_safe_get(hash_map< K, V, H > *h, const K &k)
Definition hash-map.h:365
hm_alloc
Definition hash-map.h:346
@ hm_heap
Definition hash-map.h:346
@ hm_ggc
Definition hash-map.h:346
hash_map< K, V, H > * hash_map_maybe_create(hash_map< K, V, H > *&h, size_t size=default_hash_map_size)
Definition hash-map.h:349
void gt_ggc_mx(hash_map< K, V, H > *h)
Definition hash-map.h:319
@ HASH_MAP_ORIGIN
Definition mem-stats-traits.h:28
Ca const poly_int< N, Cb > & b
Definition poly-int.h:771
Ca & a
Definition poly-int.h:770
#define PASS_MEM_STAT
Definition statistics.h:54
#define CXX_MEM_STAT_INFO
Definition statistics.h:58
static void mark_deleted(hash_entry &e)
Definition hash-map.h:62
Value m_value
Definition hash-map.h:45
DEFINE_PCH_HELPER(unsigned char)
Key m_key
Definition hash-map.h:44
static bool is_empty(const hash_entry &e)
Definition hash-map.h:71
static hashval_t hash(const hash_entry &e)
Definition hash-map.h:50
DEFINE_PCH_HELPER(unsigned long long)
static const bool empty_zero_p
Definition hash-map.h:69
static void ggc_maybe_mx(hash_entry &e)
Definition hash-map.h:79
Key compare_type
Definition hash-map.h:48
static bool is_deleted(const hash_entry &e)
Definition hash-map.h:64
DEFINE_PCH_HELPER(unsigned long)
static void mark_empty(hash_entry &e)
Definition hash-map.h:70
static void remove(hash_entry &e)
Definition hash-map.h:60
static void ggc_mx(hash_entry &e)
Definition hash-map.h:73
static bool equal(const hash_entry &a, const Key &b)
Definition hash-map.h:55
static void pch_nx_helper(T *&x, gt_pointer_operator op, void *cookie)
Definition hash-map.h:112
hash_entry value_type
Definition hash-map.h:47
static int keep_cache_entry(hash_entry &e)
Definition hash-map.h:97
DEFINE_PCH_HELPER(unsigned int)
static void pch_nx(hash_entry &e)
Definition hash-map.h:85
static void pch_nx(hash_entry &e, gt_pointer_operator op, void *c)
Definition hash-map.h:91
DEFINE_PCH_HELPER(signed char)
DEFINE_PCH_HELPER(unsigned short)
static void pch_nx_helper(T &x, gt_pointer_operator op, void *cookie)
Definition hash-map.h:105
DEFINE_PCH_HELPER(long long)
#define NULL
Definition system.h:50
#define bool
Definition system.h:886
#define gcc_checking_assert(EXPR)
Definition system.h:821