[gclist] Treadmill doubly-linked list costs

Eric Benson ebenson@netscape.com
Tue, 05 Mar 1996 13:09:48 -0800


Jerry Leichter wrote:
> While it doesn't solve the general problem, you can easily cut the overhead in
> half, using an old trick:  Use just a single pointer field, and store the XOR of
> the forward and backward pointers.  Given actual pointers to any two consecutive
> entries, you can step either forward or backward one link by XOR'ing the
> appropriate link field with the address of the "other" object.  The added cost,
> on modern machines, should be minimal, well below the likely amortized memory
> access costs that you'll have to pay anyway as you walk around the treadmill.

I think you need both links sometimes when you don't have pointers to 
either of the other objects in hand, in particular while moving white 
objects to the grey set inside the write barrier.