RFR: 8296374: Check for young region in G1BarrierSet::invalidate instead of card-by-card check

Albert Mingkun Yang ayang at openjdk.org
Wed Dec 14 17:42:39 UTC 2022


On Wed, 14 Dec 2022 16:57:51 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:

> Hi,
> 
> Please review this change to young region card checks in G1BarrierSet::invalidate(). A single check should suffice because the MemRegion for invalidation in G1 is either completely in the young gen or not. 
> 
> Testing: Tier 1-3

src/hotspot/share/gc/g1/g1BarrierSet.cpp line 113:

> 111:   // skip young cards
> 112:   if (*byte == G1CardTable::g1_young_card_val()) {
> 113:     guarantee(*last_byte == G1CardTable::g1_young_card_val(), "MemRegion should be either completely in young gen or not");

I think a stronger assertion is that `mr` is inside a heap-region, sth along the line of `mr.size() < HeapRegionSize`.

src/hotspot/share/gc/g1/g1BarrierSet.cpp line 117:

> 115:   }
> 116: 
> 117:   if (byte <= last_byte) {

This check can be removed now, right?

src/hotspot/share/gc/g1/g1BarrierSet.cpp line 126:

> 124:       CardValue bv = *byte;
> 125:       if (bv != G1CardTable::dirty_card_val()) {
> 126:         assert(bv != G1CardTable::g1_young_card_val(), "Invalid card");

Why is the assertion conditional? I'd expect all cards are *not* young here.

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

PR: https://git.openjdk.org/jdk/pull/11677


More information about the hotspot-gc-dev mailing list