On 1/5/23 12:40, Uwe Schindler wrote:
The copypasted snippet above is misleading, you need to read the whole statement, so an 
IllegalStateException can only happen for unaligned access on access modes other than 
get/set (so volatile or opaque reads): "If access is misaligned then access for 
anything **other than the get and set access modes** will result in an 
IllegalStateException.", the sentence you posted is about if it is atomic or not. It 
just says that on 32 bits, long/double are not atomic for normal set/get.

P.S.: We definitely know that it works on 32 bit, the whole code of Lucene is 
full of those VarHandles :-)

I think you are replying to my question. ;)
There are two cases here. One is the misaligned index, which is not relevant here because we're only using get/set.

The other is access to long/double values on 32-bit platforms. This is mentioned explicitly, and since you are talking about atomic access, it's also mentioned:

* read write access modes for all T, with the exception of access modes get and set for long and double on 32-bit platforms. * atomic update access modes for int, long, float or double. (Future major platform releases of the JDK may support additional types for certain currently unsupported access modes.)

It says "access modes get and set", so no explicit atomic access mode. I would read it as {code}Varhandle.AccessMode.GET{/code} and SET respectively.

If it's for sure working on 32-bit platforms, then probably the Javadoc comment should be fixed.

-Michael

Reply via email to