[PATCH] Share int_cst nodes

Mark Mitchell mark@codesourcery.com
Wed Aug 18 17:23:00 GMT 2004


Nathan Sidwell wrote:
> Hi,
> This patch implements sharing of small INTEGER_CST nodes.  Measurement
> has shown improvement on a large (preprocessed) c++ file.  Allocated
> memory was reduced by 1MB (~3%) and compilation time improved by ~1.5%.

Yay!

> I have not tuned the size of the integer cache, earlier measurements shows
> that the sweetspot is probably in the range 32..128.
> 
> The cache is implemented by hanging a TREE_VEC off the TYPE_VALUES field
> of integer & pointer types.  This was only used for TYPE_ORIG_SIZE_TYPE,
> and that information is now placed in the TREE_TYPE of this new TREE_VEC.
> I added a TYPE_CACHED_VALUES_P flag, so other places know to clear the
> cache when copying a type.
> 
> I've inverted java's RADIX10 flag, so that more nodes can be shared there.
> 
> I added a fixme to const_mult_add_overflow_p, as you can see it is
> copying a type node on every unsigned call.  

Oh, that's rather unfortunate.  I don't know if it's used often, but, ugh...

> It would be nice if there
> was a bi-directional mapping from T<->sizeT.
> 
> booted & tested on i686-pc-linux-gnu, ok?

I think you should make TYPE_CACHED_LENGTH a --param thingy.

OK with that change.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com



More information about the Gcc-patches mailing list