Integrated: 8273599: Remove cross_threshold method usage around GC

Thomas Schatzl tschatzl at openjdk.java.net
Wed Sep 15 08:31:49 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

This pull request has now been integrated.

Changeset: 92c30c94
Author:    Thomas Schatzl <tschatzl at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/92c30c941be09cd43ca794b180b8a1b6f7f952e1
Stats:     50 lines in 11 files changed: 0 ins; 18 del; 32 mod

8273599: Remove cross_threshold method usage around GC

Reviewed-by: sjohanss, ayang

-------------

PR: https://git.openjdk.java.net/jdk/pull/5469



More information about the hotspot-gc-dev mailing list