RFR: 8374190: Convert ConcurrentHashTable atomic lists to use Atomic<T> [v2]
David Holmes
dholmes at openjdk.org
Tue Jan 6 01:40:21 UTC 2026
On Tue, 23 Dec 2025 11:14:28 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> 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).
Okay. The comment would make more sense, IMO, on the implementation, rather than the declaration.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28951#discussion_r2663296696
More information about the hotspot-dev
mailing list