diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-02-10 15:13:54 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-02-10 15:13:54 +0000 |
commit | 8cff878b277f9af6c2827a87581baac5f768e12a (patch) | |
tree | d4e178503efd243eed24ff3b753cd998370d75d4 /gcc/vec.h | |
parent | 9610b14f8599a9db94822d3f0923b58b2f1177dc (diff) | |
download | gcc-8cff878b277f9af6c2827a87581baac5f768e12a.tar.gz |
[./]
2016-02-10 Basile Starynkevitch <basile@starynkevitch.net>
{{merging with some of GCC 6, using
svn merge -r222130:226090 ^/trunk ; UNSTABLE}}
[gcc/]
2016-02-10 Basile Starynkevitch <basile@starynkevitch.net>
{{ merging with trunk 226090 ; UNSTABLE }}
* melt-run.proto.h: include tree-ssa-scopedtables.h
* tree-ssa-dom.c: skip second record_edge_info
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@233272 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/vec.h')
-rw-r--r-- | gcc/vec.h | 74 |
1 files changed, 26 insertions, 48 deletions
diff --git a/gcc/vec.h b/gcc/vec.h index 7d1bdafd92e..3e6e882b970 100644 --- a/gcc/vec.h +++ b/gcc/vec.h @@ -22,38 +22,14 @@ along with GCC; see the file COPYING3. If not see #ifndef GCC_VEC_H #define GCC_VEC_H -/* FIXME - When compiling some of the gen* binaries, we cannot enable GC - support because the headers generated by gengtype are still not - present. In particular, the header file gtype-desc.h is missing, - so compilation may fail if we try to include ggc.h. - - Since we use some of those declarations, we need to provide them - (even if the GC-based templates are not used). This is not a - problem because the code that runs before gengtype is built will - never need to use GC vectors. But it does force us to declare - these functions more than once. */ -#ifdef GENERATOR_FILE -#define VEC_GC_ENABLED 0 -#else -#define VEC_GC_ENABLED 1 -#endif // GENERATOR_FILE - -#include "statistics.h" // For CXX_MEM_STAT_INFO. - -#if VEC_GC_ENABLED -#include "ggc.h" -#else -# ifndef GCC_GGC_H - /* Even if we think that GC is not enabled, the test that sets it is - weak. There are files compiled with -DGENERATOR_FILE that already - include ggc.h. We only need to provide these definitions if ggc.h - has not been included. Sigh. */ - - 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); -# endif // GCC_GGC_H -#endif // VEC_GC_ENABLED +/* Some gen* file have no ggc support as the header file gtype-desc.h is + missing. Provide these definitions in case ggc.h has not been included. + This is not a problem because any code that runs before gengtype is built + will never need to use GC vectors.*/ + +extern void ggc_free (void *); +extern size_t ggc_round_alloc_size (size_t requested_size); +extern void *ggc_realloc (void *, size_t MEM_STAT_DECL); /* Templated vector type and associated interfaces. @@ -206,6 +182,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 +194,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); @@ -291,7 +269,7 @@ struct va_heap /* Allocator for heap memory. Ensure there are at least RESERVE free slots in V. If EXACT is true, grow exactly, else grow exponentially. As a special case, if the vector had not been - allocated and and RESERVE is 0, no vector will be created. */ + allocated and RESERVE is 0, no vector will be created. */ template<typename T> inline void @@ -303,7 +281,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 +289,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 +303,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; } @@ -366,7 +344,7 @@ va_gc::release (vec<T, A, vl_embed> *&v) /* Allocator for GC memory. Ensure there are at least RESERVE free slots in V. If EXACT is true, grow exactly, else grow exponentially. As a special case, if the vector had not been - allocated and and RESERVE is 0, no vector will be created. */ + allocated and RESERVE is 0, no vector will be created. */ template<typename T, typename A> void @@ -483,8 +461,8 @@ public: bool iterate (unsigned, T *) const; bool iterate (unsigned, T **) const; vec *copy (ALONE_CXX_MEM_STAT_INFO) const; - void splice (vec &); - void splice (vec *src); + void splice (const vec &); + void splice (const vec *src); T *quick_push (const T &); T &pop (void); void truncate (unsigned); @@ -705,7 +683,7 @@ vec_safe_copy (vec<T, A, vl_embed> *src CXX_MEM_STAT_INFO) Reallocate DST, if necessary. */ template<typename T, typename A> inline void -vec_safe_splice (vec<T, A, vl_embed> *&dst, vec<T, A, vl_embed> *src +vec_safe_splice (vec<T, A, vl_embed> *&dst, const vec<T, A, vl_embed> *src CXX_MEM_STAT_INFO) { unsigned src_len = vec_safe_length (src); @@ -836,7 +814,7 @@ vec<T, A, vl_embed>::copy (ALONE_MEM_STAT_DECL) const template<typename T, typename A> inline void -vec<T, A, vl_embed>::splice (vec<T, A, vl_embed> &src) +vec<T, A, vl_embed>::splice (const vec<T, A, vl_embed> &src) { unsigned len = src.length (); if (len) @@ -849,7 +827,7 @@ vec<T, A, vl_embed>::splice (vec<T, A, vl_embed> &src) template<typename T, typename A> inline void -vec<T, A, vl_embed>::splice (vec<T, A, vl_embed> *src) +vec<T, A, vl_embed>::splice (const vec<T, A, vl_embed> *src) { if (src) splice (*src); @@ -1212,8 +1190,8 @@ public: vec copy (ALONE_CXX_MEM_STAT_INFO) const; bool reserve (unsigned, bool = false CXX_MEM_STAT_INFO); bool reserve_exact (unsigned CXX_MEM_STAT_INFO); - void splice (vec &); - void safe_splice (vec & CXX_MEM_STAT_INFO); + void splice (const vec &); + void safe_splice (const vec & CXX_MEM_STAT_INFO); T *quick_push (const T &); T *safe_push (const T &CXX_MEM_STAT_INFO); T &pop (void); @@ -1489,7 +1467,7 @@ vec<T, va_heap, vl_ptr>::release (void) template<typename T> inline void -vec<T, va_heap, vl_ptr>::splice (vec<T, va_heap, vl_ptr> &src) +vec<T, va_heap, vl_ptr>::splice (const vec<T, va_heap, vl_ptr> &src) { if (src.m_vec) m_vec->splice (*(src.m_vec)); @@ -1503,7 +1481,7 @@ vec<T, va_heap, vl_ptr>::splice (vec<T, va_heap, vl_ptr> &src) template<typename T> inline void -vec<T, va_heap, vl_ptr>::safe_splice (vec<T, va_heap, vl_ptr> &src +vec<T, va_heap, vl_ptr>::safe_splice (const vec<T, va_heap, vl_ptr> &src MEM_STAT_DECL) { if (src.length ()) |