RFR (M): 8188224: Generalize Atomic::load/store to use templates

Erik Österlund erik.osterlund at oracle.com
Tue Oct 3 12:29:07 UTC 2017


The time has come to generalize Atomic::load/store with templates - the 
last operation to generalize in Atomic.
The design was inspired by Atomic::xchg and uses a similar mechanism to 
validate the passed in arguments. It was also designed with coming 
OrderAccess changes in mind. OrderAccess also contains loads and stores 
that will reuse the LoadImpl and StoreImpl infrastructure in 
Atomic::load/store. (the type checking for what is okay to pass in to 
Atomic::load/store is very much the same for 

One thing worth mentioning is that the bsd zero port (but notably not 
the linux zero port) had a leading fence for atomic stores of jint when 
#if !defined(ARM) && !defined(M68K) is true without any comment 
describing why. So I took the liberty of removing it. Atomic should not 
have any fencing at all - that is what OrderAccess is for. In fact 
Atomic does not promise any memory ordering semantics for loads and 
stores. Atomic merely provides relaxed accesses that are atomic. Worth 
mentioning nevertheless in case anyone wants to keep that jint 
Atomic::store fence on bsd zero !M68K && !ARM.



Testing: JPRT, mach5 hs-tier3


More information about the hotspot-dev mailing list