RFR (S) 8150465: Unsafe methods to produce uninitialized arrays

Andrew Haley aph at redhat.com
Mon Feb 29 19:29:19 UTC 2016


On 02/29/2016 07:19 PM, Jim Graham wrote:
> Maybe I'm missing something (memory fences are not in my wheelhouse), 

Sadly, they are in mine.  :-)

> but is storeFence() the right fence to use?  I would think you would 
> want stores before the fence to not be reordered wrt loads after the 
> fence, but storeFence() only protects against stores after the fence 
> (according to its doc comment).  I couldn't find a storeLoadFence() 
> method...?  (and storeFence does not incorporate storeload protection)

You don't need StoreLoad (which is always a full fence AFAIK) but I
think that you do need (LoadStore|StoreStore), aka release().

Andrew.



More information about the jdk9-dev mailing list