C++ PATCH: Do not allocate conversions in GC-memory

Geoff Keating geoffk@geoffk.org
Fri Feb 13 19:48:00 GMT 2004


Mark Mitchell <mark@codesourcery.com> writes:

> This patch uses an obstack, rather than GC-able memory, to allocate
> the temporary storage we need while figuring out how to perform
> conversions.
> 
> On one test case we have, this reduced the number of calls to
> make_node from 3 million to 2.1 million and the number of calls to
> ggc_set_mark from 117 million to 2.9 million.  I saw an improvement of
> about 1.5% in compilation time, but I wouldn't be surprised if it
> would be better than that on a machine with less RAM.  (On the machine
> we used the memory allocated didn't exceed physical RAM at all.)
> 
> Anyhow, tested on i686-pc-linux-gnu and applied on the mainline.

Hi Mark,

> +   /* Free all the conversions we allocated.  */
> +   obstack_free (&conversion_obstack, p);

Could you add some ENABLE_CHECKING code to make sure that all the
memory in conversion_obstack gets zeroed (or something) in each place
where it's freed?  Otherwise there's no check that a pointer does not
escape.

How does this reduce the number of calls to ggc_set_mark?  Is it
possible that you're now storing pointers to GCed memory in non-GCed
memory, or is this entirely due to fewer ggc_collect runs?

Did you run a bootstrap with gcac checking?  I think that would be a
good idea.

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



More information about the Gcc-patches mailing list