This is the mail archive of the
mailing list for the GCC project.
Re: [patch] tree-ssa-operands.c: Use VEC instead of VARRAY.
> They are not work vectors. They are a cache for the potentially long
> strings of virtual operands that are added at call sites. They can last
> for the duration of the operand cache, so they could be xmalloc'd.
OK. Do the contents of these arrays have to be visible from GC? Or
if they are cache, I guess somebody else should be pointing to
operands that the arrays also point to, so we don't need GTY?
> The reason they aren't allocated during operand initialization is to
> simply avoid allocating them if it is a function without a relevant
> call. I think I would prefer to keep those semantics, but I guess a
> couple of small allocations wouldn't be a big deal.
> I don't see where you call VEC_alloc in the patch. Does VEC_truncate do
> that if it isn't allocated??
VEC_safe_push will allocate memory as needed. It even allocates
memory for administrative bits like the size of an array and the size
of allocated space. So, yes, if you like lazy allocations, VEC is
there for you.