This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][C++] Save memory and reallocations in name-lookup


On Fri, Aug 17, 2012 at 6:55 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Fri, Aug 17, 2012 at 06:41:37AM -0500, Gabriel Dos Reis wrote:
>> I am however concerned with:
>>
>> >   static void
>> >   store_bindings (tree names, VEC(cxx_saved_binding,gc) **old_bindings)
>> >   {
>> > !   static VEC(tree,heap) *bindings_need_stored = NULL;
>>
>> I would be more comfortable to see the cache be on per-scope
>> (e.g. namespace scope) basis as opposed
>> a blanket global cache stored in a global variable.
>
> It is not any kind of cache.  It could be in theory an automatic variable
> vector pointer, it is only used during that function.  The reason why it is
> static variable instead is just to avoid constant allocation/deallocation
> of the vector, this way after the first call it will be already allocated
> (but, upon entry to store_bindings will always be empty).

Ah, OK.  The patch is OK then.
Thanks,

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]