Trim down memory usage in alias.c

Geoff Keating geoffk@geoffk.org
Wed Jan 21 16:34:00 GMT 2004


Jan Hubicka <jh@suse.cz> writes:

> > On Tue, Jan 20, 2004 at 09:39:21PM +0100, Jan Hubicka wrote:
> > > + static unsigned int old_reg_base_value_size;
> > [...]
> > > !       reg_base_value_size = old_reg_base_value_size;
> > > !       if (reg_base_value_size > maxreg * 2)
> > > ! 	reg_base_value_size = maxreg * 2;
> > [...]
> > > +   old_reg_base_value_size = reg_base_value_size;
> > 
> > Better than this, which crops the known size of the old array,
> > would be to use ggc_get_size when looking to reuse the old array.
> 
> Hi,
> here is updated patch, it uses the varray and scales other arrays down.
> It has passed bootstrap now, gc,gcac bootstrap is scheduled overnight.
> OK assuming it passes?
> 
> The savings are slightly higher (about 750Kb of varray overhead now)

This looks good to me.  I noticed:

!       VARRAY_RTX_INIT (reg_base_value, maxreg, "reg_base_value");

It seems like it would be better to initially make it larger than
'maxreg', since surely it will need to grow.  But I presume that if
this had required real memory allocation then you'd have seen extra
varray overhead, and you didn't, so it's probably OK.  (Wait a bit
before committing in case rth sees something I missed.)

-- 
- Geoffrey Keating <geoffk@geoffk.org>



More information about the Gcc-patches mailing list