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 RFC: Implement and use VEC(T,stack)


Wow, thanks for this patch!

On Jun  9, 2009, Ian Lance Taylor <ian@airs.com> wrote:

> +   #define VEC_{TYPE}_stack_alloc(alloc)                          \
> +    (VEC_op(df_ref,stack,alloc1)                                  \
               {TYPE} rather than df_ref

> +static htab_t stack_vecs;

Ooh!  It didn't occur to me to use a separate data structure to keep
track of what was alloca()ed.


I wonder if it would make sense to introduce an attribute with a cleanup
that could be used to verify or even automate (GCC-only) the release of
the vector in case it gets reallocated.  Considering that it is supposed
to most often not be reallocated into the heap, this would probably work
well even in stage1, when the attribute may be unavailable.  This would
help catch (at run time) mistakes such as returning the alloca()ed
array.

> +  VEC_free (df_ref, stack, collection_rec->def_vec);
> +  VEC_free (df_ref, stack, collection_rec->use_vec);
> +  VEC_free (df_ref, stack, collection_rec->eq_use_vec);
> +  VEC_free (df_mw_hardreg_ptr, stack, collection_rec->mw_vec);

Can we have C++ please? :-) :-)

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer


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