• aljee@hyper.cx's avatar
    Allow multiple C finalizers to be attached to a Weak# · d61c623e
    aljee@hyper.cx authored
    The commit replaces mkWeakForeignEnv# with addCFinalizerToWeak#.
    This new primop mutates an existing Weak# object and adds a new
    C finalizer to it.
    This change removes an invariant in MarkWeak.c, namely that the relative
    order of Weak# objects in the list needs to be preserved across GC. This
    makes it easier to split the list into per-generation structures.
    The patch also removes a race condition between two threads calling
    finalizeWeak# on the same WEAK object at that same time.
Closures.h 12.2 KB