RFR: 8374190: Convert ConcurrentHashTable atomic lists to use Atomic<T>
Kim Barrett
kbarrett at openjdk.org
Tue Dec 23 11:17:55 UTC 2025
On Tue, 23 Dec 2025 05:37:42 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Please review this change to ConcurrentHashTable to use `Atomic<Node*>` for
>> the Node lists. Note that this does not complete the replacement of direct
>> uses of AtomicAccess by that class; there's still one more group remaining.
>>
>> Testing: mach5 tier1-3
>
> src/hotspot/share/utilities/concurrentHashTable.hpp line 178:
>
>> 176: // assignment, thus here we must cast const part away. Method is not static
>> 177: // due to an assert.
>> 178: void release_assign_node_ptr(const Atomic<Node*>* dst, Node* node) const;
>
> The `const` part of the comment no longer seems relevant.
The `const` is still relevant, for the reason described. It's at least
arguable that it's kind of sketchy to do this. It certainly took me a bit of
study to understand. Note that I moved the position of the `const` qualifier
to its more usual location (in our code) for declaring a constant object (the
`Atomic<Node*>` is atomic). It could instead be written as `Atomic<Node*> const*`,
retaining the ordering from the original. Also see the implementation, where
we need to cast away the `const` qualifier, which is now being done with
`const_cast` rather than a C-style cast (that was also stripping off the `volatile`
qualifier, which the use of `AtomicAccess` implicitly reapplied).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28951#discussion_r2642847639
More information about the hotspot-dev
mailing list