RFR: 8367013: Add Atomic<T> to package/replace idiom of volatile var plus AtomicAccess:: operations

Kim Barrett kbarrett at openjdk.org
Mon Sep 29 11:48:55 UTC 2025


On Mon, 29 Sep 2025 09:09:50 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

> The following isn't a strong request, but maybe more of stated preference and an inquiry what other HotSpot devs think about the proposed names:
> 
>     1. The proposed `load_relaxed` is visually very similar to `load_release`. So much that I have to double check that the code is using one or the other. The same for `relaxed_store`.

I assume you mean `load_acquire` - there is no `load_release`.

`load_relaxed` and `load_acquire` don't look very much alike to me. OTOH, I
find `load` (without any qualifying suffix) tends to hide when in the midst of
other code.

I also prefer the operations be explicit about the ordering. Personally, I've
never liked `Atomic::load` and `Atomic::store` either.  

>     2. I'm no sure about putting the word relaxed before the word store in `relaxed_store`. I understand why it was done for `release_store`, but not really for the relaxed version. The name is also harder to discover. I think I would try to look for a function prefixed with store and not relaxed when trying to remember the name.

If the relaxed storing operation is going to be explicit, putting the
qualifier at the front to be consistent seems better to me.

> So, I would prefer if we would have kept the load/store names.

And I would prefer the ordering (or lack thereof) be explicit, so don't
want to keep the load/store names.

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

PR Comment: https://git.openjdk.org/jdk/pull/27539#issuecomment-3346503040


More information about the hotspot-dev mailing list