summaryrefslogtreecommitdiff
path: root/gcc/vec.h
diff options
context:
space:
mode:
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-27 12:47:22 +0000
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-27 12:47:22 +0000
commit0ff42de5540c1e13b681449fdca9848ad13bf69b (patch)
tree4505b8171553fd7e780bb28532a4986cd72b6f4f /gcc/vec.h
parente3039589e2b21cccaa24e8fddab97045dfd3da9c (diff)
downloadgcc-0ff42de5540c1e13b681449fdca9848ad13bf69b.tar.gz
New memory allocation statistics infrastructure.
* Makefile.in: Add additional dependencies related to memory report enhancement. * alloc-pool.c (allocate_pool_descriptor): Use new ctor. * bitmap.c (struct bitmap_descriptor_d): Remove. (struct loc): Likewise. (struct bitmap_desc_hasher): Likewise. (bitmap_desc_hasher::hash): Likewise. (bitmap_desc_hasher::equal): Likewise. (get_bitmap_descriptor): Likewise. (bitmap_register): User new memory descriptor API. (register_overhead): Likewise. (bitmap_find_bit): Register nsearches and search_iter statistics. (struct bitmap_output_info): Remove. (print_statistics): Likewise. (dump_bitmap_statistics): Use new memory descriptor. * bitmap.h (struct bitmap_usage): New class. * genmatch.c: Extend header file inclusion. * genpreds.c: Likewise. * ggc-common.c (struct ggc_usage): New class. (struct ggc_loc_desc_hasher): Remove. (ggc_loc_desc_hasher::hash): Likewise. (ggc_loc_desc_hasher::equal): Likewise. (struct ggc_ptr_hash_entry): Likewise. (struct ptr_hash_hasher): Likewise. (ptr_hash_hasher::hash): Likewise. (ptr_hash_hasher::equal): Likewise. (make_loc_descriptor): Likewise. (ggc_prune_ptr): Likewise. (dump_ggc_loc_statistics): Use new memory descriptor. (ggc_record_overhead): Likewise. (ggc_free_overhead): Likewise. (final_cmp_statistic): Remove. (cmp_statistic): Likewise. (ggc_add_statistics): Liekwise. (ggc_prune_overhead_list): Likewise. * hash-map-traits.h: New file. * hash-map.h (struct default_hashmap_traits): Move the traits to a separate header file. * hash-set.h: Pass memory statistics info to ctor. * hash-table.c (void dump_hash_table_loc_statistics): New function. * hash-table.h (hash_table::hash_table): Add new ctor arguments. (hash_table::~hash_table): Register memory release operation. (hash_table::alloc_entries): Handle memory allocation operation. (hash_table::expand): Likewise. * inchash.c (iterative_hash_hashval_t): Move implementation to header file. (iterative_hash_host_wide_int): Likewise. * inchash.h (class hash): Likewise. * mem-stats-traits.h: New file. * mem-stats.h: New file. (mem_location): Add new class. (mem_usage): Likewise. (mem_alloc_description): Likewise. * sese.c: Add new header file inclusision. * toplev.c (dump_memory_report): Add report for hash_table, hash_map and hash_set. * tree-sra.c: Add new header file inclusision. * vec.c (struct vec_descriptor): Remove. (hash_descriptor): Likewise. (struct vec_usage): Likewise. (struct ptr_hash_entry): Likewise. (hash_ptr): Likewise. (eq_ptr): Likewise. (vec_prefix::register_overhead): Use new memory descriptor API. (vec_prefix::release_overhead): Likewise. (add_statistics): Remove. (dump_vec_loc_statistics): Use new memory descriptor API. * vec.h (struct vec_prefix): Likewise. (va_heap::reserve): Likewise. (va_heap::release): Likewise. * emit-rtl.c (gen_raw_REG): Fix passing MEM_STAT. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223748 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/vec.h')
-rw-r--r--gcc/vec.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/vec.h b/gcc/vec.h
index aa9a255bf97..7b9697922ad 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -51,7 +51,7 @@ along with GCC; see the file COPYING3. If not see
extern void ggc_free (void *);
extern size_t ggc_round_alloc_size (size_t requested_size);
- extern void *ggc_realloc (void *, size_t CXX_MEM_STAT_INFO);
+ extern void *ggc_realloc (void *, size_t MEM_STAT_DECL);
# endif // GCC_GGC_H
#endif // VEC_GC_ENABLED
@@ -206,6 +206,8 @@ along with GCC; see the file COPYING3. If not see
/* Support function for statistics. */
extern void dump_vec_loc_statistics (void);
+/* Hashtable mapping vec addresses to descriptors. */
+extern htab_t vec_mem_usage_hash;
/* Control data for vectors. This contains the number of allocated
and used slots inside a vector. */
@@ -216,8 +218,8 @@ struct vec_prefix
compilers that have stricter notions of PODness for types. */
/* Memory allocation support routines in vec.c. */
- void register_overhead (size_t, const char *, int, const char *);
- void release_overhead (void);
+ void register_overhead (void *, size_t, size_t CXX_MEM_STAT_INFO);
+ void release_overhead (void *, size_t, bool CXX_MEM_STAT_INFO);
static unsigned calculate_allocation (vec_prefix *, unsigned, bool);
static unsigned calculate_allocation_1 (unsigned, unsigned);
@@ -303,7 +305,7 @@ va_heap::reserve (vec<T, va_heap, vl_embed> *&v, unsigned reserve, bool exact
gcc_checking_assert (alloc);
if (GATHER_STATISTICS && v)
- v->m_vecpfx.release_overhead ();
+ v->m_vecpfx.release_overhead (v, v->allocated (), false);
size_t size = vec<T, va_heap, vl_embed>::embedded_size (alloc);
unsigned nelem = v ? v->length () : 0;
@@ -311,7 +313,7 @@ va_heap::reserve (vec<T, va_heap, vl_embed> *&v, unsigned reserve, bool exact
v->embedded_init (alloc, nelem);
if (GATHER_STATISTICS)
- v->m_vecpfx.register_overhead (size FINAL_PASS_MEM_STAT);
+ v->m_vecpfx.register_overhead (v, alloc, nelem PASS_MEM_STAT);
}
@@ -325,7 +327,7 @@ va_heap::release (vec<T, va_heap, vl_embed> *&v)
return;
if (GATHER_STATISTICS)
- v->m_vecpfx.release_overhead ();
+ v->m_vecpfx.release_overhead (v, v->allocated (), true);
::free (v);
v = NULL;
}