RFR: 8144072: G1ParScanThreadState::update_rs does not need to call is_in_reserved

Erik Helin erik.helin at oracle.com
Wed Nov 25 18:17:36 UTC 2015

Hi all,

based on the patch "8144067: Pass obj directly to
G1ParScanThreadState::update_rs", here is another small optimization
that can utilize that G1ParScanThreadState::update_rs now has access to
both the field and the obj. Instead of calling from->is_in_reserved(o),
which is defined as

  bool is_in_reserved(const void* p) {
    return _bottom <= p && p < _end;

we can do the same things as the write barrier for G1:

  bool is_in_same_region(T* p, oop o) {
    return ((p ^ o) >> Log2HeapRegionSize) == 0;

which requires no loads at all.

This patch adds the new static function HeapRegion::is_in_same_region
and patches G1ParScanThreadState::update_rs to make use of it.

Thanks to Thomas for pointing this optimization out.



Please note this patch is based upon the patch for 8144067.

- GC test suite with full verification.


More information about the hotspot-gc-dev mailing list