Commit 465b8e7f by Jakub Jelinek Committed by Jakub Jelinek

hash-table.h (hash_table::m_gather_mem_stats): If GATHER_STATISTICS is constant 0...

	* hash-table.h (hash_table::m_gather_mem_stats): If GATHER_STATISTICS
	is constant 0, turn into static const data member initialized to false.
	(hash_table::hash_table): Only initialize m_gather_mem_stats #if
	GATHER_STATISTICS.  Add ATTRIBUTE_UNUSED to gather_mem_stats param.

From-SVN: r269944
parent a6f36166
2019-03-26 Jakub Jelinek <jakub@redhat.com>
* hash-table.h (hash_table::m_gather_mem_stats): If GATHER_STATISTICS
is constant 0, turn into static const data member initialized to false.
(hash_table::hash_table): Only initialize m_gather_mem_stats #if
GATHER_STATISTICS. Add ATTRIBUTE_UNUSED to gather_mem_stats param.
2019-03-26 Jason Merrill <jason@redhat.com> 2019-03-26 Jason Merrill <jason@redhat.com>
Jakub Jelinek <jakub@redhat.com> Jakub Jelinek <jakub@redhat.com>
......
...@@ -562,7 +562,11 @@ private: ...@@ -562,7 +562,11 @@ private:
bool m_ggc; bool m_ggc;
/* If we should gather memory statistics for the table. */ /* If we should gather memory statistics for the table. */
#if GATHER_STATISTICS
bool m_gather_mem_stats; bool m_gather_mem_stats;
#else
static const bool m_gather_mem_stats = false;
#endif
}; };
/* As mem-stats.h heavily utilizes hash maps (hash tables), we have to include /* As mem-stats.h heavily utilizes hash maps (hash tables), we have to include
...@@ -579,11 +583,15 @@ extern void dump_hash_table_loc_statistics (void); ...@@ -579,11 +583,15 @@ extern void dump_hash_table_loc_statistics (void);
template<typename Descriptor, bool Lazy, template<typename Descriptor, bool Lazy,
template<typename Type> class Allocator> template<typename Type> class Allocator>
hash_table<Descriptor, Lazy, Allocator>::hash_table (size_t size, bool ggc, hash_table<Descriptor, Lazy, Allocator>::hash_table (size_t size, bool ggc,
bool gather_mem_stats, bool gather_mem_stats
ATTRIBUTE_UNUSED,
mem_alloc_origin origin mem_alloc_origin origin
MEM_STAT_DECL) : MEM_STAT_DECL) :
m_n_elements (0), m_n_deleted (0), m_searches (0), m_collisions (0), m_n_elements (0), m_n_deleted (0), m_searches (0), m_collisions (0),
m_ggc (ggc), m_gather_mem_stats (gather_mem_stats) m_ggc (ggc)
#if GATHER_STATISTICS
, m_gather_mem_stats (gather_mem_stats)
#endif
{ {
unsigned int size_prime_index; unsigned int size_prime_index;
...@@ -606,12 +614,15 @@ template<typename Descriptor, bool Lazy, ...@@ -606,12 +614,15 @@ template<typename Descriptor, bool Lazy,
template<typename Type> class Allocator> template<typename Type> class Allocator>
hash_table<Descriptor, Lazy, Allocator>::hash_table (const hash_table &h, hash_table<Descriptor, Lazy, Allocator>::hash_table (const hash_table &h,
bool ggc, bool ggc,
bool gather_mem_stats, bool gather_mem_stats
ATTRIBUTE_UNUSED,
mem_alloc_origin origin mem_alloc_origin origin
MEM_STAT_DECL) : MEM_STAT_DECL) :
m_n_elements (h.m_n_elements), m_n_deleted (h.m_n_deleted), m_n_elements (h.m_n_elements), m_n_deleted (h.m_n_deleted),
m_searches (0), m_collisions (0), m_ggc (ggc), m_searches (0), m_collisions (0), m_ggc (ggc)
m_gather_mem_stats (gather_mem_stats) #if GATHER_STATISTICS
, m_gather_mem_stats (gather_mem_stats)
#endif
{ {
size_t size = h.m_size; size_t size = h.m_size;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment