RFR: 8331711: G1 doesn't need pre write barrier for stores from new allocated objects [v2]

Kim Barrett kbarrett at openjdk.org
Wed May 8 01:41:53 UTC 2024


On Wed, 8 May 2024 01:16:32 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Liang Mao has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
>> 
>>  - Merge remote-tracking branch 'openjdk/master' into 8331711
>>  - 8331711: G1 doesn't need pre write barrier for stores from new allocated objects
>
> src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp line 199:
> 
>> 197:     assert(val_type != nullptr, "need a type");
>> 198: 
>> 199:     if (use_ReduceInitialCardMarks() && obj == kit->just_allocated_object(kit->control())) {
> 
> This isn't correct.  It doesn't ensure there aren't any stores to the same
> location between the allocation and this store that might need to be tracked.
> g1_can_remove_pre_barrier (below) does that.

We've had lots of problems with safepoints sneaking into unexpected places.
That's why (Gen)ZGC uses late barrier expansion.  That's also one of the
motivations for https://openjdk.org/jeps/475.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19098#discussion_r1593277386


More information about the hotspot-gc-dev mailing list