diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 230de334b7c9..03ed43a789d3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2012-11-27 Diego Novillo + + * vec.h: Replace 'class vec' with 'struct vec' everywhere. + (ggc_internal_cleared_alloc_stat): Remove. + (va_gc::reserve): Add PASS_MEM_STAT to ggc_realloc_stat call. + (va_stack::reserve): Add PASS_MEM_STAT to va_heap::reserve call. + (vec::copy): Replace ALONE_MEM_STAT_DECL with + ALONE_CXX_MEM_STAT_INFO. + (vec_safe_reserve): Replace MEM_STAT_DECL with CXX_MEM_STAT_INFO. + (vec_safe_reserve_exact): Likewise. + (vec_alloc): Likewise. + (vec_safe_grow): Likewise. + (vec_safe_grow_cleared): Likewise. + (vec_safe_push): Likewise. + (vec_safe_insert): Likewise. + (vec_safe_splice): Likewise. + (vec_alloc): Likewise. + (vec_check_alloc): Likewise. + 2012-11-27 Marc Glisse * tree-cfg.c (verify_gimple_comparison): Verify that vector diff --git a/gcc/vec.h b/gcc/vec.h index bfc1811f6518..a7b3b4cdc823 100644 --- a/gcc/vec.h +++ b/gcc/vec.h @@ -51,8 +51,6 @@ along with GCC; see the file COPYING3. If not see has not been included. Sigh. */ extern void ggc_free (void *); extern size_t ggc_round_alloc_size (size_t requested_size); - extern void *ggc_internal_cleared_alloc_stat (size_t MEM_STAT_DECL) - ATTRIBUTE_MALLOC; extern void *ggc_realloc_stat (void *, size_t MEM_STAT_DECL); # endif // GCC_GGC_H #endif // VEC_GC_ENABLED @@ -230,7 +228,7 @@ struct vec_prefix To compensate, we make vec_prefix a field inside vec and make vec a friend class of vec_prefix so it can access its fields. */ - template friend class vec; + template friend struct vec; /* The allocator types also need access to our internals. */ friend struct va_gc; @@ -242,7 +240,7 @@ struct vec_prefix unsigned num_; }; -template class vec; +template struct vec; /* Valid vector layouts @@ -367,7 +365,7 @@ va_gc::reserve (vec *&v, unsigned reserve, bool exact size_t size = vec::embedded_size (alloc); /* Ask the allocator how much space it will really give us. */ - size = ggc_round_alloc_size (size); + size = ::ggc_round_alloc_size (size); /* Adjust the number of slots accordingly. */ size_t vec_offset = sizeof (vec_prefix); @@ -378,7 +376,8 @@ va_gc::reserve (vec *&v, unsigned reserve, bool exact size = vec_offset + alloc * elt_size; unsigned nelem = v ? v->length () : 0; - v = static_cast *> (ggc_realloc_stat (v, size)); + v = static_cast *> (::ggc_realloc_stat (v, size + PASS_MEM_STAT)); v->embedded_init (alloc, nelem); } @@ -447,7 +446,7 @@ va_stack::reserve (vec *&v, unsigned nelems, bool exact { /* V is already on the heap. */ va_heap::reserve (reinterpret_cast *&> (v), - nelems, exact); + nelems, exact PASS_MEM_STAT); return; } @@ -456,7 +455,7 @@ va_stack::reserve (vec *&v, unsigned nelems, bool exact vec *oldvec = v; v = NULL; va_heap::reserve (reinterpret_cast *&>(v), nelems, - exact); + exact PASS_MEM_STAT); if (v && oldvec) { v->vecpfx_.num_ = oldvec->length (); @@ -506,7 +505,7 @@ va_stack::release (vec *&v) template -class GTY((user)) vec +struct GTY((user)) vec { }; @@ -549,7 +548,7 @@ extern vnull vNULL; - It requires 2 words of storage (prior to vector allocation). */ template -class GTY((user)) vec +struct GTY((user)) vec { public: unsigned allocated (void) const { return vecpfx_.alloc_; } @@ -563,7 +562,7 @@ class GTY((user)) vec bool space (unsigned) const; bool iterate (unsigned, T *) const; bool iterate (unsigned, T **) const; - vec *copy (ALONE_MEM_STAT_DECL) const; + vec *copy (ALONE_CXX_MEM_STAT_INFO) const; void splice (vec &); void splice (vec *src); T *quick_push (const T &); @@ -581,7 +580,7 @@ class GTY((user)) vec void quick_grow_cleared (unsigned len); /* vec class can access our internal data and functions. */ - template friend class vec; + template friend struct vec; /* The allocator types also need access to our internals. */ friend struct va_gc; @@ -651,7 +650,7 @@ vec_safe_is_empty (vec *v) template inline bool vec_safe_reserve (vec *&v, unsigned nelems, bool exact = false - MEM_STAT_DECL) + CXX_MEM_STAT_INFO) { bool extend = nelems ? !vec_safe_space (v, nelems) : false; if (extend) @@ -661,7 +660,8 @@ vec_safe_reserve (vec *&v, unsigned nelems, bool exact = false template inline bool -vec_safe_reserve_exact (vec *&v, unsigned nelems MEM_STAT_DECL) +vec_safe_reserve_exact (vec *&v, unsigned nelems + CXX_MEM_STAT_INFO) { return vec_safe_reserve (v, nelems, true PASS_MEM_STAT); } @@ -672,10 +672,10 @@ vec_safe_reserve_exact (vec *&v, unsigned nelems MEM_STAT_DECL) template inline void -vec_alloc (vec *&v, unsigned nelems MEM_STAT_DECL) +vec_alloc (vec *&v, unsigned nelems CXX_MEM_STAT_INFO) { v = NULL; - vec_safe_reserve (v, nelems); + vec_safe_reserve (v, nelems, false PASS_MEM_STAT); } @@ -692,19 +692,19 @@ vec_free (vec *&v) /* Grow V to length LEN. Allocate it, if necessary. */ template inline void -vec_safe_grow (vec *&v, unsigned len MEM_STAT_DECL) +vec_safe_grow (vec *&v, unsigned len CXX_MEM_STAT_INFO) { unsigned oldlen = vec_safe_length (v); gcc_checking_assert (len >= oldlen); vec_safe_reserve_exact (v, len - oldlen PASS_MEM_STAT); - v->quick_grow (len PASS_MEM_STAT); + v->quick_grow (len); } /* If V is NULL, allocate it. Call V->safe_grow_cleared(LEN). */ template inline void -vec_safe_grow_cleared (vec *&v, unsigned len MEM_STAT_DECL) +vec_safe_grow_cleared (vec *&v, unsigned len CXX_MEM_STAT_INFO) { unsigned oldlen = vec_safe_length (v); vec_safe_grow (v, len PASS_MEM_STAT); @@ -744,10 +744,10 @@ vec_safe_iterate (const vec *v, unsigned ix, T *ptr) V->quick_push(OBJ). */ template inline T * -vec_safe_push (vec *&v, const T &obj MEM_STAT_DECL) +vec_safe_push (vec *&v, const T &obj CXX_MEM_STAT_INFO) { vec_safe_reserve (v, 1, false PASS_MEM_STAT); - return v->quick_push (obj PASS_MEM_STAT); + return v->quick_push (obj); } @@ -756,7 +756,7 @@ vec_safe_push (vec *&v, const T &obj MEM_STAT_DECL) template inline void vec_safe_insert (vec *&v, unsigned ix, const T &obj - MEM_STAT_DECL) + CXX_MEM_STAT_INFO) { vec_safe_reserve (v, 1, false PASS_MEM_STAT); v->quick_insert (ix, obj); @@ -786,12 +786,13 @@ vec_safe_copy (vec *src) template inline void vec_safe_splice (vec *&dst, vec *src - MEM_STAT_DECL) + CXX_MEM_STAT_INFO) { unsigned src_len = vec_safe_length (src); if (src_len) { - vec_safe_reserve_exact (dst, vec_safe_length (dst) + src_len); + vec_safe_reserve_exact (dst, vec_safe_length (dst) + src_len + PASS_MEM_STAT); dst->splice (*src); } } @@ -1207,7 +1208,7 @@ gt_pch_nx (vec *v, gt_pointer_operator op, void *cookie) destructors in classes that are stored in unions. */ template -class vec +struct vec { public: /* Memory allocation and deallocation for the embedded vector. @@ -1287,7 +1288,7 @@ class vec circumvent limitations in the GTY machinery. */ template -class vec +struct vec { }; @@ -1298,7 +1299,7 @@ class vec template inline void -vec_alloc (vec *&v, unsigned nelems MEM_STAT_DECL) +vec_alloc (vec *&v, unsigned nelems CXX_MEM_STAT_INFO) { v = new vec; v->create (nelems PASS_MEM_STAT); @@ -1309,7 +1310,7 @@ vec_alloc (vec *&v, unsigned nelems MEM_STAT_DECL) template inline void -vec_check_alloc (vec *&vec, unsigned nelems MEM_STAT_DECL) +vec_check_alloc (vec *&vec, unsigned nelems CXX_MEM_STAT_INFO) { if (!vec) vec_alloc (vec, nelems PASS_MEM_STAT);