Skip to content
  • Daniel Gröber (dxld)'s avatar
    rts: TraverseHeap: Update resetStaticObjectForProfiling docs · bf95dd2c
    Daniel Gröber (dxld) authored and Marge Bot's avatar Marge Bot committed
    Simon's concern in the old comment, specifically:
    
        So all of the calls to traverseMaybeInitClosureData() here are
        initialising retainer sets with the wrong flip.
    
    Is actually exactly what the code was intended to do. It makes the closure
    data valid, then at the beginning of the traversal the flip bit is flipped
    resetting all closures across the heap to invalid.
    
    Now it used to be that the profiling code using the traversal has it's own
    sense of valid vs. invalid beyond what the traversal code does and indeed
    the retainer profiler still does this, there a getClosureData of NULL is
    considered an invalid retainer set.
    
    So in effect there wasn't any difference in invalidating closure data
    rather than just resetting it to a valid zero, which might be what confused
    Simon at the time.
    
    As the code is now it actually uses the value of the valid/invalid bit in
    the form of the 'first_visit' argument to the 'visit' callback so there is
    a difference.
    bf95dd2c