Using bitmasks to accelerate marking

"Jon Harrop" <[email protected]> Sat, 12 Nov 2011 18:57:30 -0000
Newsgroups gmane.comp.programming.garbage-collection.general
Message-ID <[email protected]>
I'm just playing around with some toy GCs I've written in C++ that use an
instrumented list-based n-queens solver as an example mutator. The fastest
I've got so far is a kind of mark-region collector that allocates into a
region and uses two external bitvectors to track the mark bits and allocated
bits, respectively. Sweeping is then just a case of ANDing the two
bitvectors (as I described before).

I haven't profiled it at all but it occurs to me that I might be able to
accelerate the mark phase (which I assume is the bottleneck) significantly
by storing third bitvector where each bit is used to indicate whether the
first pointer in the corresponding heap block points to the heap block
immediately before it. A 2kB look up table could be used to find the length
of the chain of consecutive heap blocks reachable from the first one and
they could all be marked simultaneously using an OR. This is obviously
expected to be effective for my n-queens solver because it uses lots of
little immutable singly-linked lists but I expect it to be effective for
many other purely functional data structures as well.

Has any work been done on this kind of thing before?

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com