Some GC marking inefficiency with chain_next and chain_prev

Geoffrey Keating geoffk@apple.com
Wed Dec 10 21:47:00 GMT 2003


On 10/12/2003, at 3:21 AM, S. Bosscher wrote:

> In other words, first we go over the next and prev chains because
> of the GTY markers "chain_next" and "chain_prev".  Then we look
> at those fields again in the loop, calling ggc_set_mark() on the
> prev and next fields again, but this has no effect since we've
> already marked them.

I noticed this when these options were implemented, but I couldn't see 
an easy to fix it without parsing the arguments to chain_next and 
chain_prev and knowing a lot about structure layout.  It's not a 
significant cost, since the data will already be in cache.

If you don't need chain_prev and chain_next, you shouldn't use them.  
When I tried automatically putting chain_next on every structure that 
looked like it could use it (*with* the improvement you suggest above, 
since if it's automatic you know which field doesn't need marking), GC 
slowed down measurably.



More information about the Gcc mailing list