On 11/12/14 00:53, David Holmes wrote: > On 11/12/2014 7:02 AM, Andrew Haley wrote: >> On 12/05/2014 09:49 PM, Martin Buchholz wrote: >>> The actual implementations of storestore (see below) seem to >>> universally give you the stronger ::release barrier, and it seems >>> likely that hotspot engineers are implicitly relying on that, that >>> some uses of ::storestore in the hotspot sources are bugs (should be >>> ::release instead) and that there is very little potential performance >>> benefit from using ::storestore instead of ::release, precisely >>> because the additional loadstore barrier is very close to free on all >>> current hardware. >> >> That's not really true for ARM, where the additional loadstore requires >> a full barrier. There is a good use for a storestore, which is when >> zeroing a newly-created object. > > There are many good uses of storestore in the various lock-free > algorithms inside hotspot.
There may be many uses, but I am extremely suspicious of how good they are. I wonder if we went through all the uses of storestore in hotspot how many bugs we'd find. As far as I can see (in the absence of other barriers) the only things you can write before a storestore are constants. Andrew.