Note [Non-moving GC: Marking evacuated objects]

rts/sm/Evac.c:181 rts

When the non-moving collector is in use we must be careful to ensure that any
references to objects in the non-moving generation from younger generations
are pushed to the mark queue.

In particular we need to ensure that we handle newly-promoted objects are
correctly marked. For instance, consider this case:

    generation 0                          generation 1
   ──────────────                        ──────────────

                                           ┌───────┐
     ┌───────┐                             │   A   │
     │   B   │ ◁────────────────────────── │       │
     │       │ ──┬─────────────────┐       └───────┘
     └───────┘   ┆        after GC │
                 ┆                 │
     ┌───────┐   ┆ before GC       │       ┌───────┐
     │   C   │ ◁┄┘                 └─────▷ │   C'  │
     │       │                             │       │
     └───────┘                             └───────┘


In this case object C started off in generation 0 and was evacuated into
generation 1 during the preparatory GC. However, the only reference to C'
is from B, which lives in the generation 0 (via aging); this reference will
not be visible to the concurrent non-moving collector (which can only
traverse the generation 1 heap). Consequently, upon evacuating C we need to
ensure that C' is added to the update remembered set as we know that it will
continue to be reachable via B (which is assumed to be reachable as it lives
in a younger generation).

Where this happens depends upon the type of the object (e.g. C'):

 - In the case of "normal" small heap-allocated objects this happens in
   alloc_for_copy.
 - In the case of compact region this happens in evacuate_compact.
 - In the case of large objects this happens in evacuate_large.

See also Note [Aging under the non-moving collector] in NonMoving.c.

References 0

This Note does not link to any other.

Referenced by 9