RFR: Embed traversal_set and root_regions into ShenandoahTraversalGC to avoid derefs
Aleksey Shipilev
shade at redhat.com
Thu Jun 28 08:26:58 UTC 2018
On 06/27/2018 05:34 PM, Roman Kennke wrote:
> I've noticed some unnecessary derefs in hot marking/traversal loops to
> get to stuff like cset, mark-bitmap and traversal set.
>
> Here I'm proposing to embed the traversal_set and root_regions into
> ShenandoahTraversalGC. This helps to avoid some of those derefs. I
> changed all access to it to use the embedded object directly inside
> ShTraversalGC, and only hand it out as reference. Only exception is the
> ShHeapRegionSetIterator, which still converts it to pointer internally,
> because we can't reset a reference.
>
> The patch also makes ShHeap and task-queues const in ShTraversalGC.
>
> http://cr.openjdk.java.net/~rkennke/traversal-embed-stuff/webrev.00/
*) Why the changes to ShenandoahHeapRegionSetIterator needed? Can we keep ShHeapRegionSet* in its
interface, and only convert to pointer when needed? This would keep the SHRS* usages intact.
*) It also seems simpler to return the addresses right away here, and then just deal with SHRS*
everywhere, as usual. E.g. instead of:
ShenandoahHeapRegionSet& traversal_set() { return _travers_set; }
ShenandoahHeapRegionSet& root_regions() { return _root_regions;}
Do:
ShenandoahHeapRegionSet* traversal_set() { return &_traversal_set; }
ShenandoahHeapRegionSet* root_regions() { return &_root_regions; }
This should trim down the patch significantly, and optimizing compilers should see through it:
https://godbolt.org/g/HZ2hAv
Thanks,
-Aleksey
More information about the shenandoah-dev
mailing list