[C++ PATCH] Fix 14179 - memory-hog

Nathan Sidwell nathan@codesourcery.com
Mon Sep 20 11:17:00 GMT 2004


Giovanni Bajo wrote:

> This patch fixes it, by using a couple of unsigned HOST_WIDE_INTEGER (low+high)
> instead. This mimics INTEGER_CSTs but without building trees every time. I
> guess we cannot do it with a single HWI for cases like crosscompiling a 32bit
> application with arrays with more than 65536 elements on a 16bit host, so this
> is why I am using a couple of them (just like INTEGER_CST).

We do not support hosts where int is < 32 bits. A single HOST_WIDE_INTEGER
will suffice.

> With a reduced testcases with half million elements, we save approximately
> 13Mb. On the full testcase, the projected gain is around 200Mb. Together with
> Nathan's cache for INTEGER_CSTs, I think this solves the memory-hog on
> mainline. I will update the PR with updated measurements when/if this patch
> goes in.
One thing more thing that might be worth trying would be to resurrect
the size_int hash table for ints which don't fit in the little type specific
vector.

> Bootstrapped on i686-pc-linux-gnu, OK for mainline?
ok with the above change.

> OK for 3.4 and 3.3 too? The patch does cure a regression, and it looks pretty
> safe to me. The diff looks more complex than it needs because of some
> refactoring and extracting the code into a new function -- if needed, I can
> prepare a stripped down version with minimal intrusiveness (assuming it's an
> English word...).
Please ask Gaby and Mark directly.

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