While we're scanning update buffers during a G1 GC, we find two types of cross-region references:
- references to inside the CSet, which we add to an array called _new_refs
- references to outside the CSet, for which we create RSet entries
After the update buffers are processed we scan the _new_refs array to find roots into the CSet. If an evacuation failure happens, we also scan _new_refs to recreate the RSets of the CSet (given that we skip creating those while we're scanning update buffers).
It'd be nice to get rid off the need to maintain the _new_refs array, to have less data structures that grow during a GC. The plan of action (discussed with Igor) is:
- while we're scanning the update buffers, we should not add entries to the _new_refs array but, instead, we'll process and references into the CSet there and then (and deal with the rest in the way we do now)
- we should also retain the update buffers we just processed, so that we can iterate over them to recreate the RSet entries of the CSet, if an evacuation failure happens.