RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v5]

Michael Kuhlmann jdk at fiolino.de
Thu Jan 5 13:16:57 UTC 2023


Hi Uwe,

you are right! It's confusing because for cases 2-4, *atomic* access is 
explicitly mentioned but not for case 1. I overlooked the *atomic 
access* in the sentence before and got confused.

Thanks for the clarification!

On 1/5/23 13:37, Uwe Schindler wrote:
> Hi,
> 
> I answered on the PR on github. The documentation is misleading:
> 
>     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 :-)
> 
> And no, it doe snot mean "get-and-set". Read the whole text, it is 
> definitely correct, but if you don't read everything it may mislead you. 
> So it can be improved.
> 
> Uwe
> 


More information about the core-libs-dev mailing list