mmtk-core icon indicating copy to clipboard operation
mmtk-core copied to clipboard

`is_live` is buggy for generational plans

Open qinsoon opened this issue 1 month ago • 3 comments

For nursery GCs in generational plans, objects that are not in the nursery space are not traced (e.g. nonmoving space, immortal space, mature space, etc). Thus MMTk does not know whether it is live or not. However, MMTk should conservatively return true for those objects, as they may be alive.

Currently most spaces return is_live by checking the object is marked or not, and ignore the fact that it is a nursery GC, those objects will not be traced and the mark bit does not tell whether the object is alive or not.

qinsoon avatar Nov 28 '25 00:11 qinsoon

The other option is to return Option<bool> for is_live. When we don't know the liveness, we return None instead. However, in either case, is_live is not only decided by the policy, but also decided by the plan (e.g. nursery GC or mature GC).

qinsoon avatar Nov 28 '25 00:11 qinsoon

Returning true is correct I think. We treat any mature space object as live in nursery GCs.

k-sareen avatar Nov 28 '25 00:11 k-sareen

We had some prior discussion about is_live and is_reachable. Those are not 100% the same as this issue, but some points, such as the meaning of "live", are still relevant.

  • https://github.com/mmtk/mmtk-core/issues/1275
  • https://github.com/mmtk/mmtk-core/issues/1271

wks avatar Dec 01 '25 02:12 wks