RFR: 8341525: G1: use bit clearing to remove tightly-coupled initialization store pre-barriers

Martin Doerr mdoerr at openjdk.org
Fri Oct 4 14:21:40 UTC 2024


On Fri, 4 Oct 2024 13:04:52 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:

> This cleanup applies bit clearing rather than bit toggling to clear the G1 pre-barrier bit of tightly-coupled initializing stores when `ReduceInitialCardMarks` is disabled. Although using bit toggling is correct in this context (see [JBS issue description](https://bugs.openjdk.org/browse/JDK-8341525)), bit clearing communicates more clearly (no pun intended) the intent of setting the pre-barrier bit to zero regardless of its previous value. No new tests are added because there already exist tests that exercise this case, for example `testCloneObjectWithFewFields` in `test/hotspot/jtreg/compiler/gcbarriers/TestG1BarrierGeneration.java`.
> 
> Thanks to @shipilev for [reporting](https://github.com/openjdk/jdk/pull/19746#discussion_r1786573527) this maintainability issue.
> 
> #### Testing
> - tier1-5 (linux-x64, linux-aarch64, windows-x64, macosx-x64, and macosx-aarch64; release and debug mode).
> - tier1-3 with `-XX:-ReduceInitialCardMarks` (linux-x64; debug mode).

LGTM.

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

Marked as reviewed by mdoerr (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/21356#pullrequestreview-2348198153


More information about the hotspot-dev mailing list