• Omer Katz's avatar
    heap: Retrace weak container found through stack scanning · 7d097c74
    Omer Katz authored
    Weak containers are marked by the MarkingVisitor when reached through
    regular tracing. However, weak containers might not be traced (e.g. in
    case of a weak-to-weak HashMap). Ephemerons are traced, but only values
    belonging to live keys are marked. At the end of marking, all unmarked
    buckets in the container are removed.
    
    If the container is reachable from stack (e.g. via an iterator), all
    buckets become reachable, meaning all buckets should be marked as live.
    However, conservative GC does not re-trace a previously marked/traced
    container, resulting in dangling references (to deleted buckets) and
    invalid iterators.
    
    This CL marks all marked weak containers so that conservative GC knows
    to retrace them if they are found again through stack scanning.
    
    Bug: 1108676
    Change-Id: I8790c4af2dcd70513b77c4a5fced4ce85852a9c7
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2489905
    Commit-Queue: Omer Katz <omerkatz@chromium.org>
    Reviewed-by: default avatarMichael Lippautz <mlippautz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#819493}
    7d097c74
heap.h 26.7 KB