From patchwork Tue Nov 20 16:23:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Diego Novillo X-Patchwork-Id: 200383 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 269DB2C008E for ; Wed, 21 Nov 2012 03:24:04 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1354033446; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Date:From:To:Subject:Message-ID: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=UDOKiF1YyX7Uob92Tz42 Ftomsy4=; b=qzuIqnvbsHDhVhOVUj1G6ICuzTdvVsvhvIPyIgKzI6HhGi59gFLU zUB18TVXBUIowff5u5fjSPjz+MRhh/D7+UFgs7HuwX2/EDac+0/wH4OR9XNnIqU6 tD7boutTZub3my9YnsAmf6QldgH+ji6jlW+5elfZRlMqiIeh/1Xfy7o= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:Received:Received:Date:From:To:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=v2F8hnXOFw3i3RKTbbUJUjIYeHfNH2RJZJnR5CBIbWDfwuPYZJX8uA6GpP1Iq1 BdkvVBGWsk55Cw/OK1P8jXmQ3tT70xkwrDGYGLz90pcWcS9mx2V4u+9yDOhAYb/+ 7Wi7e6tjf52/HeQtZw0x1Or9OT8vEm3ktCPkObu5aoOOY=; Received: (qmail 15456 invoked by alias); 20 Nov 2012 16:23:51 -0000 Received: (qmail 15260 invoked by uid 22791); 20 Nov 2012 16:23:48 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, TW_CP, TW_ZJ X-Spam-Check-By: sourceware.org Received: from mail-ea0-f201.google.com (HELO mail-ea0-f201.google.com) (209.85.215.201) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 20 Nov 2012 16:23:38 +0000 Received: by mail-ea0-f201.google.com with SMTP id b14so400860eaa.2 for ; Tue, 20 Nov 2012 08:23:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:organization:user-agent:x-gm-message-state; bh=eBvrzlsFoDUBHhY3WW46CdRb4dVOPgefODhT088lqDw=; b=mEY2YUs4/BvqEqhGkc0h4lp5An7tYepid/BkoDLtbr44Wd1o9nlvGn8n92GdYDIUk6 66S7oUgsCKKOafpXugugwRJuHPqh/tbxbaoZutX8XywaTAbhkDXBt+ozX+aKZ7onzdpf vpHRuU9HZuJ9GjUh1XllqZ9CLFRUx/orQqEkK41kaIi7CkTVy4Y2ZHyyXw+Wmb9j+n2g r/BTdDq8DmAqBB6jnp9ZlJlFKCF/ibVibU9nFP01TvNmZoqAHBRoME4gUirOpSVqtXPL 2EIuxwKuqbxHbIdWbPvNChglctJowpT+zJeFKz+9BM4VWoBTKo82Xza0mDHU9s6Hv83n xApw== Received: by 10.14.209.66 with SMTP id r42mr12287506eeo.1.1353428616918; Tue, 20 Nov 2012 08:23:36 -0800 (PST) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id z47si3418530eel.0.2012.11.20.08.23.36 (version=TLSv1/SSLv3 cipher=AES128-SHA); Tue, 20 Nov 2012 08:23:36 -0800 (PST) Received: from torture.tor.corp.google.com (torture.tor.corp.google.com [172.30.222.16]) by hpza10.eem.corp.google.com (Postfix) with ESMTP id 6CF8420004E for ; Tue, 20 Nov 2012 08:23:36 -0800 (PST) Received: by torture.tor.corp.google.com (Postfix, from userid 54752) id 993E2C069F; Tue, 20 Nov 2012 11:23:35 -0500 (EST) Date: Tue, 20 Nov 2012 11:23:35 -0500 From: Diego Novillo To: gcc-patches@gcc.gnu.org Subject: [PR middle-end/55398] Convert vec<> into a POD Message-ID: <20121120162335.GA10447@google.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQmkLQ4BhZ+1FUkET30XGG/OMRTO8k7lMtXk+h7pAzCkNb5BmIZrqgYRaUS2ArQ8K6V41OSlrWiGFSmuGOgNNdhhRYqT5iStT12XOd5AGWndvncaybyMgLfqyIKaH6ZPQJiiTftxCVGrhzcWE/ooYyL8Ge7suHRBz8u0PbSpmANnzeSD453ERqTmIvf4O9MLwmYIErCsortQyDqe3yM4LNBHFadYeXDAoFMg+DePKJ4H4Px4M5k= X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This fixes PR 55398 by making vec<> a true POD. I thought we could get away with having private fields, but we can't. We fail to pass vec<> instances through varargs. The patch makes every field public and mangles the field names in the hope that no future patch will try to make use of them directly. It's horrible, but I could not think of anything better. I also added two small changes to va_heap::release and va_stack::release. If the vector to free is NULL, they do nothing. Tested with clang++ as the host compiler on x86_64. 2012-11-20 Diego Novillo PR middle-end/55398 * vec.h (class vec_prefix): Make every field public. Rename field alloc_ to alloc_PRIVATE_. Rename field num_ to num_PRIVATE_. Update all users. (class vec): Make every field public. Rename field pfx_ to pfx_PRIVATE_. Rename field data_ to data_PRIVATE_. Update all users. (class vec): Make every field public. Rename field vec_ to vec_PRIVATE_. Update all users. (va_heap::release): Do nothing if V is NULL. (va_stack::release): Likewise. --- gcc/ChangeLog | 15 ++++ gcc/vec.c | 13 ++-- gcc/vec.h | 203 ++++++++++++++++++++++++++++++--------------------------- 3 files changed, 130 insertions(+), 101 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7c07c32..21948b9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2012-11-20 Diego Novillo + + PR middle-end/55398 + * vec.h (class vec_prefix): Make every field public. + Rename field alloc_ to alloc_PRIVATE_. + Rename field num_ to num_PRIVATE_. + Update all users. + (class vec): Make every field public. + Rename field pfx_ to pfx_PRIVATE_. + Rename field data_ to data_PRIVATE_. + Update all users. + (class vec): Make every field public. + Rename field vec_ to vec_PRIVATE_. + Update all users. + 2012-11-20 Uros Bizjak * config/i386/i386.c (ix86_expand_call): Emit CLOBBERs in VOIDmode. diff --git a/gcc/vec.c b/gcc/vec.c index b213aba..3f8f550 100644 --- a/gcc/vec.c +++ b/gcc/vec.c @@ -121,8 +121,8 @@ vec_descriptor (const char *name, int line, const char *function) /* Account the overhead. */ void -vec_prefix::register_overhead (size_t size, const char *name, int line, - const char *function) +vec_prefix::register_overhead_PRIVATE_ (size_t size, const char *name, int line, + const char *function) { struct vec_descriptor *loc = vec_descriptor (name, line, function); struct ptr_hash_entry *p = XNEW (struct ptr_hash_entry); @@ -148,7 +148,7 @@ vec_prefix::register_overhead (size_t size, const char *name, int line, /* Notice that the memory allocated for the vector has been freed. */ void -vec_prefix::release_overhead (void) +vec_prefix::release_overhead_PRIVATE_ (void) { PTR *slot = htab_find_slot_with_hash (ptr_hash, this, htab_hash_pointer (this), @@ -165,15 +165,16 @@ vec_prefix::release_overhead (void) exponentially. PFX is the control data for the vector. */ unsigned -vec_prefix::calculate_allocation (vec_prefix *pfx, unsigned reserve, bool exact) +vec_prefix::calculate_allocation_PRIVATE_ (vec_prefix *pfx, unsigned reserve, + bool exact) { unsigned alloc = 0; unsigned num = 0; if (pfx) { - alloc = pfx->alloc_; - num = pfx->num_; + alloc = pfx->alloc_PRIVATE_; + num = pfx->num_PRIVATE_; } else if (!reserve) /* If there's no vector, and we've not requested anything, then we diff --git a/gcc/vec.h b/gcc/vec.h index b9be85c..61ae9bf 100644 --- a/gcc/vec.h +++ b/gcc/vec.h @@ -216,11 +216,13 @@ extern void dump_vec_loc_statistics (void); class vec_prefix { -protected: + /* FIXME - These fields should be private, but we need to cater to + compilers that have stricter notions of PODness for types. */ +public: /* Memory allocation support routines in vec.c. */ - void register_overhead (size_t, const char *, int, const char *); - void release_overhead (void); - static unsigned calculate_allocation (vec_prefix *, unsigned, bool); + void register_overhead_PRIVATE_ (size_t, const char *, int, const char *); + void release_overhead_PRIVATE_ (void); + static unsigned calculate_allocation_PRIVATE_ (vec_prefix *, unsigned, bool); /* Note that vec_prefix should be a base class for vec, but we use offsetof() on vector fields of tree structures (e.g., @@ -236,8 +238,8 @@ protected: friend struct va_heap; friend struct va_stack; - unsigned alloc_; - unsigned num_; + unsigned alloc_PRIVATE_; + unsigned num_PRIVATE_; }; template class vec; @@ -285,8 +287,8 @@ inline void va_heap::reserve (vec *&v, unsigned reserve, bool exact MEM_STAT_DECL) { - unsigned alloc = vec_prefix::calculate_allocation (v ? &v->pfx_ : 0, reserve, - exact); + unsigned alloc = vec_prefix::calculate_allocation_PRIVATE_ ( + v ? &v->pfx_PRIVATE_ : 0, reserve, exact); if (!alloc) { release (v); @@ -294,7 +296,7 @@ va_heap::reserve (vec *&v, unsigned reserve, bool exact } if (GATHER_STATISTICS && v) - v->pfx_.release_overhead (); + v->pfx_PRIVATE_.release_overhead_PRIVATE_ (); size_t size = vec::embedded_size (alloc); unsigned nelem = v ? v->length () : 0; @@ -302,7 +304,7 @@ va_heap::reserve (vec *&v, unsigned reserve, bool exact v->embedded_init (alloc, nelem); if (GATHER_STATISTICS) - v->pfx_.register_overhead (size FINAL_PASS_MEM_STAT); + v->pfx_PRIVATE_.register_overhead_PRIVATE_ (size FINAL_PASS_MEM_STAT); } @@ -312,8 +314,11 @@ template void va_heap::release (vec *&v) { + if (v == NULL) + return; + if (GATHER_STATISTICS) - v->pfx_.release_overhead (); + v->pfx_PRIVATE_.release_overhead_PRIVATE_ (); ::free (v); v = NULL; } @@ -349,8 +354,8 @@ void va_gc::reserve (vec *&v, unsigned reserve, bool exact MEM_STAT_DECL) { - unsigned alloc = vec_prefix::calculate_allocation (v ? &v->pfx_ : 0, reserve, - exact); + unsigned alloc = vec_prefix::calculate_allocation_PRIVATE_ ( + v ? &v->pfx_PRIVATE_ : 0, reserve, exact); if (!alloc) { ::ggc_free (v); @@ -418,9 +423,9 @@ void va_stack::alloc (vec &v, unsigned nelems, vec *space) { - v.vec_ = space; - register_stack_vec (static_cast (v.vec_)); - v.vec_->embedded_init (nelems, 0); + v.vec_PRIVATE_ = space; + register_stack_vec (static_cast (v.vec_PRIVATE_)); + v.vec_PRIVATE_->embedded_init (nelems, 0); } @@ -447,15 +452,17 @@ va_stack::reserve (vec *&v, unsigned nelems, bool exact } /* Move VEC_ to the heap. */ - nelems += v->pfx_.num_; + nelems += v->pfx_PRIVATE_.num_PRIVATE_; vec *oldvec = v; v = NULL; va_heap::reserve (reinterpret_cast *&>(v), nelems, exact); if (v && oldvec) { - v->pfx_.num_ = oldvec->length (); - memcpy (v->data_, oldvec->data_, oldvec->length () * sizeof (T)); + v->pfx_PRIVATE_.num_PRIVATE_ = oldvec->length (); + memcpy (v->data_PRIVATE_, + oldvec->data_PRIVATE_, + oldvec->length () * sizeof (T)); } } @@ -467,6 +474,9 @@ template void va_stack::release (vec *&v) { + if (v == NULL) + return; + int ix = stack_vec_register_index (static_cast (v)); if (ix >= 0) { @@ -531,11 +541,11 @@ template class GTY((user)) vec { public: - unsigned allocated (void) const { return pfx_.alloc_; } - unsigned length (void) const { return pfx_.num_; } - bool is_empty (void) const { return pfx_.num_ == 0; } - T *address (void) { return data_; } - const T *address (void) const { return data_; } + unsigned allocated (void) const { return pfx_PRIVATE_.alloc_PRIVATE_; } + unsigned length (void) const { return pfx_PRIVATE_.num_PRIVATE_; } + bool is_empty (void) const { return pfx_PRIVATE_.num_PRIVATE_ == 0; } + T *address (void) { return data_PRIVATE_; } + const T *address (void) const { return data_PRIVATE_; } const T &operator[] (unsigned) const; T &operator[] (unsigned); T &last (void); @@ -568,9 +578,10 @@ public: friend struct va_heap; friend struct va_stack; -private: - vec_prefix pfx_; - T data_[1]; + /* FIXME - These fields should be private, but we need to cater to + compilers that have stricter notions of PODness for types. */ + vec_prefix pfx_PRIVATE_; + T data_PRIVATE_[1]; }; @@ -782,16 +793,16 @@ template inline const T & vec::operator[] (unsigned ix) const { - gcc_checking_assert (ix < pfx_.num_); - return data_[ix]; + gcc_checking_assert (ix < pfx_PRIVATE_.num_PRIVATE_); + return data_PRIVATE_[ix]; } template inline T & vec::operator[] (unsigned ix) { - gcc_checking_assert (ix < pfx_.num_); - return data_[ix]; + gcc_checking_assert (ix < pfx_PRIVATE_.num_PRIVATE_); + return data_PRIVATE_[ix]; } @@ -801,8 +812,8 @@ template inline T & vec::last (void) { - gcc_checking_assert (pfx_.num_ > 0); - return (*this)[pfx_.num_ - 1]; + gcc_checking_assert (pfx_PRIVATE_.num_PRIVATE_ > 0); + return (*this)[pfx_PRIVATE_.num_PRIVATE_ - 1]; } @@ -816,7 +827,7 @@ template inline bool vec::space (unsigned nelems) const { - return pfx_.alloc_ - pfx_.num_ >= nelems; + return pfx_PRIVATE_.alloc_PRIVATE_ - pfx_PRIVATE_.num_PRIVATE_ >= nelems; } @@ -831,9 +842,9 @@ template inline bool vec::iterate (unsigned ix, T *ptr) const { - if (ix < pfx_.num_) + if (ix < pfx_PRIVATE_.num_PRIVATE_) { - *ptr = data_[ix]; + *ptr = data_PRIVATE_[ix]; return true; } else @@ -857,9 +868,9 @@ template inline bool vec::iterate (unsigned ix, T **ptr) const { - if (ix < pfx_.num_) + if (ix < pfx_PRIVATE_.num_PRIVATE_) { - *ptr = CONST_CAST (T *, &data_[ix]); + *ptr = CONST_CAST (T *, &data_PRIVATE_[ix]); return true; } else @@ -882,7 +893,7 @@ vec::copy (ALONE_MEM_STAT_DECL) const { vec_alloc (new_vec, len PASS_MEM_STAT); new_vec->embedded_init (len, len); - memcpy (new_vec->address(), data_, sizeof (T) * len); + memcpy (new_vec->address(), data_PRIVATE_, sizeof (T) * len); } return new_vec; } @@ -900,7 +911,7 @@ vec::splice (vec &src) { gcc_checking_assert (space (len)); memcpy (address() + length(), src.address(), len * sizeof (T)); - pfx_.num_ += len; + pfx_PRIVATE_.num_PRIVATE_ += len; } } @@ -922,7 +933,7 @@ inline T * vec::quick_push (const T &obj) { gcc_checking_assert (space (1)); - T *slot = &data_[pfx_.num_++]; + T *slot = &data_PRIVATE_[pfx_PRIVATE_.num_PRIVATE_++]; *slot = obj; return slot; } @@ -935,7 +946,7 @@ inline T & vec::pop (void) { gcc_checking_assert (length () > 0); - return data_[--pfx_.num_]; + return data_PRIVATE_[--pfx_PRIVATE_.num_PRIVATE_]; } @@ -947,7 +958,7 @@ inline void vec::truncate (unsigned size) { gcc_checking_assert (length () >= size); - pfx_.num_ = size; + pfx_PRIVATE_.num_PRIVATE_ = size; } @@ -960,8 +971,8 @@ vec::quick_insert (unsigned ix, const T &obj) { gcc_checking_assert (length () < allocated ()); gcc_checking_assert (ix <= length ()); - T *slot = &data_[ix]; - memmove (slot + 1, slot, (pfx_.num_++ - ix) * sizeof (T)); + T *slot = &data_PRIVATE_[ix]; + memmove (slot + 1, slot, (pfx_PRIVATE_.num_PRIVATE_++ - ix) * sizeof (T)); *slot = obj; } @@ -975,8 +986,8 @@ inline void vec::ordered_remove (unsigned ix) { gcc_checking_assert (ix < length()); - T *slot = &data_[ix]; - memmove (slot, slot + 1, (--pfx_.num_ - ix) * sizeof (T)); + T *slot = &data_PRIVATE_[ix]; + memmove (slot, slot + 1, (--pfx_PRIVATE_.num_PRIVATE_ - ix) * sizeof (T)); } @@ -988,7 +999,7 @@ inline void vec::unordered_remove (unsigned ix) { gcc_checking_assert (ix < length()); - data_[ix] = data_[--pfx_.num_]; + data_PRIVATE_[ix] = data_PRIVATE_[--pfx_PRIVATE_.num_PRIVATE_]; } @@ -1000,9 +1011,9 @@ inline void vec::block_remove (unsigned ix, unsigned len) { gcc_checking_assert (ix + len <= length()); - T *slot = &data_[ix]; - pfx_.num_ -= len; - memmove (slot, slot + len, (pfx_.num_ - ix) * sizeof (T)); + T *slot = &data_PRIVATE_[ix]; + pfx_PRIVATE_.num_PRIVATE_ -= len; + memmove (slot, slot + len, (pfx_PRIVATE_.num_PRIVATE_ - ix) * sizeof (T)); } @@ -1066,7 +1077,7 @@ inline size_t vec::embedded_size (unsigned alloc) { typedef vec vec_embedded; - return offsetof (vec_embedded, data_) + alloc * sizeof (T); + return offsetof (vec_embedded, data_PRIVATE_) + alloc * sizeof (T); } @@ -1077,8 +1088,8 @@ template inline void vec::embedded_init (unsigned alloc, unsigned num) { - pfx_.alloc_ = alloc; - pfx_.num_ = num; + pfx_PRIVATE_.alloc_PRIVATE_ = alloc; + pfx_PRIVATE_.num_PRIVATE_ = num; } @@ -1089,8 +1100,8 @@ template inline void vec::quick_grow (unsigned len) { - gcc_checking_assert (length () <= len && len <= pfx_.alloc_); - pfx_.num_ = len; + gcc_checking_assert (length () <= len && len <= pfx_PRIVATE_.alloc_PRIVATE_); + pfx_PRIVATE_.num_PRIVATE_ = len; } @@ -1195,22 +1206,22 @@ public: /* Vector operations. */ bool exists (void) const - { return vec_ != NULL; } + { return vec_PRIVATE_ != NULL; } bool is_empty (void) const - { return vec_ ? vec_->is_empty() : true; } + { return vec_PRIVATE_ ? vec_PRIVATE_->is_empty() : true; } unsigned length (void) const - { return vec_ ? vec_->length() : 0; } + { return vec_PRIVATE_ ? vec_PRIVATE_->length() : 0; } T *address (void) - { return vec_ ? vec_->data_ : NULL; } + { return vec_PRIVATE_ ? vec_PRIVATE_->data_PRIVATE_ : NULL; } const T *address (void) const - { return vec_ ? vec_->data_ : NULL; } + { return vec_PRIVATE_ ? vec_PRIVATE_->data_PRIVATE_ : NULL; } const T &operator[] (unsigned ix) const - { return (*vec_)[ix]; } + { return (*vec_PRIVATE_)[ix]; } bool operator!=(const vec &other) const { return !(*this == other); } @@ -1219,13 +1230,13 @@ public: { return address() == other.address(); } T &operator[] (unsigned ix) - { return (*vec_)[ix]; } + { return (*vec_PRIVATE_)[ix]; } T &last (void) - { return vec_->last(); } + { return vec_PRIVATE_->last(); } bool space (int nelems) const - { return vec_ ? vec_->space (nelems) : nelems == 0; } + { return vec_PRIVATE_ ? vec_PRIVATE_->space (nelems) : nelems == 0; } bool iterate (unsigned ix, T *p) const; bool iterate (unsigned ix, T **p) const; @@ -1254,8 +1265,9 @@ public: friend void va_stack::alloc(vec&, unsigned, vec *); -private: - vec *vec_; + /* FIXME - This field should be private, but we need to cater to + compilers that have stricter notions of PODness for types. */ + vec *vec_PRIVATE_; }; @@ -1358,8 +1370,8 @@ template inline bool vec::iterate (unsigned ix, T *ptr) const { - if (vec_) - return vec_->iterate (ix, ptr); + if (vec_PRIVATE_) + return vec_PRIVATE_->iterate (ix, ptr); else { *ptr = 0; @@ -1381,8 +1393,8 @@ template inline bool vec::iterate (unsigned ix, T **ptr) const { - if (vec_) - return vec_->iterate (ix, ptr); + if (vec_PRIVATE_) + return vec_PRIVATE_->iterate (ix, ptr); else { *ptr = 0; @@ -1422,7 +1434,7 @@ vec::copy (ALONE_MEM_STAT_DECL) const { vec new_vec = vec(); if (length ()) - new_vec.vec_ = vec_->copy (); + new_vec.vec_PRIVATE_ = vec_PRIVATE_->copy (); return new_vec; } @@ -1442,7 +1454,7 @@ vec::reserve (unsigned nelems, bool exact MEM_STAT_DECL) { bool extend = nelems ? !space (nelems) : false; if (extend) - A::reserve (vec_, nelems, exact PASS_MEM_STAT); + A::reserve (vec_PRIVATE_, nelems, exact PASS_MEM_STAT); return extend; } @@ -1469,7 +1481,7 @@ template inline void vec::create (unsigned nelems MEM_STAT_DECL) { - vec_ = NULL; + vec_PRIVATE_ = NULL; if (nelems > 0) reserve_exact (nelems PASS_MEM_STAT); } @@ -1481,8 +1493,8 @@ template inline void vec::release (void) { - if (vec_) - A::release (vec_); + if (vec_PRIVATE_) + A::release (vec_PRIVATE_); } @@ -1495,8 +1507,8 @@ template inline void vec::splice (vec &src) { - if (src.vec_) - vec_->splice (*(src.vec_)); + if (src.vec_PRIVATE_) + vec_PRIVATE_->splice (*(src.vec_PRIVATE_)); } @@ -1525,7 +1537,7 @@ template inline T * vec::quick_push (const T &obj) { - return vec_->quick_push (obj); + return vec_PRIVATE_->quick_push (obj); } @@ -1548,7 +1560,7 @@ template inline T & vec::pop (void) { - return vec_->pop (); + return vec_PRIVATE_->pop (); } @@ -1559,8 +1571,8 @@ template inline void vec::truncate (unsigned size) { - if (vec_) - vec_->truncate (size); + if (vec_PRIVATE_) + vec_PRIVATE_->truncate (size); else gcc_checking_assert (size == 0); } @@ -1577,7 +1589,7 @@ vec::safe_grow (unsigned len MEM_STAT_DECL) unsigned oldlen = length (); gcc_checking_assert (oldlen <= len); reserve_exact (len - oldlen PASS_MEM_STAT); - vec_->quick_grow (len); + vec_PRIVATE_->quick_grow (len); } @@ -1602,8 +1614,8 @@ template inline void vec::quick_grow (unsigned len) { - gcc_checking_assert (vec_); - vec_->quick_grow (len); + gcc_checking_assert (vec_PRIVATE_); + vec_PRIVATE_->quick_grow (len); } @@ -1615,8 +1627,8 @@ template inline void vec::quick_grow_cleared (unsigned len) { - gcc_checking_assert (vec_); - vec_->quick_grow_cleared (len); + gcc_checking_assert (vec_PRIVATE_); + vec_PRIVATE_->quick_grow_cleared (len); } @@ -1627,7 +1639,7 @@ template inline void vec::quick_insert (unsigned ix, const T &obj) { - vec_->quick_insert (ix, obj); + vec_PRIVATE_->quick_insert (ix, obj); } @@ -1651,7 +1663,7 @@ template inline void vec::ordered_remove (unsigned ix) { - vec_->ordered_remove (ix); + vec_PRIVATE_->ordered_remove (ix); } @@ -1662,7 +1674,7 @@ template inline void vec::unordered_remove (unsigned ix) { - vec_->unordered_remove (ix); + vec_PRIVATE_->unordered_remove (ix); } @@ -1673,7 +1685,7 @@ template inline void vec::block_remove (unsigned ix, unsigned len) { - vec_->block_remove (ix, len); + vec_PRIVATE_->block_remove (ix, len); } @@ -1684,8 +1696,8 @@ template inline void vec::qsort (int (*cmp) (const void *, const void *)) { - if (vec_) - vec_->qsort (cmp); + if (vec_PRIVATE_) + vec_PRIVATE_->qsort (cmp); } @@ -1696,9 +1708,10 @@ vec::qsort (int (*cmp) (const void *, const void *)) template inline unsigned -vec::lower_bound (T obj, bool (*lessthan)(const T &, const T &)) const +vec::lower_bound (T obj, bool (*lessthan)(const T &, const T &)) + const { - return vec_ ? vec_->lower_bound (obj, lessthan) : 0; + return vec_PRIVATE_ ? vec_PRIVATE_->lower_bound (obj, lessthan) : 0; } #endif // GCC_VEC_H