This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Faster compilation speed
On Wed, Aug 14, 2002 at 09:35:07PM +0100, Jamie Lokier wrote:
> Timothy J. Wood wrote:
> > I'm not sure what you mean. The external RC table only gets modified
> > once every 2^N operations already (and never if the internal RC never
> > overflows the internal RC). Stated another way, the internal RC holds
> > the low order bits and the external RC holds the high order bits.
>
> Ah, right, I misunderstood the code. Your way is a fine way.
> Presumably if it only gets called every 2^N operations at most, then
> it's not _strictly_ the high order bits in the hash table. I.e. I'm
> thinking of the reference pattern 127 -> 128 -> 127 -> 128...
A simpler strategy is to just make every object with RC >= 2^n immortal.
Something like:
add: if (rc) rc++;
subtract: if (rc) if (!--rc) delete;
For a program like gcc that doesn't have to absolutely guarantee it
leaks no memory, this can be an acceptable tradeoff.
(for belt and suspenders people, run a infrequent lazy gc to clean up
the scraps)
-Tim