RFR: 8245594: Remove volatile-qualified member functions and parameters from oop class

Kim Barrett kim.barrett at oracle.com
Mon May 25 00:53:50 UTC 2020


> On May 24, 2020, at 8:01 PM, David Holmes <david.holmes at oracle.com> wrote:
> 
> Okay this is really nothing to do with Atomic::store at all. using the initializer list is the obviously correct and simple way to do this.

There are many reasons to prefer using initializer lists for
initialization. In this case, one is not needing to have a weak atomic
store, as those generally engender additional scrutiny.  I guess my
RFR description was overly terse and suggested more than was intended.

>>> Hmmm. Granted "volatile" on a Class type has no meaning. But I always think of oop as really being a pointer type so volatile actually makes some sense there.
>>> […]
> 
> Okay, but I still don't see why we would not remove the volatile qualifier for these oop cases.

It "tags" the variable as being read/written by multiple threads and
semantically atomic. And unlike similar usage with fundamental types,
because we've eliminated the volatile qualifiers in member functions,
the compiler will help us remember to use atomic accesses.



More information about the hotspot-dev mailing list