RFR: 8273599: Remove cross_threshold method usage around GC

Thomas Schatzl tschatzl at openjdk.java.net
Fri Sep 10 17:40:08 UTC 2021


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

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

Commit messages:
 - Remove cross_threshold

Changes: https://git.openjdk.java.net/jdk/pull/5469/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5469&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8273599
  Stats: 50 lines in 11 files changed: 0 ins; 18 del; 32 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5469.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5469/head:pull/5469

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



More information about the hotspot-gc-dev mailing list