Closed
Description
In the line in ProcessEdgesWork
,
mmtk-core/src/scheduler/gc_work.rs
Lines 449 to 452 in 0babba2
we check a constant OVERWRITE_REFERENCE
and write back the reference returned by trace_object()
. OVERWRITE_REFERENCE
is defined per ProcessEdgesWork
, which is currently per plan. In a copying plan, OVERWRITE_REFERENCE
is true
, and we always update references.
However, this means there are a few cases where we update references but we do not have to:
- an object is in a non-copying space: e.g. objects in immortal or large object space in a copying plan
- an object is in a copying space but in a particular trace, the policy is not moving objects: e.g. objects in an immix space in a non-defrag GC (non-moving), or objects in the mature immix space in generational immix for a non-defrag GC (nursery is still copying, but objects in mature space is non-moving for that GC).
We may want to check if this introduces any measurable overhead.
There could be different solutions if this brings any overhead:
- Per policy per trace work packet. So
OVERWRITE_REFERENCE
is defined per policy per trace. - Check if
new_object
is the same asobject
before write. (conditional vs memory write).