src/jdk.unsupported/share/classes/sun/misc/Unsafe.java
changeset 52220 9c260a6b6471
parent 51798 f55a4bc91ef4
child 52427 3c6aa484536c
equal deleted inserted replaced
52219:151b990e3764 52220:9c260a6b6471
   194      * Fetches a reference value from a given Java variable.
   194      * Fetches a reference value from a given Java variable.
   195      * @see #getInt(Object, long)
   195      * @see #getInt(Object, long)
   196      */
   196      */
   197     @ForceInline
   197     @ForceInline
   198     public Object getObject(Object o, long offset) {
   198     public Object getObject(Object o, long offset) {
   199         return theInternalUnsafe.getObject(o, offset);
   199         return theInternalUnsafe.getReference(o, offset);
   200     }
   200     }
   201 
   201 
   202     /**
   202     /**
   203      * Stores a reference value into a given Java variable.
   203      * Stores a reference value into a given Java variable.
   204      * <p>
   204      * <p>
   209      * are updated.
   209      * are updated.
   210      * @see #putInt(Object, long, int)
   210      * @see #putInt(Object, long, int)
   211      */
   211      */
   212     @ForceInline
   212     @ForceInline
   213     public void putObject(Object o, long offset, Object x) {
   213     public void putObject(Object o, long offset, Object x) {
   214         theInternalUnsafe.putObject(o, offset, x);
   214         theInternalUnsafe.putReference(o, offset, x);
   215     }
   215     }
   216 
   216 
   217     /** @see #getInt(Object, long) */
   217     /** @see #getInt(Object, long) */
   218     @ForceInline
   218     @ForceInline
   219     public boolean getBoolean(Object o, long offset) {
   219     public boolean getBoolean(Object o, long offset) {
   858      */
   858      */
   859     @ForceInline
   859     @ForceInline
   860     public final boolean compareAndSwapObject(Object o, long offset,
   860     public final boolean compareAndSwapObject(Object o, long offset,
   861                                               Object expected,
   861                                               Object expected,
   862                                               Object x) {
   862                                               Object x) {
   863         return theInternalUnsafe.compareAndSetObject(o, offset, expected, x);
   863         return theInternalUnsafe.compareAndSetReference(o, offset, expected, x);
   864     }
   864     }
   865 
   865 
   866     /**
   866     /**
   867      * Atomically updates Java variable to {@code x} if it is currently
   867      * Atomically updates Java variable to {@code x} if it is currently
   868      * holding {@code expected}.
   868      * holding {@code expected}.
   899      * Fetches a reference value from a given Java variable, with volatile
   899      * Fetches a reference value from a given Java variable, with volatile
   900      * load semantics. Otherwise identical to {@link #getObject(Object, long)}
   900      * load semantics. Otherwise identical to {@link #getObject(Object, long)}
   901      */
   901      */
   902     @ForceInline
   902     @ForceInline
   903     public Object getObjectVolatile(Object o, long offset) {
   903     public Object getObjectVolatile(Object o, long offset) {
   904         return theInternalUnsafe.getObjectVolatile(o, offset);
   904         return theInternalUnsafe.getReferenceVolatile(o, offset);
   905     }
   905     }
   906 
   906 
   907     /**
   907     /**
   908      * Stores a reference value into a given Java variable, with
   908      * Stores a reference value into a given Java variable, with
   909      * volatile store semantics. Otherwise identical to {@link #putObject(Object, long, Object)}
   909      * volatile store semantics. Otherwise identical to {@link #putObject(Object, long, Object)}
   910      */
   910      */
   911     @ForceInline
   911     @ForceInline
   912     public void putObjectVolatile(Object o, long offset, Object x) {
   912     public void putObjectVolatile(Object o, long offset, Object x) {
   913         theInternalUnsafe.putObjectVolatile(o, offset, x);
   913         theInternalUnsafe.putReferenceVolatile(o, offset, x);
   914     }
   914     }
   915 
   915 
   916     /** Volatile version of {@link #getInt(Object, long)}  */
   916     /** Volatile version of {@link #getInt(Object, long)}  */
   917     @ForceInline
   917     @ForceInline
   918     public int getIntVolatile(Object o, long offset) {
   918     public int getIntVolatile(Object o, long offset) {
  1018      *
  1018      *
  1019      * Corresponds to C11 atomic_store_explicit(..., memory_order_release).
  1019      * Corresponds to C11 atomic_store_explicit(..., memory_order_release).
  1020      */
  1020      */
  1021     @ForceInline
  1021     @ForceInline
  1022     public void putOrderedObject(Object o, long offset, Object x) {
  1022     public void putOrderedObject(Object o, long offset, Object x) {
  1023         theInternalUnsafe.putObjectRelease(o, offset, x);
  1023         theInternalUnsafe.putReferenceRelease(o, offset, x);
  1024     }
  1024     }
  1025 
  1025 
  1026     /** Ordered/Lazy version of {@link #putIntVolatile(Object, long, int)}  */
  1026     /** Ordered/Lazy version of {@link #putIntVolatile(Object, long, int)}  */
  1027     @ForceInline
  1027     @ForceInline
  1028     public void putOrderedInt(Object o, long offset, int x) {
  1028     public void putOrderedInt(Object o, long offset, int x) {
  1166      * @return the previous value
  1166      * @return the previous value
  1167      * @since 1.8
  1167      * @since 1.8
  1168      */
  1168      */
  1169     @ForceInline
  1169     @ForceInline
  1170     public final Object getAndSetObject(Object o, long offset, Object newValue) {
  1170     public final Object getAndSetObject(Object o, long offset, Object newValue) {
  1171         return theInternalUnsafe.getAndSetObject(o, offset, newValue);
  1171         return theInternalUnsafe.getAndSetReference(o, offset, newValue);
  1172     }
  1172     }
  1173 
  1173 
  1174 
  1174 
  1175     /**
  1175     /**
  1176      * Ensures that loads before the fence will not be reordered with loads and
  1176      * Ensures that loads before the fence will not be reordered with loads and