RFR: Early update references phase
rkennke at redhat.com
Tue Mar 28 15:04:21 UTC 2017
I should probably add that the main motivation for this is partial-GC:
when we want to combine partial (minor) GCs with concurrent
(intermediate) GCs, we need to fix all refs after concurrent GCs to
avoid throwing off the matrix and partial GC (which can't currently deal
with forwarded objects, and I can't see an easy way to do that). Notice
that the matrix part isn't done yet... the update-refs phase could and
should completely rebuild the matrix, and we wouldn't have to build the
matrix during marking+evac.
> This implements an early reference updating phase after evacuation. It
> linearily scans the heap and updates all from-space reference to
> to-space references. It is ultimately controlled by the collector
> policy, which now uses the ShenandoahUpdateRefsEarly flag.
> The updating references phase consists of 3 sub-phases:
> 1. STW pre-update-refs: here we turn off evac, turn on update-refs, make
> heap parsable (main reason to have a pause here!), set the
> iteration-top-limits for later concurrent region scan.
> 2. Concurrent update-heap-refs: here we concurrently update references.
> Each GC worker claims one region at a time, and uses a (modified)
> marked_object_iterate() to update all refs.
> 3. STW post-update-refs: turn off update-refs, update all roots, reclaim
> all cset regions
> I currently see no way to avoid the additional pauses.
> I tested it using SPECjvm using fastdebug and release, found no more issues.
> Cancellation is not yet implemented, but should be easy to do (in cases
> of cancelled update-refs, we must not reclaim the regions and need to
> keep need_update_refs() to true, so that next conc-mark can pick up
> where we left. However, the devil is in the details: we might not only
> want to cancel due to OOM, but also on request of the heuristics that
> wants to start another conc-mark. In this case there would be no point
> to finish update-refs, when conc-mark can update the refs just as well.
> That's why I left this part out for the first prototype.
More information about the shenandoah-dev