Skip to content
  • takano-akio's avatar
    Allow multiple C finalizers to be attached to a Weak# · d61c623e
    takano-akio 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.
    d61c623e