RFR: 8376350: Convert ReferenceProcessorPhaseTimes to use Atomic<T>
Stefan Karlsson
stefank at openjdk.org
Tue Jan 27 12:30:21 UTC 2026
On Mon, 26 Jan 2026 15:52:10 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:
> Hi all,
>
> please review this change to convert `ReferenceProcessorPhaseTimes` to use `Atomic<T>`.
>
> Testing: gha
>
> Thanks,
> Thomas
Changes requested by stefank (Reviewer).
src/hotspot/share/gc/shared/referenceProcessorPhaseTimes.cpp line 199:
> 197:
> 198: for (int i = 0; i < number_of_subclasses_of_ref; i++) {
> 199: ::new (&_ref_dropped[i]) Atomic<size_t>{};
I had some offline discussions with @jdksjolen and @walulyai about if we really should be using placement new to reset `Atomic`s, and if this is the correct way, should we also call the destructor on the old object?
That discussion ended up with suggesting the following instead:
Suggestion:
_ref_dropped[i].store_relaxed(0);
-------------
PR Review: https://git.openjdk.org/jdk/pull/29423#pullrequestreview-3710905054
PR Review Comment: https://git.openjdk.org/jdk/pull/29423#discussion_r2731775781
More information about the hotspot-gc-dev
mailing list