RFR 8158039 VarHandle float/double field/array access should support CAS/set/add atomics
david.holmes at oracle.com
Thu Jun 2 07:13:05 UTC 2016
On 2/06/2016 1:24 AM, Paul Sandoz wrote:
> (Please note this work is or will be covered with FC exception)
> Please review the VarHandles/Unsafe support for atomic ops on double/float fields/arrays.
I think this is misguided. If the user wants CAS for float/double they
can do the conversion to int/long in a context where they know that
conversion makes sense and where they can deal with NaNs appropriately.
At a minimum the fact this deals with raw bit patterns not semantic
values needs to be exposed somehow. ie the handling of NaN needs to be
> http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8158039-float-double-field-array-cas.jdk/webrev/ <http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8158039-float-double-field-array-cas.jdk/webrev/>
> http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8158039-float-double-field-array-cas.hotspot/webrev/ <http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8158039-float-double-field-array-cas.hotspot/webrev/>
> These patches are based on those of for sub-word CAS
> https://bugs.openjdk.java.net/browse/JDK-8157726 <https://bugs.openjdk.java.net/browse/JDK-8157726>
> http://cr.openjdk.java.net/~shade/8157726/webrev.hs.03/ <http://cr.openjdk.java.net/~shade/8157726/webrev.hs.03/>
> http://cr.openjdk.java.net/~shade/8157726/webrev.jdk.03/ <http://cr.openjdk.java.net/~shade/8157726/webrev.jdk.03/>
> And the two patches combined expand the support of fields/arrays.
> New float/double CAS methods are added to Unsafe that defer to int/long equivalents. Then the other atomic methods are built from weak CAS loops.
> No changes are required to HotSpot, but changes are required to the Unsafe tests in the hotspot repository.
> In general the changes to VHs and tests are minimal since it is triggered from changes to the generating scripts that now include float/double into the CAS category.
> There are some minor specification changes and a CCC has been initiated.
> JPRT tests results show no relevant failures for hotspot and core test sets.
More information about the jdk9-dev