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.
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.
- relates to
-
JDK-8334060 Implementation of Late Barrier Expansion for G1
-
- Resolved
-
- links to
-
Commit(master) openjdk/jdk/81ebbb24
-
Review(master) openjdk/jdk/21356