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

Thomas Schatzl tschatzl at openjdk.org
Wed Jan 21 17:17:08 UTC 2026


On Wed, 21 Jan 2026 16:48:10 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Hi all,
>> 
>>   please review this change to convert `G1FullCollector` to use `Atomic<T>`.
>> 
>> Testing: gha
>> 
>> Thanks,
>>   Thomas
>
> 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.

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

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


More information about the hotspot-gc-dev mailing list