JDK-8341525 : G1: use bit clearing to remove tightly-coupled initialization store pre-barriers
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-10-04
  • Updated: 2024-10-14
  • Resolved: 2024-10-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 24
24 b19Fixed
Related Reports
Relates :  
Description
Currently, when ReduceInitialCardMarks is disabled, the pre-barrier of tightly-coupled initialization stores is cleared using bit toggling:

Node* G1BarrierSetC2::store_at_resolved(C2Access& access, C2AccessValue& val) const {
  (...)
  access.set_barrier_data(get_store_barrier(access));
  if (tightly_coupled_alloc) {
    assert(!use_ReduceInitialCardMarks(), ...);
    access.set_barrier_data(access.barrier_data() ^ G1C2BarrierPre);
  }
  (...)
}

This assumes that G1C2BarrierPre is always set at this point, which is guaranteed because an `access` corresponding to a tightly-coupled initialization store is always of type `C2OptAccess`, hence `!access.is_parse_access()` and `get_store_barrier(access)` trivially returns `G1C2BarrierPre | G1C2BarrierPost`. However, the intent of the code would be clearer if bit clearing (access.set_barrier_data(access.barrier_data() & ~G1C2BarrierPre)) was used instead.

This issue was originally reported by [~shade] and discussed here: https://github.com/openjdk/jdk/pull/19746#discussion_r1786573527.
Comments
Changeset: 81ebbb24 Branch: master Author: Roberto CastaƱeda Lozano <rcastanedalo@openjdk.org> Date: 2024-10-07 08:28:18 +0000 URL: https://git.openjdk.org/jdk/commit/81ebbb2463df8b014bb209dc4028668fc78e8327
07-10-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/21356 Date: 2024-10-04 13:04:52 +0000
04-10-2024