Convert some varray stacks into vector stacks
Nathan Sidwell
nathan@codesourcery.com
Thu Nov 25 17:53:00 GMT 2004
Diego Novillo wrote:
> I was going to start changing more varrays, but there's an interface
> wrinkle in VEC_* that I'd like to address first. The way we tell VEC_*
> that a vector should be allocated in the heap is pretty intrusive. If
> we have a type T which we sometimes want on the heap and other times on
> GC memory, we need to create a separate type T' first. This happened to
> 'tree'. We are now forced to have a second type 'tree_on_heap' for
> vectors we want in the heap, because 'tree' is already tagged for GC
> vectors.
It appears that design decision wasn't so good. I did not expect
such dynamism in the allocation choice :(
> Perhaps we could change that when we allocate the vector the first time?
> Something like 'vec = VEC_alloc (T, size, HEAP)'.
we'd also have to amend VEC_safe_push, VEC_safe_insert and VEC_reserve.
The alternative of holding state in the VEC to indicate its allocation
scheme (like the bitmaps), won't work, because an empty vector can
be represented with a NULL pointer.
Of course this would be 4.1 material, so we don't have to go rushing into
things.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
More information about the Gcc-patches
mailing list