RFR: 8376126: G1: Convert remaining volatiles in G1ConcurrentMark to Atomic<T> [v2]

Stefan Karlsson stefank at openjdk.org
Tue Jan 27 14:16:02 UTC 2026


On Tue, 27 Jan 2026 12:32:14 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> Thomas Schatzl has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   * reviews
>
> src/hotspot/share/gc/g1/g1ConcurrentMark.cpp line 581:
> 
>> 579:   uint max_num_regions = _g1h->max_num_regions();
>> 580:   for (uint i = 0; i < max_num_regions; i++) {
>> 581:     ::new (&_top_at_rebuild_starts[i]) Atomic<HeapWord*>{};
> 
> I added a comment about a similar usage of placement new here:
> https://github.com/openjdk/jdk/pull/29423#discussion_r2731775781
> 
> Could you please take a look at that suggestion and if you agree with it also make that change here?

Thomas pointed out that this was also acting as the initialization for these elements.

I wonder if it wouldn't be nicer to separate this and have proper initialization in the constructor and let the reset function only reset the values?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29368#discussion_r2732208197


More information about the hotspot-gc-dev mailing list