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

Roberto Castañeda Lozano rcastanedalo at openjdk.org
Fri Oct 4 14:05:49 UTC 2024


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).

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

Commit messages:
 - Clear pre-barrier bit of tightly-coupled initialization stores using bit clearing rather than toggling

Changes: https://git.openjdk.org/jdk/pull/21356/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21356&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8341525
  Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/21356.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21356/head:pull/21356

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


More information about the hotspot-dev mailing list