RFR: 8375974: G1: Convert G1FullCollector to use Atomic<T>

Kim Barrett kbarrett at openjdk.org
Wed Jan 21 18:04:33 UTC 2026


On Wed, 21 Jan 2026 17:15:04 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> src/hotspot/share/gc/g1/g1FullCollector.inline.hpp line 66:
>> 
>>> 64: 
>>> 65: void G1FullCollector::set_compaction_top(G1HeapRegion* r, HeapWord* value) {
>>> 66:   _compaction_tops[r->hrm_index()].store_relaxed(value);
>> 
>> We seem to only be doing relaxed load/store.  What is the concurrent usage model here that
>> needs atomics?
>
> Idk. I think it is just about the `_compaction_tops` being aligned, i.e. can be atomically read. Also to just indicate that the array is accessed concurrently.
> 
> I can remove these completely if wanted.

There wasn't any alignment futzing in the old code, so I don't think that's it.
I've not looked to see if it can be removed; I was asking if you knew the answer.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29342#discussion_r2713719994


More information about the hotspot-gc-dev mailing list