[Gc] About "Disclaim" patch for BDWGC
urkedal at nbi.dk
Sat Aug 6 05:41:57 PDT 2011
On 2011-08-05, Ivan Maidanski wrote:
> Hi Petter,
> I've found your patches for GC in culibs adding "alternative finalization interface" (ENABLE_DISCLAIM).
> 1. Do you have a repo containing your branch? (I'd like to import it as a separate branch in bdwgc repo)
Yes, http://git.eideticdew.org/cgit/~urkedal/bdwgc/, but as I noticed
your github repo, I've rebased my patches an that:
The changes are contained in the range clean..dispatch, excluding
generated files (master..clean). I can prepare something you can pull,
but the generated files will have a few Gentoo-related autotools
> 2. Have you talked to Hans about merging it with the head BDWGC branch?
We discussed a patch with similar functionality, but before we finalized
(no pun) it, I was looking at the current approach, which is more
I would like to see this added. I'm not sure whether my explanation
(http://www.eideticdew.org/culibs/bdwgc-rn.html) is clear, so please
ask. To summarise, it improves speed and memory overhead for
finalization, but as it requires using a dedicated object kind, it can't
completely replace the current API. It can also be used to create weak
maps more directly.
The main change is in reclaim.c, with handing of the callback on
finalizable objects. Note that the callback may indicate that the
object should be kept. This is essential for weak data-structures,
since a lookup which occurred after the last collection may have created
new references to the object.
There is another change in mark.c to allow objects in an object kind to
be treated as roots, to protect pointers which may be referenced by the
finalizer. This is usually not needed by weak data-structures.
There is one thing I'm not completely satisfied with: The disclaim
call-back is applied to all objects of a block, some which may already
have been finalized and put in a free list. The call-back thus needs a
way to distinguish the two cases. I utilize the fact that free-links
are aligned pointers, which puts a constraint on the first word of live
objects. There may be a way to avoid this.
P.S. Thanks for CCing me in the initial post, I'm only reading the list
occasionally unless I'm following a thread.
More information about the Gc