RFR: 8273599: Remove cross_threshold method usage around GC
Stefan Johansson
sjohanss at openjdk.java.net
Wed Sep 15 06:44:43 UTC 2021
On Fri, 10 Sep 2021 15:35:39 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:
> HI all,
>
> the cross_threshold() method is used in a few places to update the BOT after major changes to object locations (typically full gc compaction).
>
> It has the following signature:
>
> HeapWord* HeapRegion::cross_threshold(HeapWord* start, HeapWord* end);
>
> to update the BOT for an object from start to end, returning the next (higher) address where there is need to call it again if advancing forward in the heap (i.e. basically after the last BOT entry that has just been written).
>
> So it can be used in a loop to be only called in that case like this:
>
> _compaction_top += size;
> if (_compaction_top > _threshold) {
> _threshold = _current_region->cross_threshold(_compaction_top - size, _compaction_top);
> }
>
> However the method it calls, alloc_block() does that check to shortcut unnecessary calls to some alloc_block_work() method already:
>
> if (blk_end > _next_offset_threshold) {
> alloc_block_work(&_next_offset_threshold, blk_start, blk_end);
> }
>
> as cross_threshold() always returns _next_offset_threshold.
>
> So the cross_threshold method and all the machinery to avoid unnecessary calls is... unnecessary.
>
> No particular performance implications either way.
>
> Testing: tier1-3, gc/g1
>
> Thanks,
> Thomas
Nice find and good clean up. 👍
-------------
Marked as reviewed by sjohanss (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/5469
More information about the hotspot-gc-dev
mailing list