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:19:55 UTC 2024
On Mon, 6 May 2024 09:58:12 GMT, Liang Mao <lmao at openjdk.org> wrote:
>> The pre-write barrier of G1 is used to capture the object disconnected from the marking graph which could be unmarked aka *white* and stored into *black* objects then break tri-color invariance. But references in new allocated objects are created in object initialization after marking start and never could be white. So we don't need pre-write barrier for stores from new allocated objects. The same mechanism is also used for barrier eliminantion in GenZGC.
>>
>> Additional testing:
>> - [x] Linux aarch64 server release/fastdebug, test/hotspot/jtreg/gc with +UseG1GC
>> - [x] Run several iterations of SPECjbb2015 with aggressively frequent concurrent mark
>
> 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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19098#discussion_r1593261993
More information about the hotspot-gc-dev
mailing list