mirror of
https://github.com/openjdk/jdk.git
synced 2026-07-04 08:10:36 +00:00
8161444: VarHandles should provide access bitwise atomics
8162107: Add acquire/release variants for getAndSet and getAndAdd Reviewed-by: shade, redestad
This commit is contained in:
parent
2551c0ae07
commit
82d48917bb
@ -44,6 +44,10 @@ define GenerateVarHandle
|
||||
$1_ARGS += -KAtomicAdd
|
||||
endif
|
||||
|
||||
ifneq ($$(findstring $$($1_Type), Boolean Byte Short Char Int Long), )
|
||||
$1_ARGS += -KBitwise
|
||||
endif
|
||||
|
||||
ifneq ($$(findstring $$($1_Type), Byte Short Char), )
|
||||
$1_ARGS += -KShorterThanInt
|
||||
endif
|
||||
@ -101,6 +105,7 @@ define GenerateVarHandleByteArray
|
||||
|
||||
$1_ARGS += -KCAS
|
||||
$1_ARGS += -KAtomicAdd
|
||||
$1_ARGS += -KBitwise
|
||||
endif
|
||||
|
||||
ifeq ($$($1_Type), Long)
|
||||
@ -113,6 +118,7 @@ define GenerateVarHandleByteArray
|
||||
|
||||
$1_ARGS += -KCAS
|
||||
$1_ARGS += -KAtomicAdd
|
||||
$1_ARGS += -KBitwise
|
||||
endif
|
||||
|
||||
ifeq ($$($1_Type), Float)
|
||||
|
||||
@ -1207,11 +1207,16 @@ assertEquals(""+l, (String) MH_this.invokeExact(subl)); // Listie method
|
||||
* the following conditions:
|
||||
* <ul>
|
||||
* <li>if the field is declared {@code final}, then the write, atomic
|
||||
* update, and numeric atomic update access modes are unsupported.
|
||||
* update, numeric atomic update, and bitwise atomic update access
|
||||
* modes are unsupported.
|
||||
* <li>if the field type is anything other than {@code byte},
|
||||
* {@code short}, {@code char}, {@code int} or {@code long},
|
||||
* {@code short}, {@code char}, {@code int}, {@code long},
|
||||
* {@code float}, or {@code double} then numeric atomic update
|
||||
* access modes are unsupported.
|
||||
* <li>if the field type is anything other than {@code boolean},
|
||||
* {@code byte}, {@code short}, {@code char}, {@code int} or
|
||||
* {@code long} then bitwise atomic update access modes are
|
||||
* unsupported.
|
||||
* </ul>
|
||||
* <p>
|
||||
* If the field is declared {@code volatile} then the returned VarHandle
|
||||
@ -1326,11 +1331,16 @@ assertEquals(""+l, (String) MH_this.invokeExact(subl)); // Listie method
|
||||
* the following conditions:
|
||||
* <ul>
|
||||
* <li>if the field is declared {@code final}, then the write, atomic
|
||||
* update, and numeric atomic update access modes are unsupported.
|
||||
* update, numeric atomic update, and bitwise atomic update access
|
||||
* modes are unsupported.
|
||||
* <li>if the field type is anything other than {@code byte},
|
||||
* {@code short}, {@code char}, {@code int} or {@code long},
|
||||
* {@code short}, {@code char}, {@code int}, {@code long},
|
||||
* {@code float}, or {@code double}, then numeric atomic update
|
||||
* access modes are unsupported.
|
||||
* <li>if the field type is anything other than {@code boolean},
|
||||
* {@code byte}, {@code short}, {@code char}, {@code int} or
|
||||
* {@code long} then bitwise atomic update access modes are
|
||||
* unsupported.
|
||||
* </ul>
|
||||
* <p>
|
||||
* If the field is declared {@code volatile} then the returned VarHandle
|
||||
@ -1631,11 +1641,16 @@ return mh1;
|
||||
* the following conditions:
|
||||
* <ul>
|
||||
* <li>if the field is declared {@code final}, then the write, atomic
|
||||
* update, and numeric atomic update access modes are unsupported.
|
||||
* update, numeric atomic update, and bitwise atomic update access
|
||||
* modes are unsupported.
|
||||
* <li>if the field type is anything other than {@code byte},
|
||||
* {@code short}, {@code char}, {@code int} or {@code long},
|
||||
* {@code short}, {@code char}, {@code int}, {@code long},
|
||||
* {@code float}, or {@code double} then numeric atomic update
|
||||
* access modes are unsupported.
|
||||
* <li>if the field type is anything other than {@code boolean},
|
||||
* {@code byte}, {@code short}, {@code char}, {@code int} or
|
||||
* {@code long} then bitwise atomic update access modes are
|
||||
* unsupported.
|
||||
* </ul>
|
||||
* <p>
|
||||
* If the field is declared {@code volatile} then the returned VarHandle
|
||||
@ -2353,9 +2368,13 @@ return mh1;
|
||||
* the following conditions:
|
||||
* <ul>
|
||||
* <li>if the component type is anything other than {@code byte},
|
||||
* {@code short}, {@code char}, {@code int} or {@code long},
|
||||
* {@code short}, {@code char}, {@code int}, {@code long},
|
||||
* {@code float}, or {@code double} then numeric atomic update access
|
||||
* modes are unsupported.
|
||||
* <li>if the field type is anything other than {@code boolean},
|
||||
* {@code byte}, {@code short}, {@code char}, {@code int} or
|
||||
* {@code long} then bitwise atomic update access modes are
|
||||
* unsupported.
|
||||
* </ul>
|
||||
* <p>
|
||||
* If the component type is {@code float} or {@code double} then numeric
|
||||
@ -2426,7 +2445,9 @@ return mh1;
|
||||
* If access is aligned then following access modes are supported and are
|
||||
* guaranteed to support atomic access:
|
||||
* <ul>
|
||||
* <li>read write access modes for all {@code T};
|
||||
* <li>read write access modes for all {@code T}, with the exception of
|
||||
* access modes {@code get} and {@code set} for {@code long} and
|
||||
* {@code double} on 32-bit platforms.
|
||||
* <li>atomic update access modes for {@code int}, {@code long},
|
||||
* {@code float} or {@code double}.
|
||||
* (Future major platform releases of the JDK may support additional
|
||||
@ -2434,6 +2455,9 @@ return mh1;
|
||||
* <li>numeric atomic update access modes for {@code int} and {@code long}.
|
||||
* (Future major platform releases of the JDK may support additional
|
||||
* numeric types for certain currently unsupported access modes.)
|
||||
* <li>bitwise atomic update access modes for {@code int} and {@code long}.
|
||||
* (Future major platform releases of the JDK may support additional
|
||||
* numeric types for certain currently unsupported access modes.)
|
||||
* </ul>
|
||||
* <p>
|
||||
* Misaligned access, and therefore atomicity guarantees, may be determined
|
||||
@ -2508,7 +2532,9 @@ return mh1;
|
||||
* If access is aligned then following access modes are supported and are
|
||||
* guaranteed to support atomic access:
|
||||
* <ul>
|
||||
* <li>read write access modes for all {@code T};
|
||||
* <li>read write access modes for all {@code T}, with the exception of
|
||||
* access modes {@code get} and {@code set} for {@code long} and
|
||||
* {@code double} on 32-bit platforms.
|
||||
* <li>atomic update access modes for {@code int}, {@code long},
|
||||
* {@code float} or {@code double}.
|
||||
* (Future major platform releases of the JDK may support additional
|
||||
@ -2516,6 +2542,9 @@ return mh1;
|
||||
* <li>numeric atomic update access modes for {@code int} and {@code long}.
|
||||
* (Future major platform releases of the JDK may support additional
|
||||
* numeric types for certain currently unsupported access modes.)
|
||||
* <li>bitwise atomic update access modes for {@code int} and {@code long}.
|
||||
* (Future major platform releases of the JDK may support additional
|
||||
* numeric types for certain currently unsupported access modes.)
|
||||
* </ul>
|
||||
* <p>
|
||||
* Misaligned access, and therefore atomicity guarantees, may be determined
|
||||
|
||||
@ -141,14 +141,32 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError;
|
||||
* {@link #compareAndExchangeAcquire compareAndExchangeAcquire},
|
||||
* {@link #compareAndExchange compareAndExchange},
|
||||
* {@link #compareAndExchangeRelease compareAndExchangeRelease},
|
||||
* {@link #getAndSet getAndSet}.
|
||||
* {@link #getAndSet getAndSet},
|
||||
* {@link #getAndSetAcquire getAndSetAcquire},
|
||||
* {@link #getAndSetRelease getAndSetRelease}.
|
||||
* <li>numeric atomic update access modes that, for example, atomically get and
|
||||
* set with addition the value of a variable under specified memory ordering
|
||||
* effects.
|
||||
* The set of corresponding access mode methods belonging to this group
|
||||
* consists of the methods
|
||||
* {@link #getAndAdd getAndAdd},
|
||||
* {@link #getAndAddAcquire getAndAddAcquire},
|
||||
* {@link #getAndAddRelease getAndAddRelease},
|
||||
* {@link #addAndGet addAndGet}.
|
||||
* <li>bitwise atomic update access modes that, for example, atomically get and
|
||||
* bitwise OR the value of a variable under specified memory ordering
|
||||
* effects.
|
||||
* The set of corresponding access mode methods belonging to this group
|
||||
* consists of the methods
|
||||
* {@link #getAndBitwiseOr getAndBitwiseOr},
|
||||
* {@link #getAndBitwiseOrAcquire getAndBitwiseOrAcquire},
|
||||
* {@link #getAndBitwiseOrRelease getAndBitwiseOrRelease},
|
||||
* {@link #getAndBitwiseAnd getAndBitwiseAnd},
|
||||
* {@link #getAndBitwiseAndAcquire getAndBitwiseAndAcquire},
|
||||
* {@link #getAndBitwiseAndRelease getAndBitwiseAndRelease},
|
||||
* {@link #getAndBitwiseXor getAndBitwiseXor},
|
||||
* {@link #getAndBitwiseXorAcquire getAndBitwiseXorAcquire},
|
||||
* {@link #getAndBitwiseXorRelease getAndBitwiseXorRelease}.
|
||||
* </ul>
|
||||
*
|
||||
* <p>Factory methods that produce or {@link java.lang.invoke.MethodHandles.Lookup
|
||||
@ -163,8 +181,8 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError;
|
||||
* VarHandle instances and the corresponding method never throws
|
||||
* {@code UnsupportedOperationException}.
|
||||
* If a VarHandle references a read-only variable (for example a {@code final}
|
||||
* field) then write, atomic update and numeric atomic update access modes are
|
||||
* not supported and corresponding methods throw
|
||||
* field) then write, atomic update, numeric atomic update, and bitwise atomic
|
||||
* update access modes are not supported and corresponding methods throw
|
||||
* {@code UnsupportedOperationException}.
|
||||
* Read/write access modes (if supported), with the exception of
|
||||
* {@code get} and {@code set}, provide atomic access for
|
||||
@ -986,6 +1004,71 @@ public abstract class VarHandle {
|
||||
@HotSpotIntrinsicCandidate
|
||||
Object getAndSet(Object... args);
|
||||
|
||||
/**
|
||||
* Atomically sets the value of a variable to the {@code newValue} with the
|
||||
* memory semantics of {@link #set} and returns the variable's
|
||||
* previous value, as accessed with the memory semantics of
|
||||
* {@link #getAcquire}.
|
||||
*
|
||||
* <p>The method signature is of the form {@code (CT, T newValue)T}.
|
||||
*
|
||||
* <p>The symbolic type descriptor at the call site of {@code getAndSetAcquire}
|
||||
* must match the access mode type that is the result of calling
|
||||
* {@code accessModeType(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)} on this
|
||||
* VarHandle.
|
||||
*
|
||||
* @param args the signature-polymorphic parameter list of the form
|
||||
* {@code (CT, T newValue)}
|
||||
* , statically represented using varargs.
|
||||
* @return the signature-polymorphic result that is the previous value of
|
||||
* the variable
|
||||
* , statically represented using {@code Object}.
|
||||
* @throws UnsupportedOperationException if the access mode is unsupported
|
||||
* for this VarHandle.
|
||||
* @throws WrongMethodTypeException if the access mode type is not
|
||||
* compatible with the caller's symbolic type descriptor.
|
||||
* @throws ClassCastException if the access mode type is compatible with the
|
||||
* caller's symbolic type descriptor, but a reference cast fails.
|
||||
* @see #setVolatile(Object...)
|
||||
* @see #getVolatile(Object...)
|
||||
*/
|
||||
public final native
|
||||
@MethodHandle.PolymorphicSignature
|
||||
@HotSpotIntrinsicCandidate
|
||||
Object getAndSetAcquire(Object... args);
|
||||
|
||||
/**
|
||||
* Atomically sets the value of a variable to the {@code newValue} with the
|
||||
* memory semantics of {@link #setRelease} and returns the variable's
|
||||
* previous value, as accessed with the memory semantics of
|
||||
* {@link #get}.
|
||||
*
|
||||
* <p>The method signature is of the form {@code (CT, T newValue)T}.
|
||||
*
|
||||
* <p>The symbolic type descriptor at the call site of {@code getAndSetRelease}
|
||||
* must match the access mode type that is the result of calling
|
||||
* {@code accessModeType(VarHandle.AccessMode.GET_AND_SET_RELEASE)} on this
|
||||
* VarHandle.
|
||||
*
|
||||
* @param args the signature-polymorphic parameter list of the form
|
||||
* {@code (CT, T newValue)}
|
||||
* , statically represented using varargs.
|
||||
* @return the signature-polymorphic result that is the previous value of
|
||||
* the variable
|
||||
* , statically represented using {@code Object}.
|
||||
* @throws UnsupportedOperationException if the access mode is unsupported
|
||||
* for this VarHandle.
|
||||
* @throws WrongMethodTypeException if the access mode type is not
|
||||
* compatible with the caller's symbolic type descriptor.
|
||||
* @throws ClassCastException if the access mode type is compatible with the
|
||||
* caller's symbolic type descriptor, but a reference cast fails.
|
||||
* @see #setVolatile(Object...)
|
||||
* @see #getVolatile(Object...)
|
||||
*/
|
||||
public final native
|
||||
@MethodHandle.PolymorphicSignature
|
||||
@HotSpotIntrinsicCandidate
|
||||
Object getAndSetRelease(Object... args);
|
||||
|
||||
// Primitive adders
|
||||
// Throw UnsupportedOperationException for refs
|
||||
@ -1023,6 +1106,72 @@ public abstract class VarHandle {
|
||||
@HotSpotIntrinsicCandidate
|
||||
Object getAndAdd(Object... args);
|
||||
|
||||
/**
|
||||
* Atomically adds the {@code value} to the current value of a variable with
|
||||
* the memory semantics of {@link #set}, and returns the variable's
|
||||
* previous value, as accessed with the memory semantics of
|
||||
* {@link #getAcquire}.
|
||||
*
|
||||
* <p>The method signature is of the form {@code (CT, T value)T}.
|
||||
*
|
||||
* <p>The symbolic type descriptor at the call site of {@code getAndAddAcquire}
|
||||
* must match the access mode type that is the result of calling
|
||||
* {@code accessModeType(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)} on this
|
||||
* VarHandle.
|
||||
*
|
||||
* @param args the signature-polymorphic parameter list of the form
|
||||
* {@code (CT, T value)}
|
||||
* , statically represented using varargs.
|
||||
* @return the signature-polymorphic result that is the previous value of
|
||||
* the variable
|
||||
* , statically represented using {@code Object}.
|
||||
* @throws UnsupportedOperationException if the access mode is unsupported
|
||||
* for this VarHandle.
|
||||
* @throws WrongMethodTypeException if the access mode type is not
|
||||
* compatible with the caller's symbolic type descriptor.
|
||||
* @throws ClassCastException if the access mode type is compatible with the
|
||||
* caller's symbolic type descriptor, but a reference cast fails.
|
||||
* @see #setVolatile(Object...)
|
||||
* @see #getVolatile(Object...)
|
||||
*/
|
||||
public final native
|
||||
@MethodHandle.PolymorphicSignature
|
||||
@HotSpotIntrinsicCandidate
|
||||
Object getAndAddAcquire(Object... args);
|
||||
|
||||
/**
|
||||
* Atomically adds the {@code value} to the current value of a variable with
|
||||
* the memory semantics of {@link #setRelease}, and returns the variable's
|
||||
* previous value, as accessed with the memory semantics of
|
||||
* {@link #get}.
|
||||
*
|
||||
* <p>The method signature is of the form {@code (CT, T value)T}.
|
||||
*
|
||||
* <p>The symbolic type descriptor at the call site of {@code getAndAddRelease}
|
||||
* must match the access mode type that is the result of calling
|
||||
* {@code accessModeType(VarHandle.AccessMode.GET_AND_ADD_RELEASE)} on this
|
||||
* VarHandle.
|
||||
*
|
||||
* @param args the signature-polymorphic parameter list of the form
|
||||
* {@code (CT, T value)}
|
||||
* , statically represented using varargs.
|
||||
* @return the signature-polymorphic result that is the previous value of
|
||||
* the variable
|
||||
* , statically represented using {@code Object}.
|
||||
* @throws UnsupportedOperationException if the access mode is unsupported
|
||||
* for this VarHandle.
|
||||
* @throws WrongMethodTypeException if the access mode type is not
|
||||
* compatible with the caller's symbolic type descriptor.
|
||||
* @throws ClassCastException if the access mode type is compatible with the
|
||||
* caller's symbolic type descriptor, but a reference cast fails.
|
||||
* @see #setVolatile(Object...)
|
||||
* @see #getVolatile(Object...)
|
||||
*/
|
||||
public final native
|
||||
@MethodHandle.PolymorphicSignature
|
||||
@HotSpotIntrinsicCandidate
|
||||
Object getAndAddRelease(Object... args);
|
||||
|
||||
/**
|
||||
* Atomically adds the {@code value} to the current value of a variable with
|
||||
* the memory semantics of {@link #setVolatile}, and returns the variable's
|
||||
@ -1056,6 +1205,344 @@ public abstract class VarHandle {
|
||||
@HotSpotIntrinsicCandidate
|
||||
Object addAndGet(Object... args);
|
||||
|
||||
|
||||
// Bitwise operations
|
||||
// Throw UnsupportedOperationException for refs
|
||||
|
||||
/**
|
||||
* Atomically sets the value of a variable to the result of
|
||||
* bitwise OR between the variable's current value and the {@code mask}
|
||||
* with the memory semantics of {@link #setVolatile} and returns the
|
||||
* variable's previous value, as accessed with the memory semantics of
|
||||
* {@link #getVolatile}.
|
||||
*
|
||||
* <p>If the variable type is the non-integral {@code boolean} type then a
|
||||
* logical OR is performed instead of a bitwise OR.
|
||||
*
|
||||
* <p>The method signature is of the form {@code (CT, T mask)T}.
|
||||
*
|
||||
* <p>The symbolic type descriptor at the call site of {@code getAndBitwiseOr}
|
||||
* must match the access mode type that is the result of calling
|
||||
* {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_OR)} on this
|
||||
* VarHandle.
|
||||
*
|
||||
* @param args the signature-polymorphic parameter list of the form
|
||||
* {@code (CT, T mask)}
|
||||
* , statically represented using varargs.
|
||||
* @return the signature-polymorphic result that is the previous value of
|
||||
* the variable
|
||||
* , statically represented using {@code Object}.
|
||||
* @throws UnsupportedOperationException if the access mode is unsupported
|
||||
* for this VarHandle.
|
||||
* @throws WrongMethodTypeException if the access mode type is not
|
||||
* compatible with the caller's symbolic type descriptor.
|
||||
* @throws ClassCastException if the access mode type is compatible with the
|
||||
* caller's symbolic type descriptor, but a reference cast fails.
|
||||
* @see #setVolatile(Object...)
|
||||
* @see #getVolatile(Object...)
|
||||
*/
|
||||
public final native
|
||||
@MethodHandle.PolymorphicSignature
|
||||
@HotSpotIntrinsicCandidate
|
||||
Object getAndBitwiseOr(Object... args);
|
||||
|
||||
/**
|
||||
* Atomically sets the value of a variable to the result of
|
||||
* bitwise OR between the variable's current value and the {@code mask}
|
||||
* with the memory semantics of {@link #set} and returns the
|
||||
* variable's previous value, as accessed with the memory semantics of
|
||||
* {@link #getAcquire}.
|
||||
*
|
||||
* <p>If the variable type is the non-integral {@code boolean} type then a
|
||||
* logical OR is performed instead of a bitwise OR.
|
||||
*
|
||||
* <p>The method signature is of the form {@code (CT, T mask)T}.
|
||||
*
|
||||
* <p>The symbolic type descriptor at the call site of {@code getAndBitwiseOrAcquire}
|
||||
* must match the access mode type that is the result of calling
|
||||
* {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)} on this
|
||||
* VarHandle.
|
||||
*
|
||||
* @param args the signature-polymorphic parameter list of the form
|
||||
* {@code (CT, T mask)}
|
||||
* , statically represented using varargs.
|
||||
* @return the signature-polymorphic result that is the previous value of
|
||||
* the variable
|
||||
* , statically represented using {@code Object}.
|
||||
* @throws UnsupportedOperationException if the access mode is unsupported
|
||||
* for this VarHandle.
|
||||
* @throws WrongMethodTypeException if the access mode type is not
|
||||
* compatible with the caller's symbolic type descriptor.
|
||||
* @throws ClassCastException if the access mode type is compatible with the
|
||||
* caller's symbolic type descriptor, but a reference cast fails.
|
||||
* @see #set(Object...)
|
||||
* @see #getAcquire(Object...)
|
||||
*/
|
||||
public final native
|
||||
@MethodHandle.PolymorphicSignature
|
||||
@HotSpotIntrinsicCandidate
|
||||
Object getAndBitwiseOrAcquire(Object... args);
|
||||
|
||||
/**
|
||||
* Atomically sets the value of a variable to the result of
|
||||
* bitwise OR between the variable's current value and the {@code mask}
|
||||
* with the memory semantics of {@link #setRelease} and returns the
|
||||
* variable's previous value, as accessed with the memory semantics of
|
||||
* {@link #get}.
|
||||
*
|
||||
* <p>If the variable type is the non-integral {@code boolean} type then a
|
||||
* logical OR is performed instead of a bitwise OR.
|
||||
*
|
||||
* <p>The method signature is of the form {@code (CT, T mask)T}.
|
||||
*
|
||||
* <p>The symbolic type descriptor at the call site of {@code getAndBitwiseOrRelease}
|
||||
* must match the access mode type that is the result of calling
|
||||
* {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)} on this
|
||||
* VarHandle.
|
||||
*
|
||||
* @param args the signature-polymorphic parameter list of the form
|
||||
* {@code (CT, T mask)}
|
||||
* , statically represented using varargs.
|
||||
* @return the signature-polymorphic result that is the previous value of
|
||||
* the variable
|
||||
* , statically represented using {@code Object}.
|
||||
* @throws UnsupportedOperationException if the access mode is unsupported
|
||||
* for this VarHandle.
|
||||
* @throws WrongMethodTypeException if the access mode type is not
|
||||
* compatible with the caller's symbolic type descriptor.
|
||||
* @throws ClassCastException if the access mode type is compatible with the
|
||||
* caller's symbolic type descriptor, but a reference cast fails.
|
||||
* @see #setRelease(Object...)
|
||||
* @see #get(Object...)
|
||||
*/
|
||||
public final native
|
||||
@MethodHandle.PolymorphicSignature
|
||||
@HotSpotIntrinsicCandidate
|
||||
Object getAndBitwiseOrRelease(Object... args);
|
||||
|
||||
/**
|
||||
* Atomically sets the value of a variable to the result of
|
||||
* bitwise AND between the variable's current value and the {@code mask}
|
||||
* with the memory semantics of {@link #setVolatile} and returns the
|
||||
* variable's previous value, as accessed with the memory semantics of
|
||||
* {@link #getVolatile}.
|
||||
*
|
||||
* <p>If the variable type is the non-integral {@code boolean} type then a
|
||||
* logical AND is performed instead of a bitwise AND.
|
||||
*
|
||||
* <p>The method signature is of the form {@code (CT, T mask)T}.
|
||||
*
|
||||
* <p>The symbolic type descriptor at the call site of {@code getAndBitwiseAnd}
|
||||
* must match the access mode type that is the result of calling
|
||||
* {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_AND)} on this
|
||||
* VarHandle.
|
||||
*
|
||||
* @param args the signature-polymorphic parameter list of the form
|
||||
* {@code (CT, T mask)}
|
||||
* , statically represented using varargs.
|
||||
* @return the signature-polymorphic result that is the previous value of
|
||||
* the variable
|
||||
* , statically represented using {@code Object}.
|
||||
* @throws UnsupportedOperationException if the access mode is unsupported
|
||||
* for this VarHandle.
|
||||
* @throws WrongMethodTypeException if the access mode type is not
|
||||
* compatible with the caller's symbolic type descriptor.
|
||||
* @throws ClassCastException if the access mode type is compatible with the
|
||||
* caller's symbolic type descriptor, but a reference cast fails.
|
||||
* @see #setVolatile(Object...)
|
||||
* @see #getVolatile(Object...)
|
||||
*/
|
||||
public final native
|
||||
@MethodHandle.PolymorphicSignature
|
||||
@HotSpotIntrinsicCandidate
|
||||
Object getAndBitwiseAnd(Object... args);
|
||||
|
||||
/**
|
||||
* Atomically sets the value of a variable to the result of
|
||||
* bitwise AND between the variable's current value and the {@code mask}
|
||||
* with the memory semantics of {@link #set} and returns the
|
||||
* variable's previous value, as accessed with the memory semantics of
|
||||
* {@link #getAcquire}.
|
||||
*
|
||||
* <p>If the variable type is the non-integral {@code boolean} type then a
|
||||
* logical AND is performed instead of a bitwise AND.
|
||||
*
|
||||
* <p>The method signature is of the form {@code (CT, T mask)T}.
|
||||
*
|
||||
* <p>The symbolic type descriptor at the call site of {@code getAndBitwiseAndAcquire}
|
||||
* must match the access mode type that is the result of calling
|
||||
* {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)} on this
|
||||
* VarHandle.
|
||||
*
|
||||
* @param args the signature-polymorphic parameter list of the form
|
||||
* {@code (CT, T mask)}
|
||||
* , statically represented using varargs.
|
||||
* @return the signature-polymorphic result that is the previous value of
|
||||
* the variable
|
||||
* , statically represented using {@code Object}.
|
||||
* @throws UnsupportedOperationException if the access mode is unsupported
|
||||
* for this VarHandle.
|
||||
* @throws WrongMethodTypeException if the access mode type is not
|
||||
* compatible with the caller's symbolic type descriptor.
|
||||
* @throws ClassCastException if the access mode type is compatible with the
|
||||
* caller's symbolic type descriptor, but a reference cast fails.
|
||||
* @see #set(Object...)
|
||||
* @see #getAcquire(Object...)
|
||||
*/
|
||||
public final native
|
||||
@MethodHandle.PolymorphicSignature
|
||||
@HotSpotIntrinsicCandidate
|
||||
Object getAndBitwiseAndAcquire(Object... args);
|
||||
|
||||
/**
|
||||
* Atomically sets the value of a variable to the result of
|
||||
* bitwise AND between the variable's current value and the {@code mask}
|
||||
* with the memory semantics of {@link #setRelease} and returns the
|
||||
* variable's previous value, as accessed with the memory semantics of
|
||||
* {@link #get}.
|
||||
*
|
||||
* <p>If the variable type is the non-integral {@code boolean} type then a
|
||||
* logical AND is performed instead of a bitwise AND.
|
||||
*
|
||||
* <p>The method signature is of the form {@code (CT, T mask)T}.
|
||||
*
|
||||
* <p>The symbolic type descriptor at the call site of {@code getAndBitwiseAndRelease}
|
||||
* must match the access mode type that is the result of calling
|
||||
* {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)} on this
|
||||
* VarHandle.
|
||||
*
|
||||
* @param args the signature-polymorphic parameter list of the form
|
||||
* {@code (CT, T mask)}
|
||||
* , statically represented using varargs.
|
||||
* @return the signature-polymorphic result that is the previous value of
|
||||
* the variable
|
||||
* , statically represented using {@code Object}.
|
||||
* @throws UnsupportedOperationException if the access mode is unsupported
|
||||
* for this VarHandle.
|
||||
* @throws WrongMethodTypeException if the access mode type is not
|
||||
* compatible with the caller's symbolic type descriptor.
|
||||
* @throws ClassCastException if the access mode type is compatible with the
|
||||
* caller's symbolic type descriptor, but a reference cast fails.
|
||||
* @see #setRelease(Object...)
|
||||
* @see #get(Object...)
|
||||
*/
|
||||
public final native
|
||||
@MethodHandle.PolymorphicSignature
|
||||
@HotSpotIntrinsicCandidate
|
||||
Object getAndBitwiseAndRelease(Object... args);
|
||||
|
||||
/**
|
||||
* Atomically sets the value of a variable to the result of
|
||||
* bitwise XOR between the variable's current value and the {@code mask}
|
||||
* with the memory semantics of {@link #setVolatile} and returns the
|
||||
* variable's previous value, as accessed with the memory semantics of
|
||||
* {@link #getVolatile}.
|
||||
*
|
||||
* <p>If the variable type is the non-integral {@code boolean} type then a
|
||||
* logical XOR is performed instead of a bitwise XOR.
|
||||
*
|
||||
* <p>The method signature is of the form {@code (CT, T mask)T}.
|
||||
*
|
||||
* <p>The symbolic type descriptor at the call site of {@code getAndBitwiseXor}
|
||||
* must match the access mode type that is the result of calling
|
||||
* {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_XOR)} on this
|
||||
* VarHandle.
|
||||
*
|
||||
* @param args the signature-polymorphic parameter list of the form
|
||||
* {@code (CT, T mask)}
|
||||
* , statically represented using varargs.
|
||||
* @return the signature-polymorphic result that is the previous value of
|
||||
* the variable
|
||||
* , statically represented using {@code Object}.
|
||||
* @throws UnsupportedOperationException if the access mode is unsupported
|
||||
* for this VarHandle.
|
||||
* @throws WrongMethodTypeException if the access mode type is not
|
||||
* compatible with the caller's symbolic type descriptor.
|
||||
* @throws ClassCastException if the access mode type is compatible with the
|
||||
* caller's symbolic type descriptor, but a reference cast fails.
|
||||
* @see #setVolatile(Object...)
|
||||
* @see #getVolatile(Object...)
|
||||
*/
|
||||
public final native
|
||||
@MethodHandle.PolymorphicSignature
|
||||
@HotSpotIntrinsicCandidate
|
||||
Object getAndBitwiseXor(Object... args);
|
||||
|
||||
/**
|
||||
* Atomically sets the value of a variable to the result of
|
||||
* bitwise XOR between the variable's current value and the {@code mask}
|
||||
* with the memory semantics of {@link #set} and returns the
|
||||
* variable's previous value, as accessed with the memory semantics of
|
||||
* {@link #getAcquire}.
|
||||
*
|
||||
* <p>If the variable type is the non-integral {@code boolean} type then a
|
||||
* logical XOR is performed instead of a bitwise XOR.
|
||||
*
|
||||
* <p>The method signature is of the form {@code (CT, T mask)T}.
|
||||
*
|
||||
* <p>The symbolic type descriptor at the call site of {@code getAndBitwiseXorAcquire}
|
||||
* must match the access mode type that is the result of calling
|
||||
* {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)} on this
|
||||
* VarHandle.
|
||||
*
|
||||
* @param args the signature-polymorphic parameter list of the form
|
||||
* {@code (CT, T mask)}
|
||||
* , statically represented using varargs.
|
||||
* @return the signature-polymorphic result that is the previous value of
|
||||
* the variable
|
||||
* , statically represented using {@code Object}.
|
||||
* @throws UnsupportedOperationException if the access mode is unsupported
|
||||
* for this VarHandle.
|
||||
* @throws WrongMethodTypeException if the access mode type is not
|
||||
* compatible with the caller's symbolic type descriptor.
|
||||
* @throws ClassCastException if the access mode type is compatible with the
|
||||
* caller's symbolic type descriptor, but a reference cast fails.
|
||||
* @see #set(Object...)
|
||||
* @see #getAcquire(Object...)
|
||||
*/
|
||||
public final native
|
||||
@MethodHandle.PolymorphicSignature
|
||||
@HotSpotIntrinsicCandidate
|
||||
Object getAndBitwiseXorAcquire(Object... args);
|
||||
|
||||
/**
|
||||
* Atomically sets the value of a variable to the result of
|
||||
* bitwise XOR between the variable's current value and the {@code mask}
|
||||
* with the memory semantics of {@link #setRelease} and returns the
|
||||
* variable's previous value, as accessed with the memory semantics of
|
||||
* {@link #get}.
|
||||
*
|
||||
* <p>If the variable type is the non-integral {@code boolean} type then a
|
||||
* logical XOR is performed instead of a bitwise XOR.
|
||||
*
|
||||
* <p>The method signature is of the form {@code (CT, T mask)T}.
|
||||
*
|
||||
* <p>The symbolic type descriptor at the call site of {@code getAndBitwiseXorRelease}
|
||||
* must match the access mode type that is the result of calling
|
||||
* {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)} on this
|
||||
* VarHandle.
|
||||
*
|
||||
* @param args the signature-polymorphic parameter list of the form
|
||||
* {@code (CT, T mask)}
|
||||
* , statically represented using varargs.
|
||||
* @return the signature-polymorphic result that is the previous value of
|
||||
* the variable
|
||||
* , statically represented using {@code Object}.
|
||||
* @throws UnsupportedOperationException if the access mode is unsupported
|
||||
* for this VarHandle.
|
||||
* @throws WrongMethodTypeException if the access mode type is not
|
||||
* compatible with the caller's symbolic type descriptor.
|
||||
* @throws ClassCastException if the access mode type is compatible with the
|
||||
* caller's symbolic type descriptor, but a reference cast fails.
|
||||
* @see #setRelease(Object...)
|
||||
* @see #get(Object...)
|
||||
*/
|
||||
public final native
|
||||
@MethodHandle.PolymorphicSignature
|
||||
@HotSpotIntrinsicCandidate
|
||||
Object getAndBitwiseXorRelease(Object... args);
|
||||
|
||||
|
||||
enum AccessType {
|
||||
GET(Object.class),
|
||||
SET(void.class),
|
||||
@ -1231,18 +1718,96 @@ public abstract class VarHandle {
|
||||
* {@link VarHandle#getAndSet VarHandle.getAndSet}
|
||||
*/
|
||||
GET_AND_SET("getAndSet", AccessType.GET_AND_UPDATE),
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#getAndSetAcquire VarHandle.getAndSetAcquire}
|
||||
*/
|
||||
GET_AND_SET_ACQUIRE("getAndSetAcquire", AccessType.GET_AND_UPDATE),
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#getAndSetRelease VarHandle.getAndSetRelease}
|
||||
*/
|
||||
GET_AND_SET_RELEASE("getAndSetRelease", AccessType.GET_AND_UPDATE),
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#getAndAdd VarHandle.getAndAdd}
|
||||
*/
|
||||
GET_AND_ADD("getAndAdd", AccessType.GET_AND_UPDATE),
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#getAndAddAcquire VarHandle.getAndAddAcquire}
|
||||
*/
|
||||
GET_AND_ADD_ACQUIRE("getAndAddAcquire", AccessType.GET_AND_UPDATE),
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#getAndAddRelease VarHandle.getAndAddRelease}
|
||||
*/
|
||||
GET_AND_ADD_RELEASE("getAndAddRelease", AccessType.GET_AND_UPDATE),
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#addAndGet VarHandle.addAndGet}
|
||||
*/
|
||||
ADD_AND_GET("addAndGet", AccessType.GET_AND_UPDATE),
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#getAndBitwiseOr VarHandle.getAndBitwiseOr}
|
||||
*/
|
||||
GET_AND_BITWISE_OR("getAndBitwiseOr", AccessType.GET_AND_UPDATE),
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#getAndBitwiseOrRelease VarHandle.getAndBitwiseOrRelease}
|
||||
*/
|
||||
GET_AND_BITWISE_OR_RELEASE("getAndBitwiseOrRelease", AccessType.GET_AND_UPDATE),
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#getAndBitwiseOrAcquire VarHandle.getAndBitwiseOrAcquire}
|
||||
*/
|
||||
GET_AND_BITWISE_OR_ACQUIRE("getAndBitwiseOrAcquire", AccessType.GET_AND_UPDATE),
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#getAndBitwiseAnd VarHandle.getAndBitwiseAnd}
|
||||
*/
|
||||
GET_AND_BITWISE_AND("getAndBitwiseAnd", AccessType.GET_AND_UPDATE),
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#getAndBitwiseAndRelease VarHandle.getAndBitwiseAndRelease}
|
||||
*/
|
||||
GET_AND_BITWISE_AND_RELEASE("getAndBitwiseAndRelease", AccessType.GET_AND_UPDATE),
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#getAndBitwiseAndAcquire VarHandle.getAndBitwiseAndAcquire}
|
||||
*/
|
||||
GET_AND_BITWISE_AND_ACQUIRE("getAndBitwiseAndAcquire", AccessType.GET_AND_UPDATE),
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#getAndBitwiseXor VarHandle.getAndBitwiseXor}
|
||||
*/
|
||||
GET_AND_BITWISE_XOR("getAndBitwiseXor", AccessType.GET_AND_UPDATE),
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#getAndBitwiseXorRelease VarHandle.getAndBitwiseXorRelease}
|
||||
*/
|
||||
GET_AND_BITWISE_XOR_RELEASE("getAndBitwiseXorRelease", AccessType.GET_AND_UPDATE),
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#getAndBitwiseXorAcquire VarHandle.getAndBitwiseXorAcquire}
|
||||
*/
|
||||
GET_AND_BITWISE_XOR_ACQUIRE("getAndBitwiseXorAcquire", AccessType.GET_AND_UPDATE),
|
||||
;
|
||||
|
||||
static final Map<String, AccessMode> methodNameToAccessMode;
|
||||
|
||||
@ -193,6 +193,20 @@ final class VarHandle$Type$s {
|
||||
handle.fieldOffset,
|
||||
{#if[Object]?handle.fieldType.cast(value):value});
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndSetAcquire(FieldInstanceReadWrite handle, Object holder, $type$ value) {
|
||||
return UNSAFE.getAndSet$Type$Acquire(Objects.requireNonNull(handle.receiverType.cast(holder)),
|
||||
handle.fieldOffset,
|
||||
{#if[Object]?handle.fieldType.cast(value):value});
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndSetRelease(FieldInstanceReadWrite handle, Object holder, $type$ value) {
|
||||
return UNSAFE.getAndSet$Type$Release(Objects.requireNonNull(handle.receiverType.cast(holder)),
|
||||
handle.fieldOffset,
|
||||
{#if[Object]?handle.fieldType.cast(value):value});
|
||||
}
|
||||
#end[CAS]
|
||||
#if[AtomicAdd]
|
||||
|
||||
@ -203,6 +217,20 @@ final class VarHandle$Type$s {
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndAddAcquire(FieldInstanceReadWrite handle, Object holder, $type$ value) {
|
||||
return UNSAFE.getAndAdd$Type$Acquire(Objects.requireNonNull(handle.receiverType.cast(holder)),
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndAddRelease(FieldInstanceReadWrite handle, Object holder, $type$ value) {
|
||||
return UNSAFE.getAndAdd$Type$Release(Objects.requireNonNull(handle.receiverType.cast(holder)),
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ addAndGet(FieldInstanceReadWrite handle, Object holder, $type$ value) {
|
||||
return {#if[ShorterThanInt]?($type$)}(UNSAFE.getAndAdd$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)),
|
||||
@ -210,6 +238,71 @@ final class VarHandle$Type$s {
|
||||
value) + value);
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
#if[Bitwise]
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseOr(FieldInstanceReadWrite handle, Object holder, $type$ value) {
|
||||
return UNSAFE.getAndBitwiseOr$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)),
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseOrRelease(FieldInstanceReadWrite handle, Object holder, $type$ value) {
|
||||
return UNSAFE.getAndBitwiseOr$Type$Release(Objects.requireNonNull(handle.receiverType.cast(holder)),
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseOrAcquire(FieldInstanceReadWrite handle, Object holder, $type$ value) {
|
||||
return UNSAFE.getAndBitwiseOr$Type$Acquire(Objects.requireNonNull(handle.receiverType.cast(holder)),
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseAnd(FieldInstanceReadWrite handle, Object holder, $type$ value) {
|
||||
return UNSAFE.getAndBitwiseAnd$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)),
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseAndRelease(FieldInstanceReadWrite handle, Object holder, $type$ value) {
|
||||
return UNSAFE.getAndBitwiseAnd$Type$Release(Objects.requireNonNull(handle.receiverType.cast(holder)),
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseAndAcquire(FieldInstanceReadWrite handle, Object holder, $type$ value) {
|
||||
return UNSAFE.getAndBitwiseAnd$Type$Acquire(Objects.requireNonNull(handle.receiverType.cast(holder)),
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseXor(FieldInstanceReadWrite handle, Object holder, $type$ value) {
|
||||
return UNSAFE.getAndBitwiseXor$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)),
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseXorRelease(FieldInstanceReadWrite handle, Object holder, $type$ value) {
|
||||
return UNSAFE.getAndBitwiseXor$Type$Release(Objects.requireNonNull(handle.receiverType.cast(holder)),
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseXorAcquire(FieldInstanceReadWrite handle, Object holder, $type$ value) {
|
||||
return UNSAFE.getAndBitwiseXor$Type$Acquire(Objects.requireNonNull(handle.receiverType.cast(holder)),
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
#end[Bitwise]
|
||||
|
||||
static final VarForm FORM = new VarForm(FieldInstanceReadWrite.class, Object.class, $type$.class);
|
||||
}
|
||||
@ -374,6 +467,20 @@ final class VarHandle$Type$s {
|
||||
handle.fieldOffset,
|
||||
{#if[Object]?handle.fieldType.cast(value):value});
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndSetAcquire(FieldStaticReadWrite handle, $type$ value) {
|
||||
return UNSAFE.getAndSet$Type$Acquire(handle.base,
|
||||
handle.fieldOffset,
|
||||
{#if[Object]?handle.fieldType.cast(value):value});
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndSetRelease(FieldStaticReadWrite handle, $type$ value) {
|
||||
return UNSAFE.getAndSet$Type$Release(handle.base,
|
||||
handle.fieldOffset,
|
||||
{#if[Object]?handle.fieldType.cast(value):value});
|
||||
}
|
||||
#end[CAS]
|
||||
#if[AtomicAdd]
|
||||
|
||||
@ -384,6 +491,20 @@ final class VarHandle$Type$s {
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndAddAcquire(FieldStaticReadWrite handle, $type$ value) {
|
||||
return UNSAFE.getAndAdd$Type$Acquire(handle.base,
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndAddRelease(FieldStaticReadWrite handle, $type$ value) {
|
||||
return UNSAFE.getAndAdd$Type$Release(handle.base,
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ addAndGet(FieldStaticReadWrite handle, $type$ value) {
|
||||
return {#if[ShorterThanInt]?($type$)}(UNSAFE.getAndAdd$Type$(handle.base,
|
||||
@ -391,6 +512,71 @@ final class VarHandle$Type$s {
|
||||
value) + value);
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
#if[Bitwise]
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseOr(FieldStaticReadWrite handle, $type$ value) {
|
||||
return UNSAFE.getAndBitwiseOr$Type$(handle.base,
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseOrRelease(FieldStaticReadWrite handle, $type$ value) {
|
||||
return UNSAFE.getAndBitwiseOr$Type$Release(handle.base,
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseOrAcquire(FieldStaticReadWrite handle, $type$ value) {
|
||||
return UNSAFE.getAndBitwiseOr$Type$Acquire(handle.base,
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseAnd(FieldStaticReadWrite handle, $type$ value) {
|
||||
return UNSAFE.getAndBitwiseAnd$Type$(handle.base,
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseAndRelease(FieldStaticReadWrite handle, $type$ value) {
|
||||
return UNSAFE.getAndBitwiseAnd$Type$Release(handle.base,
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseAndAcquire(FieldStaticReadWrite handle, $type$ value) {
|
||||
return UNSAFE.getAndBitwiseAnd$Type$Acquire(handle.base,
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseXor(FieldStaticReadWrite handle, $type$ value) {
|
||||
return UNSAFE.getAndBitwiseXor$Type$(handle.base,
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseXorRelease(FieldStaticReadWrite handle, $type$ value) {
|
||||
return UNSAFE.getAndBitwiseXor$Type$Release(handle.base,
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseXorAcquire(FieldStaticReadWrite handle, $type$ value) {
|
||||
return UNSAFE.getAndBitwiseXor$Type$Acquire(handle.base,
|
||||
handle.fieldOffset,
|
||||
value);
|
||||
}
|
||||
#end[Bitwise]
|
||||
|
||||
static final VarForm FORM = new VarForm(FieldStaticReadWrite.class, null, $type$.class);
|
||||
}
|
||||
@ -624,33 +810,139 @@ final class VarHandle$Type$s {
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
{#if[Object]?handle.componentType.cast(value):value});
|
||||
}
|
||||
#end[CAS]
|
||||
#if[AtomicAdd]
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndAdd(Array handle, Object oarray, int index, $type$ value) {
|
||||
static $type$ getAndSetAcquire(Array handle, Object oarray, int index, $type$ value) {
|
||||
#if[Object]
|
||||
Object[] array = (Object[]) handle.arrayType.cast(oarray);
|
||||
#else[Object]
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
#end[Object]
|
||||
return UNSAFE.getAndSet$Type$Acquire(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
{#if[Object]?handle.componentType.cast(value):value});
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndSetRelease(Array handle, Object oarray, int index, $type$ value) {
|
||||
#if[Object]
|
||||
Object[] array = (Object[]) handle.arrayType.cast(oarray);
|
||||
#else[Object]
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
#end[Object]
|
||||
return UNSAFE.getAndSet$Type$Release(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
{#if[Object]?handle.componentType.cast(value):value});
|
||||
}
|
||||
#end[CAS]
|
||||
#if[AtomicAdd]
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndAdd(Array handle, Object oarray, int index, $type$ value) {
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndAdd$Type$(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ addAndGet(Array handle, Object oarray, int index, $type$ value) {
|
||||
#if[Object]
|
||||
Object[] array = (Object[]) handle.arrayType.cast(oarray);
|
||||
#else[Object]
|
||||
static $type$ getAndAddAcquire(Array handle, Object oarray, int index, $type$ value) {
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndAdd$Type$Acquire(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndAddRelease(Array handle, Object oarray, int index, $type$ value) {
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndAdd$Type$Release(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ addAndGet(Array handle, Object oarray, int index, $type$ value) {
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
#end[Object]
|
||||
return {#if[ShorterThanInt]?($type$)}(UNSAFE.getAndAdd$Type$(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
value) + value);
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
#if[Bitwise]
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseOr(Array handle, Object oarray, int index, $type$ value) {
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndBitwiseOr$Type$(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseOrRelease(Array handle, Object oarray, int index, $type$ value) {
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndBitwiseOr$Type$Release(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseOrAcquire(Array handle, Object oarray, int index, $type$ value) {
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndBitwiseOr$Type$Acquire(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseAnd(Array handle, Object oarray, int index, $type$ value) {
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndBitwiseAnd$Type$(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseAndRelease(Array handle, Object oarray, int index, $type$ value) {
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndBitwiseAnd$Type$Release(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseAndAcquire(Array handle, Object oarray, int index, $type$ value) {
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndBitwiseAnd$Type$Acquire(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseXor(Array handle, Object oarray, int index, $type$ value) {
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndBitwiseXor$Type$(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseXorRelease(Array handle, Object oarray, int index, $type$ value) {
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndBitwiseXor$Type$Release(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseXorAcquire(Array handle, Object oarray, int index, $type$ value) {
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndBitwiseXor$Type$Acquire(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
#end[Bitwise]
|
||||
|
||||
static final VarForm FORM = new VarForm(Array.class, {#if[Object]?Object[].class:$type$[].class}, {#if[Object]?Object.class:$type$.class}, int.class);
|
||||
}
|
||||
|
||||
@ -267,6 +267,26 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||
address(ba, index(ba, index)),
|
||||
convEndian(handle.be, value)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndSetAcquire(ArrayHandle handle, Object oba, int index, $type$ value) {
|
||||
byte[] ba = (byte[]) oba;
|
||||
return convEndian(handle.be,
|
||||
UNSAFE.getAndSet$RawType$Acquire(
|
||||
ba,
|
||||
address(ba, index(ba, index)),
|
||||
convEndian(handle.be, value)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndSetRelease(ArrayHandle handle, Object oba, int index, $type$ value) {
|
||||
byte[] ba = (byte[]) oba;
|
||||
return convEndian(handle.be,
|
||||
UNSAFE.getAndSet$RawType$Release(
|
||||
ba,
|
||||
address(ba, index(ba, index)),
|
||||
convEndian(handle.be, value)));
|
||||
}
|
||||
#end[CAS]
|
||||
#if[AtomicAdd]
|
||||
|
||||
@ -283,6 +303,32 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndAddAcquire(ArrayHandle handle, Object oba, int index, $type$ delta) {
|
||||
byte[] ba = (byte[]) oba;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndAdd$RawType$Acquire(
|
||||
ba,
|
||||
address(ba, index(ba, index)),
|
||||
delta);
|
||||
} else {
|
||||
return getAndAddConvEndianWithCAS(ba, index, delta);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndAddRelease(ArrayHandle handle, Object oba, int index, $type$ delta) {
|
||||
byte[] ba = (byte[]) oba;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndAdd$RawType$Release(
|
||||
ba,
|
||||
address(ba, index(ba, index)),
|
||||
delta);
|
||||
} else {
|
||||
return getAndAddConvEndianWithCAS(ba, index, delta);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndAddConvEndianWithCAS(byte[] ba, int index, $type$ delta) {
|
||||
$type$ nativeExpectedValue, expectedValue;
|
||||
@ -300,6 +346,161 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||
return getAndAdd(handle, oba, index, delta) + delta;
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
#if[Bitwise]
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseOr(ArrayHandle handle, Object oba, int index, $type$ value) {
|
||||
byte[] ba = (byte[]) oba;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseOr$RawType$(
|
||||
ba,
|
||||
address(ba, index(ba, index)),
|
||||
value);
|
||||
} else {
|
||||
return getAndBitwiseOrConvEndianWithCAS(ba, index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseOrRelease(ArrayHandle handle, Object oba, int index, $type$ value) {
|
||||
byte[] ba = (byte[]) oba;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseOr$RawType$Release(
|
||||
ba,
|
||||
address(ba, index(ba, index)),
|
||||
value);
|
||||
} else {
|
||||
return getAndBitwiseOrConvEndianWithCAS(ba, index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseOrAcquire(ArrayHandle handle, Object oba, int index, $type$ value) {
|
||||
byte[] ba = (byte[]) oba;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseOr$RawType$Acquire(
|
||||
ba,
|
||||
address(ba, index(ba, index)),
|
||||
value);
|
||||
} else {
|
||||
return getAndBitwiseOrConvEndianWithCAS(ba, index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseOrConvEndianWithCAS(byte[] ba, int index, $type$ value) {
|
||||
$type$ nativeExpectedValue, expectedValue;
|
||||
long offset = address(ba, index(ba, index));
|
||||
do {
|
||||
nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset);
|
||||
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
|
||||
} while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(ba, offset,
|
||||
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue | value)));
|
||||
return expectedValue;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseAnd(ArrayHandle handle, Object oba, int index, $type$ value) {
|
||||
byte[] ba = (byte[]) oba;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseAnd$RawType$(
|
||||
ba,
|
||||
address(ba, index(ba, index)),
|
||||
value);
|
||||
} else {
|
||||
return getAndBitwiseAndConvEndianWithCAS(ba, index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseAndRelease(ArrayHandle handle, Object oba, int index, $type$ value) {
|
||||
byte[] ba = (byte[]) oba;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseAnd$RawType$Release(
|
||||
ba,
|
||||
address(ba, index(ba, index)),
|
||||
value);
|
||||
} else {
|
||||
return getAndBitwiseAndConvEndianWithCAS(ba, index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseAndAcquire(ArrayHandle handle, Object oba, int index, $type$ value) {
|
||||
byte[] ba = (byte[]) oba;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseAnd$RawType$Acquire(
|
||||
ba,
|
||||
address(ba, index(ba, index)),
|
||||
value);
|
||||
} else {
|
||||
return getAndBitwiseAndConvEndianWithCAS(ba, index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseAndConvEndianWithCAS(byte[] ba, int index, $type$ value) {
|
||||
$type$ nativeExpectedValue, expectedValue;
|
||||
long offset = address(ba, index(ba, index));
|
||||
do {
|
||||
nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset);
|
||||
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
|
||||
} while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(ba, offset,
|
||||
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue & value)));
|
||||
return expectedValue;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseXor(ArrayHandle handle, Object oba, int index, $type$ value) {
|
||||
byte[] ba = (byte[]) oba;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseXor$RawType$(
|
||||
ba,
|
||||
address(ba, index(ba, index)),
|
||||
value);
|
||||
} else {
|
||||
return getAndBitwiseXorConvEndianWithCAS(ba, index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseXorRelease(ArrayHandle handle, Object oba, int index, $type$ value) {
|
||||
byte[] ba = (byte[]) oba;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseXor$RawType$Release(
|
||||
ba,
|
||||
address(ba, index(ba, index)),
|
||||
value);
|
||||
} else {
|
||||
return getAndBitwiseXorConvEndianWithCAS(ba, index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseXorAcquire(ArrayHandle handle, Object oba, int index, $type$ value) {
|
||||
byte[] ba = (byte[]) oba;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseXor$RawType$Acquire(
|
||||
ba,
|
||||
address(ba, index(ba, index)),
|
||||
value);
|
||||
} else {
|
||||
return getAndBitwiseXorConvEndianWithCAS(ba, index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseXorConvEndianWithCAS(byte[] ba, int index, $type$ value) {
|
||||
$type$ nativeExpectedValue, expectedValue;
|
||||
long offset = address(ba, index(ba, index));
|
||||
do {
|
||||
nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset);
|
||||
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
|
||||
} while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(ba, offset,
|
||||
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue ^ value)));
|
||||
return expectedValue;
|
||||
}
|
||||
#end[Bitwise]
|
||||
|
||||
static final VarForm FORM = new VarForm(ArrayHandle.class, byte[].class, $type$.class, int.class);
|
||||
}
|
||||
@ -510,6 +711,26 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||
address(bb, indexRO(bb, index)),
|
||||
convEndian(handle.be, value)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndSetAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||
ByteBuffer bb = (ByteBuffer) obb;
|
||||
return convEndian(handle.be,
|
||||
UNSAFE.getAndSet$RawType$Acquire(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
convEndian(handle.be, value)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndSetRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||
ByteBuffer bb = (ByteBuffer) obb;
|
||||
return convEndian(handle.be,
|
||||
UNSAFE.getAndSet$RawType$Release(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
convEndian(handle.be, value)));
|
||||
}
|
||||
#end[CAS]
|
||||
#if[AtomicAdd]
|
||||
|
||||
@ -526,6 +747,32 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndAddAcquire(ByteBufferHandle handle, Object obb, int index, $type$ delta) {
|
||||
ByteBuffer bb = (ByteBuffer) obb;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndAdd$RawType$Acquire(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
delta);
|
||||
} else {
|
||||
return getAndAddConvEndianWithCAS(bb, index, delta);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndAddRelease(ByteBufferHandle handle, Object obb, int index, $type$ delta) {
|
||||
ByteBuffer bb = (ByteBuffer) obb;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndAdd$RawType$Release(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
delta);
|
||||
} else {
|
||||
return getAndAddConvEndianWithCAS(bb, index, delta);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndAddConvEndianWithCAS(ByteBuffer bb, int index, $type$ delta) {
|
||||
$type$ nativeExpectedValue, expectedValue;
|
||||
@ -544,6 +791,165 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||
return getAndAdd(handle, obb, index, delta) + delta;
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
#if[Bitwise]
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseOr(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||
ByteBuffer bb = (ByteBuffer) obb;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseOr$RawType$(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
value);
|
||||
} else {
|
||||
return getAndBitwiseOrConvEndianWithCAS(bb, index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseOrRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||
ByteBuffer bb = (ByteBuffer) obb;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseOr$RawType$Release(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
value);
|
||||
} else {
|
||||
return getAndBitwiseOrConvEndianWithCAS(bb, index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseOrAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||
ByteBuffer bb = (ByteBuffer) obb;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseOr$RawType$Acquire(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
value);
|
||||
} else {
|
||||
return getAndBitwiseOrConvEndianWithCAS(bb, index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseOrConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) {
|
||||
$type$ nativeExpectedValue, expectedValue;
|
||||
Object base = UNSAFE.getObject(bb, BYTE_BUFFER_HB);
|
||||
long offset = address(bb, indexRO(bb, index));
|
||||
do {
|
||||
nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset);
|
||||
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
|
||||
} while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(base, offset,
|
||||
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue | value)));
|
||||
return expectedValue;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseAnd(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||
ByteBuffer bb = (ByteBuffer) obb;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseAnd$RawType$(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
value);
|
||||
} else {
|
||||
return getAndBitwiseAndConvEndianWithCAS(bb, index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseAndRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||
ByteBuffer bb = (ByteBuffer) obb;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseAnd$RawType$Release(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
value);
|
||||
} else {
|
||||
return getAndBitwiseAndConvEndianWithCAS(bb, index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseAndAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||
ByteBuffer bb = (ByteBuffer) obb;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseAnd$RawType$Acquire(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
value);
|
||||
} else {
|
||||
return getAndBitwiseAndConvEndianWithCAS(bb, index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseAndConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) {
|
||||
$type$ nativeExpectedValue, expectedValue;
|
||||
Object base = UNSAFE.getObject(bb, BYTE_BUFFER_HB);
|
||||
long offset = address(bb, indexRO(bb, index));
|
||||
do {
|
||||
nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset);
|
||||
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
|
||||
} while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(base, offset,
|
||||
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue & value)));
|
||||
return expectedValue;
|
||||
}
|
||||
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseXor(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||
ByteBuffer bb = (ByteBuffer) obb;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseXor$RawType$(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
value);
|
||||
} else {
|
||||
return getAndBitwiseXorConvEndianWithCAS(bb, index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseXorRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||
ByteBuffer bb = (ByteBuffer) obb;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseXor$RawType$Release(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
value);
|
||||
} else {
|
||||
return getAndBitwiseXorConvEndianWithCAS(bb, index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseXorAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||
ByteBuffer bb = (ByteBuffer) obb;
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseXor$RawType$Acquire(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
value);
|
||||
} else {
|
||||
return getAndBitwiseXorConvEndianWithCAS(bb, index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static $type$ getAndBitwiseXorConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) {
|
||||
$type$ nativeExpectedValue, expectedValue;
|
||||
Object base = UNSAFE.getObject(bb, BYTE_BUFFER_HB);
|
||||
long offset = address(bb, indexRO(bb, index));
|
||||
do {
|
||||
nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset);
|
||||
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
|
||||
} while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(base, offset,
|
||||
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue ^ value)));
|
||||
return expectedValue;
|
||||
}
|
||||
#end[Bitwise]
|
||||
|
||||
static final VarForm FORM = new VarForm(ByteBufferHandle.class, ByteBuffer.class, $type$.class, int.class);
|
||||
}
|
||||
|
||||
@ -2278,6 +2278,24 @@ public final class Unsafe {
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final int getAndAddIntRelease(Object o, long offset, int delta) {
|
||||
int v;
|
||||
do {
|
||||
v = getInt(o, offset);
|
||||
} while (!weakCompareAndSwapIntRelease(o, offset, v, v + delta));
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final int getAndAddIntAcquire(Object o, long offset, int delta) {
|
||||
int v;
|
||||
do {
|
||||
v = getIntAcquire(o, offset);
|
||||
} while (!weakCompareAndSwapIntAcquire(o, offset, v, v + delta));
|
||||
return v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Atomically adds the given value to the current value of a field
|
||||
* or array element within the given object {@code o}
|
||||
@ -2298,6 +2316,24 @@ public final class Unsafe {
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final long getAndAddLongRelease(Object o, long offset, long delta) {
|
||||
long v;
|
||||
do {
|
||||
v = getLong(o, offset);
|
||||
} while (!weakCompareAndSwapLongRelease(o, offset, v, v + delta));
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final long getAndAddLongAcquire(Object o, long offset, long delta) {
|
||||
long v;
|
||||
do {
|
||||
v = getLongAcquire(o, offset);
|
||||
} while (!weakCompareAndSwapLongAcquire(o, offset, v, v + delta));
|
||||
return v;
|
||||
}
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final byte getAndAddByte(Object o, long offset, byte delta) {
|
||||
byte v;
|
||||
@ -2307,6 +2343,24 @@ public final class Unsafe {
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final byte getAndAddByteRelease(Object o, long offset, byte delta) {
|
||||
byte v;
|
||||
do {
|
||||
v = getByte(o, offset);
|
||||
} while (!weakCompareAndSwapByteRelease(o, offset, v, (byte) (v + delta)));
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final byte getAndAddByteAcquire(Object o, long offset, byte delta) {
|
||||
byte v;
|
||||
do {
|
||||
v = getByteAcquire(o, offset);
|
||||
} while (!weakCompareAndSwapByteAcquire(o, offset, v, (byte) (v + delta)));
|
||||
return v;
|
||||
}
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final short getAndAddShort(Object o, long offset, short delta) {
|
||||
short v;
|
||||
@ -2316,11 +2370,39 @@ public final class Unsafe {
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final short getAndAddShortRelease(Object o, long offset, short delta) {
|
||||
short v;
|
||||
do {
|
||||
v = getShort(o, offset);
|
||||
} while (!weakCompareAndSwapShortRelease(o, offset, v, (short) (v + delta)));
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final short getAndAddShortAcquire(Object o, long offset, short delta) {
|
||||
short v;
|
||||
do {
|
||||
v = getShortAcquire(o, offset);
|
||||
} while (!weakCompareAndSwapShortAcquire(o, offset, v, (short) (v + delta)));
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final char getAndAddChar(Object o, long offset, char delta) {
|
||||
return (char) getAndAddShort(o, offset, (short) delta);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final char getAndAddCharRelease(Object o, long offset, char delta) {
|
||||
return (char) getAndAddShortRelease(o, offset, (short) delta);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final char getAndAddCharAcquire(Object o, long offset, char delta) {
|
||||
return (char) getAndAddShortAcquire(o, offset, (short) delta);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final float getAndAddFloat(Object o, long offset, float delta) {
|
||||
int expectedBits;
|
||||
@ -2336,6 +2418,36 @@ public final class Unsafe {
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final float getAndAddFloatRelease(Object o, long offset, float delta) {
|
||||
int expectedBits;
|
||||
float v;
|
||||
do {
|
||||
// Load and CAS with the raw bits to avoid issues with NaNs and
|
||||
// possible bit conversion from signaling NaNs to quiet NaNs that
|
||||
// may result in the loop not terminating.
|
||||
expectedBits = getInt(o, offset);
|
||||
v = Float.intBitsToFloat(expectedBits);
|
||||
} while (!weakCompareAndSwapIntRelease(o, offset,
|
||||
expectedBits, Float.floatToRawIntBits(v + delta)));
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final float getAndAddFloatAcquire(Object o, long offset, float delta) {
|
||||
int expectedBits;
|
||||
float v;
|
||||
do {
|
||||
// Load and CAS with the raw bits to avoid issues with NaNs and
|
||||
// possible bit conversion from signaling NaNs to quiet NaNs that
|
||||
// may result in the loop not terminating.
|
||||
expectedBits = getIntAcquire(o, offset);
|
||||
v = Float.intBitsToFloat(expectedBits);
|
||||
} while (!weakCompareAndSwapIntAcquire(o, offset,
|
||||
expectedBits, Float.floatToRawIntBits(v + delta)));
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final double getAndAddDouble(Object o, long offset, double delta) {
|
||||
long expectedBits;
|
||||
@ -2351,6 +2463,36 @@ public final class Unsafe {
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final double getAndAddDoubleRelease(Object o, long offset, double delta) {
|
||||
long expectedBits;
|
||||
double v;
|
||||
do {
|
||||
// Load and CAS with the raw bits to avoid issues with NaNs and
|
||||
// possible bit conversion from signaling NaNs to quiet NaNs that
|
||||
// may result in the loop not terminating.
|
||||
expectedBits = getLong(o, offset);
|
||||
v = Double.longBitsToDouble(expectedBits);
|
||||
} while (!weakCompareAndSwapLongRelease(o, offset,
|
||||
expectedBits, Double.doubleToRawLongBits(v + delta)));
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final double getAndAddDoubleAcquire(Object o, long offset, double delta) {
|
||||
long expectedBits;
|
||||
double v;
|
||||
do {
|
||||
// Load and CAS with the raw bits to avoid issues with NaNs and
|
||||
// possible bit conversion from signaling NaNs to quiet NaNs that
|
||||
// may result in the loop not terminating.
|
||||
expectedBits = getLongAcquire(o, offset);
|
||||
v = Double.longBitsToDouble(expectedBits);
|
||||
} while (!weakCompareAndSwapLongAcquire(o, offset,
|
||||
expectedBits, Double.doubleToRawLongBits(v + delta)));
|
||||
return v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Atomically exchanges the given value with the current value of
|
||||
* a field or array element within the given object {@code o}
|
||||
@ -2371,6 +2513,24 @@ public final class Unsafe {
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final int getAndSetIntRelease(Object o, long offset, int newValue) {
|
||||
int v;
|
||||
do {
|
||||
v = getInt(o, offset);
|
||||
} while (!weakCompareAndSwapIntRelease(o, offset, v, newValue));
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final int getAndSetIntAcquire(Object o, long offset, int newValue) {
|
||||
int v;
|
||||
do {
|
||||
v = getIntAcquire(o, offset);
|
||||
} while (!weakCompareAndSwapIntAcquire(o, offset, v, newValue));
|
||||
return v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Atomically exchanges the given value with the current value of
|
||||
* a field or array element within the given object {@code o}
|
||||
@ -2391,6 +2551,24 @@ public final class Unsafe {
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final long getAndSetLongRelease(Object o, long offset, long newValue) {
|
||||
long v;
|
||||
do {
|
||||
v = getLong(o, offset);
|
||||
} while (!weakCompareAndSwapLongRelease(o, offset, v, newValue));
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final long getAndSetLongAcquire(Object o, long offset, long newValue) {
|
||||
long v;
|
||||
do {
|
||||
v = getLongAcquire(o, offset);
|
||||
} while (!weakCompareAndSwapLongAcquire(o, offset, v, newValue));
|
||||
return v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Atomically exchanges the given reference value with the current
|
||||
* reference value of a field or array element within the given
|
||||
@ -2411,6 +2589,24 @@ public final class Unsafe {
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final Object getAndSetObjectRelease(Object o, long offset, Object newValue) {
|
||||
Object v;
|
||||
do {
|
||||
v = getObject(o, offset);
|
||||
} while (!weakCompareAndSwapObjectRelease(o, offset, v, newValue));
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final Object getAndSetObjectAcquire(Object o, long offset, Object newValue) {
|
||||
Object v;
|
||||
do {
|
||||
v = getObjectAcquire(o, offset);
|
||||
} while (!weakCompareAndSwapObjectAcquire(o, offset, v, newValue));
|
||||
return v;
|
||||
}
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final byte getAndSetByte(Object o, long offset, byte newValue) {
|
||||
byte v;
|
||||
@ -2420,11 +2616,39 @@ public final class Unsafe {
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final byte getAndSetByteRelease(Object o, long offset, byte newValue) {
|
||||
byte v;
|
||||
do {
|
||||
v = getByte(o, offset);
|
||||
} while (!weakCompareAndSwapByteRelease(o, offset, v, newValue));
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final byte getAndSetByteAcquire(Object o, long offset, byte newValue) {
|
||||
byte v;
|
||||
do {
|
||||
v = getByteAcquire(o, offset);
|
||||
} while (!weakCompareAndSwapByteAcquire(o, offset, v, newValue));
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final boolean getAndSetBoolean(Object o, long offset, boolean newValue) {
|
||||
return byte2bool(getAndSetByte(o, offset, bool2byte(newValue)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final boolean getAndSetBooleanRelease(Object o, long offset, boolean newValue) {
|
||||
return byte2bool(getAndSetByteRelease(o, offset, bool2byte(newValue)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final boolean getAndSetBooleanAcquire(Object o, long offset, boolean newValue) {
|
||||
return byte2bool(getAndSetByteAcquire(o, offset, bool2byte(newValue)));
|
||||
}
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final short getAndSetShort(Object o, long offset, short newValue) {
|
||||
short v;
|
||||
@ -2434,23 +2658,559 @@ public final class Unsafe {
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final short getAndSetShortRelease(Object o, long offset, short newValue) {
|
||||
short v;
|
||||
do {
|
||||
v = getShort(o, offset);
|
||||
} while (!weakCompareAndSwapShortRelease(o, offset, v, newValue));
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final short getAndSetShortAcquire(Object o, long offset, short newValue) {
|
||||
short v;
|
||||
do {
|
||||
v = getShortAcquire(o, offset);
|
||||
} while (!weakCompareAndSwapShortAcquire(o, offset, v, newValue));
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final char getAndSetChar(Object o, long offset, char newValue) {
|
||||
return s2c(getAndSetShort(o, offset, c2s(newValue)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final char getAndSetCharRelease(Object o, long offset, char newValue) {
|
||||
return s2c(getAndSetShortRelease(o, offset, c2s(newValue)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final char getAndSetCharAcquire(Object o, long offset, char newValue) {
|
||||
return s2c(getAndSetShortAcquire(o, offset, c2s(newValue)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final float getAndSetFloat(Object o, long offset, float newValue) {
|
||||
int v = getAndSetInt(o, offset, Float.floatToRawIntBits(newValue));
|
||||
return Float.intBitsToFloat(v);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final float getAndSetFloatRelease(Object o, long offset, float newValue) {
|
||||
int v = getAndSetIntRelease(o, offset, Float.floatToRawIntBits(newValue));
|
||||
return Float.intBitsToFloat(v);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final float getAndSetFloatAcquire(Object o, long offset, float newValue) {
|
||||
int v = getAndSetIntAcquire(o, offset, Float.floatToRawIntBits(newValue));
|
||||
return Float.intBitsToFloat(v);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final double getAndSetDouble(Object o, long offset, double newValue) {
|
||||
long v = getAndSetLong(o, offset, Double.doubleToRawLongBits(newValue));
|
||||
return Double.longBitsToDouble(v);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final double getAndSetDoubleRelease(Object o, long offset, double newValue) {
|
||||
long v = getAndSetLongRelease(o, offset, Double.doubleToRawLongBits(newValue));
|
||||
return Double.longBitsToDouble(v);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final double getAndSetDoubleAcquire(Object o, long offset, double newValue) {
|
||||
long v = getAndSetLongAcquire(o, offset, Double.doubleToRawLongBits(newValue));
|
||||
return Double.longBitsToDouble(v);
|
||||
}
|
||||
|
||||
|
||||
// The following contain CAS-based Java implementations used on
|
||||
// platforms not supporting native instructions
|
||||
|
||||
@ForceInline
|
||||
public final boolean getAndBitwiseOrBoolean(Object o, long offset, boolean mask) {
|
||||
return byte2bool(getAndBitwiseOrByte(o, offset, bool2byte(mask)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final boolean getAndBitwiseOrBooleanRelease(Object o, long offset, boolean mask) {
|
||||
return byte2bool(getAndBitwiseOrByteRelease(o, offset, bool2byte(mask)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final boolean getAndBitwiseOrBooleanAcquire(Object o, long offset, boolean mask) {
|
||||
return byte2bool(getAndBitwiseOrByteAcquire(o, offset, bool2byte(mask)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final boolean getAndBitwiseAndBoolean(Object o, long offset, boolean mask) {
|
||||
return byte2bool(getAndBitwiseAndByte(o, offset, bool2byte(mask)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final boolean getAndBitwiseAndBooleanRelease(Object o, long offset, boolean mask) {
|
||||
return byte2bool(getAndBitwiseAndByteRelease(o, offset, bool2byte(mask)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final boolean getAndBitwiseAndBooleanAcquire(Object o, long offset, boolean mask) {
|
||||
return byte2bool(getAndBitwiseAndByteAcquire(o, offset, bool2byte(mask)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final boolean getAndBitwiseXorBoolean(Object o, long offset, boolean mask) {
|
||||
return byte2bool(getAndBitwiseXorByte(o, offset, bool2byte(mask)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final boolean getAndBitwiseXorBooleanRelease(Object o, long offset, boolean mask) {
|
||||
return byte2bool(getAndBitwiseXorByteRelease(o, offset, bool2byte(mask)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final boolean getAndBitwiseXorBooleanAcquire(Object o, long offset, boolean mask) {
|
||||
return byte2bool(getAndBitwiseXorByteAcquire(o, offset, bool2byte(mask)));
|
||||
}
|
||||
|
||||
|
||||
@ForceInline
|
||||
public final byte getAndBitwiseOrByte(Object o, long offset, byte mask) {
|
||||
byte current;
|
||||
do {
|
||||
current = getByteVolatile(o, offset);
|
||||
} while (!weakCompareAndSwapByteVolatile(o, offset,
|
||||
current, (byte) (current | mask)));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final byte getAndBitwiseOrByteRelease(Object o, long offset, byte mask) {
|
||||
byte current;
|
||||
do {
|
||||
current = getByte(o, offset);
|
||||
} while (!weakCompareAndSwapByteRelease(o, offset,
|
||||
current, (byte) (current | mask)));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final byte getAndBitwiseOrByteAcquire(Object o, long offset, byte mask) {
|
||||
byte current;
|
||||
do {
|
||||
// Plain read, the value is a hint, the acquire CAS does the work
|
||||
current = getByte(o, offset);
|
||||
} while (!weakCompareAndSwapByteAcquire(o, offset,
|
||||
current, (byte) (current | mask)));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final byte getAndBitwiseAndByte(Object o, long offset, byte mask) {
|
||||
byte current;
|
||||
do {
|
||||
current = getByteVolatile(o, offset);
|
||||
} while (!weakCompareAndSwapByteVolatile(o, offset,
|
||||
current, (byte) (current & mask)));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final byte getAndBitwiseAndByteRelease(Object o, long offset, byte mask) {
|
||||
byte current;
|
||||
do {
|
||||
current = getByte(o, offset);
|
||||
} while (!weakCompareAndSwapByteRelease(o, offset,
|
||||
current, (byte) (current & mask)));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final byte getAndBitwiseAndByteAcquire(Object o, long offset, byte mask) {
|
||||
byte current;
|
||||
do {
|
||||
// Plain read, the value is a hint, the acquire CAS does the work
|
||||
current = getByte(o, offset);
|
||||
} while (!weakCompareAndSwapByteAcquire(o, offset,
|
||||
current, (byte) (current & mask)));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final byte getAndBitwiseXorByte(Object o, long offset, byte mask) {
|
||||
byte current;
|
||||
do {
|
||||
current = getByteVolatile(o, offset);
|
||||
} while (!weakCompareAndSwapByteVolatile(o, offset,
|
||||
current, (byte) (current ^ mask)));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final byte getAndBitwiseXorByteRelease(Object o, long offset, byte mask) {
|
||||
byte current;
|
||||
do {
|
||||
current = getByte(o, offset);
|
||||
} while (!weakCompareAndSwapByteRelease(o, offset,
|
||||
current, (byte) (current ^ mask)));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final byte getAndBitwiseXorByteAcquire(Object o, long offset, byte mask) {
|
||||
byte current;
|
||||
do {
|
||||
// Plain read, the value is a hint, the acquire CAS does the work
|
||||
current = getByte(o, offset);
|
||||
} while (!weakCompareAndSwapByteAcquire(o, offset,
|
||||
current, (byte) (current ^ mask)));
|
||||
return current;
|
||||
}
|
||||
|
||||
|
||||
@ForceInline
|
||||
public final char getAndBitwiseOrChar(Object o, long offset, char mask) {
|
||||
return s2c(getAndBitwiseOrShort(o, offset, c2s(mask)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final char getAndBitwiseOrCharRelease(Object o, long offset, char mask) {
|
||||
return s2c(getAndBitwiseOrShortRelease(o, offset, c2s(mask)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final char getAndBitwiseOrCharAcquire(Object o, long offset, char mask) {
|
||||
return s2c(getAndBitwiseOrShortAcquire(o, offset, c2s(mask)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final char getAndBitwiseAndChar(Object o, long offset, char mask) {
|
||||
return s2c(getAndBitwiseAndShort(o, offset, c2s(mask)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final char getAndBitwiseAndCharRelease(Object o, long offset, char mask) {
|
||||
return s2c(getAndBitwiseAndShortRelease(o, offset, c2s(mask)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final char getAndBitwiseAndCharAcquire(Object o, long offset, char mask) {
|
||||
return s2c(getAndBitwiseAndShortAcquire(o, offset, c2s(mask)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final char getAndBitwiseXorChar(Object o, long offset, char mask) {
|
||||
return s2c(getAndBitwiseXorShort(o, offset, c2s(mask)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final char getAndBitwiseXorCharRelease(Object o, long offset, char mask) {
|
||||
return s2c(getAndBitwiseXorShortRelease(o, offset, c2s(mask)));
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final char getAndBitwiseXorCharAcquire(Object o, long offset, char mask) {
|
||||
return s2c(getAndBitwiseXorShortAcquire(o, offset, c2s(mask)));
|
||||
}
|
||||
|
||||
|
||||
@ForceInline
|
||||
public final short getAndBitwiseOrShort(Object o, long offset, short mask) {
|
||||
short current;
|
||||
do {
|
||||
current = getShortVolatile(o, offset);
|
||||
} while (!weakCompareAndSwapShortVolatile(o, offset,
|
||||
current, (short) (current | mask)));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final short getAndBitwiseOrShortRelease(Object o, long offset, short mask) {
|
||||
short current;
|
||||
do {
|
||||
current = getShort(o, offset);
|
||||
} while (!weakCompareAndSwapShortRelease(o, offset,
|
||||
current, (short) (current | mask)));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final short getAndBitwiseOrShortAcquire(Object o, long offset, short mask) {
|
||||
short current;
|
||||
do {
|
||||
// Plain read, the value is a hint, the acquire CAS does the work
|
||||
current = getShort(o, offset);
|
||||
} while (!weakCompareAndSwapShortAcquire(o, offset,
|
||||
current, (short) (current | mask)));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final short getAndBitwiseAndShort(Object o, long offset, short mask) {
|
||||
short current;
|
||||
do {
|
||||
current = getShortVolatile(o, offset);
|
||||
} while (!weakCompareAndSwapShortVolatile(o, offset,
|
||||
current, (short) (current & mask)));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final short getAndBitwiseAndShortRelease(Object o, long offset, short mask) {
|
||||
short current;
|
||||
do {
|
||||
current = getShort(o, offset);
|
||||
} while (!weakCompareAndSwapShortRelease(o, offset,
|
||||
current, (short) (current & mask)));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final short getAndBitwiseAndShortAcquire(Object o, long offset, short mask) {
|
||||
short current;
|
||||
do {
|
||||
// Plain read, the value is a hint, the acquire CAS does the work
|
||||
current = getShort(o, offset);
|
||||
} while (!weakCompareAndSwapShortAcquire(o, offset,
|
||||
current, (short) (current & mask)));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final short getAndBitwiseXorShort(Object o, long offset, short mask) {
|
||||
short current;
|
||||
do {
|
||||
current = getShortVolatile(o, offset);
|
||||
} while (!weakCompareAndSwapShortVolatile(o, offset,
|
||||
current, (short) (current ^ mask)));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final short getAndBitwiseXorShortRelease(Object o, long offset, short mask) {
|
||||
short current;
|
||||
do {
|
||||
current = getShort(o, offset);
|
||||
} while (!weakCompareAndSwapShortRelease(o, offset,
|
||||
current, (short) (current ^ mask)));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final short getAndBitwiseXorShortAcquire(Object o, long offset, short mask) {
|
||||
short current;
|
||||
do {
|
||||
// Plain read, the value is a hint, the acquire CAS does the work
|
||||
current = getShort(o, offset);
|
||||
} while (!weakCompareAndSwapShortAcquire(o, offset,
|
||||
current, (short) (current ^ mask)));
|
||||
return current;
|
||||
}
|
||||
|
||||
|
||||
@ForceInline
|
||||
public final int getAndBitwiseOrInt(Object o, long offset, int mask) {
|
||||
int current;
|
||||
do {
|
||||
current = getIntVolatile(o, offset);
|
||||
} while (!weakCompareAndSwapIntVolatile(o, offset,
|
||||
current, current | mask));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final int getAndBitwiseOrIntRelease(Object o, long offset, int mask) {
|
||||
int current;
|
||||
do {
|
||||
current = getInt(o, offset);
|
||||
} while (!weakCompareAndSwapIntRelease(o, offset,
|
||||
current, current | mask));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final int getAndBitwiseOrIntAcquire(Object o, long offset, int mask) {
|
||||
int current;
|
||||
do {
|
||||
// Plain read, the value is a hint, the acquire CAS does the work
|
||||
current = getInt(o, offset);
|
||||
} while (!weakCompareAndSwapIntAcquire(o, offset,
|
||||
current, current | mask));
|
||||
return current;
|
||||
}
|
||||
|
||||
/**
|
||||
* Atomically replaces the current value of a field or array element within
|
||||
* the given object with the result of bitwise AND between the current value
|
||||
* and mask.
|
||||
*
|
||||
* @param o object/array to update the field/element in
|
||||
* @param offset field/element offset
|
||||
* @param mask the mask value
|
||||
* @return the previous value
|
||||
* @since 1.9
|
||||
*/
|
||||
@ForceInline
|
||||
public final int getAndBitwiseAndInt(Object o, long offset, int mask) {
|
||||
int current;
|
||||
do {
|
||||
current = getIntVolatile(o, offset);
|
||||
} while (!weakCompareAndSwapIntVolatile(o, offset,
|
||||
current, current & mask));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final int getAndBitwiseAndIntRelease(Object o, long offset, int mask) {
|
||||
int current;
|
||||
do {
|
||||
current = getInt(o, offset);
|
||||
} while (!weakCompareAndSwapIntRelease(o, offset,
|
||||
current, current & mask));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final int getAndBitwiseAndIntAcquire(Object o, long offset, int mask) {
|
||||
int current;
|
||||
do {
|
||||
// Plain read, the value is a hint, the acquire CAS does the work
|
||||
current = getInt(o, offset);
|
||||
} while (!weakCompareAndSwapIntAcquire(o, offset,
|
||||
current, current & mask));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final int getAndBitwiseXorInt(Object o, long offset, int mask) {
|
||||
int current;
|
||||
do {
|
||||
current = getIntVolatile(o, offset);
|
||||
} while (!weakCompareAndSwapIntVolatile(o, offset,
|
||||
current, current ^ mask));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final int getAndBitwiseXorIntRelease(Object o, long offset, int mask) {
|
||||
int current;
|
||||
do {
|
||||
current = getInt(o, offset);
|
||||
} while (!weakCompareAndSwapIntRelease(o, offset,
|
||||
current, current ^ mask));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final int getAndBitwiseXorIntAcquire(Object o, long offset, int mask) {
|
||||
int current;
|
||||
do {
|
||||
// Plain read, the value is a hint, the acquire CAS does the work
|
||||
current = getInt(o, offset);
|
||||
} while (!weakCompareAndSwapIntAcquire(o, offset,
|
||||
current, current ^ mask));
|
||||
return current;
|
||||
}
|
||||
|
||||
|
||||
@ForceInline
|
||||
public final long getAndBitwiseOrLong(Object o, long offset, long mask) {
|
||||
long current;
|
||||
do {
|
||||
current = getLongVolatile(o, offset);
|
||||
} while (!weakCompareAndSwapLongVolatile(o, offset,
|
||||
current, current | mask));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final long getAndBitwiseOrLongRelease(Object o, long offset, long mask) {
|
||||
long current;
|
||||
do {
|
||||
current = getLong(o, offset);
|
||||
} while (!weakCompareAndSwapLongRelease(o, offset,
|
||||
current, current | mask));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final long getAndBitwiseOrLongAcquire(Object o, long offset, long mask) {
|
||||
long current;
|
||||
do {
|
||||
// Plain read, the value is a hint, the acquire CAS does the work
|
||||
current = getLong(o, offset);
|
||||
} while (!weakCompareAndSwapLongAcquire(o, offset,
|
||||
current, current | mask));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final long getAndBitwiseAndLong(Object o, long offset, long mask) {
|
||||
long current;
|
||||
do {
|
||||
current = getLongVolatile(o, offset);
|
||||
} while (!weakCompareAndSwapLongVolatile(o, offset,
|
||||
current, current & mask));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final long getAndBitwiseAndLongRelease(Object o, long offset, long mask) {
|
||||
long current;
|
||||
do {
|
||||
current = getLong(o, offset);
|
||||
} while (!weakCompareAndSwapLongRelease(o, offset,
|
||||
current, current & mask));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final long getAndBitwiseAndLongAcquire(Object o, long offset, long mask) {
|
||||
long current;
|
||||
do {
|
||||
// Plain read, the value is a hint, the acquire CAS does the work
|
||||
current = getLong(o, offset);
|
||||
} while (!weakCompareAndSwapLongAcquire(o, offset,
|
||||
current, current & mask));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final long getAndBitwiseXorLong(Object o, long offset, long mask) {
|
||||
long current;
|
||||
do {
|
||||
current = getLongVolatile(o, offset);
|
||||
} while (!weakCompareAndSwapLongVolatile(o, offset,
|
||||
current, current ^ mask));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final long getAndBitwiseXorLongRelease(Object o, long offset, long mask) {
|
||||
long current;
|
||||
do {
|
||||
current = getLong(o, offset);
|
||||
} while (!weakCompareAndSwapLongRelease(o, offset,
|
||||
current, current ^ mask));
|
||||
return current;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final long getAndBitwiseXorLongAcquire(Object o, long offset, long mask) {
|
||||
long current;
|
||||
do {
|
||||
// Plain read, the value is a hint, the acquire CAS does the work
|
||||
current = getLong(o, offset);
|
||||
} while (!weakCompareAndSwapLongAcquire(o, offset,
|
||||
current, current ^ mask));
|
||||
return current;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Ensures that loads before the fence will not be reordered with loads and
|
||||
* stores after the fence; a "LoadLoad plus LoadStore barrier".
|
||||
|
||||
@ -132,7 +132,8 @@ abstract class VarHandleBaseTest {
|
||||
COMPARE_AND_SET,
|
||||
COMPARE_AND_EXCHANGE,
|
||||
GET_AND_SET,
|
||||
GET_AND_ADD;
|
||||
GET_AND_ADD,
|
||||
GET_AND_BITWISE;
|
||||
}
|
||||
|
||||
enum TestAccessMode {
|
||||
@ -153,8 +154,22 @@ abstract class VarHandleBaseTest {
|
||||
WEAK_COMPARE_AND_SET_ACQUIRE(TestAccessType.COMPARE_AND_SET),
|
||||
WEAK_COMPARE_AND_SET_RELEASE(TestAccessType.COMPARE_AND_SET),
|
||||
GET_AND_SET(TestAccessType.GET_AND_SET),
|
||||
GET_AND_SET_ACQUIRE(TestAccessType.GET_AND_SET),
|
||||
GET_AND_SET_RELEASE(TestAccessType.GET_AND_SET),
|
||||
GET_AND_ADD(TestAccessType.GET_AND_ADD),
|
||||
ADD_AND_GET(TestAccessType.GET_AND_ADD),;
|
||||
GET_AND_ADD_ACQUIRE(TestAccessType.GET_AND_ADD),
|
||||
GET_AND_ADD_RELEASE(TestAccessType.GET_AND_ADD),
|
||||
ADD_AND_GET(TestAccessType.GET_AND_ADD),
|
||||
GET_AND_BITWISE_OR(TestAccessType.GET_AND_BITWISE),
|
||||
GET_AND_BITWISE_OR_ACQUIRE(TestAccessType.GET_AND_BITWISE),
|
||||
GET_AND_BITWISE_OR_RELEASE(TestAccessType.GET_AND_BITWISE),
|
||||
GET_AND_BITWISE_AND(TestAccessType.GET_AND_BITWISE),
|
||||
GET_AND_BITWISE_AND_ACQUIRE(TestAccessType.GET_AND_BITWISE),
|
||||
GET_AND_BITWISE_AND_RELEASE(TestAccessType.GET_AND_BITWISE),
|
||||
GET_AND_BITWISE_XOR(TestAccessType.GET_AND_BITWISE),
|
||||
GET_AND_BITWISE_XOR_ACQUIRE(TestAccessType.GET_AND_BITWISE),
|
||||
GET_AND_BITWISE_XOR_RELEASE(TestAccessType.GET_AND_BITWISE),
|
||||
;
|
||||
|
||||
final TestAccessType at;
|
||||
final boolean isPolyMorphicInReturnType;
|
||||
|
||||
@ -108,9 +108,23 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
|
||||
}
|
||||
|
||||
|
||||
@ -265,9 +279,18 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
|
||||
boolean o = (boolean) vh.getAndAdd(recv, true);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
boolean o = (boolean) vh.getAndAddAcquire(recv, true);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
boolean o = (boolean) vh.getAndAddRelease(recv, true);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
boolean o = (boolean) vh.addAndGet(recv, true);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -320,9 +343,18 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
|
||||
boolean o = (boolean) vh.getAndAdd(true);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
boolean o = (boolean) vh.getAndAddAcquire(true);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
boolean o = (boolean) vh.getAndAddRelease(true);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
boolean o = (boolean) vh.addAndGet(true);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -457,12 +489,116 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(recv, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndSet(recv, false);
|
||||
assertEquals(o, true, "getAndSet boolean");
|
||||
boolean x = (boolean) vh.get(recv);
|
||||
assertEquals(x, false, "getAndSet boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndSetAcquire(recv, false);
|
||||
assertEquals(o, true, "getAndSetAcquire boolean");
|
||||
boolean x = (boolean) vh.get(recv);
|
||||
assertEquals(x, false, "getAndSetAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndSetRelease(recv, false);
|
||||
assertEquals(o, true, "getAndSetRelease boolean");
|
||||
boolean x = (boolean) vh.get(recv);
|
||||
assertEquals(x, false, "getAndSetRelease boolean value");
|
||||
}
|
||||
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(recv, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseOr(recv, false);
|
||||
assertEquals(o, true, "getAndBitwiseOr boolean");
|
||||
boolean x = (boolean) vh.get(recv);
|
||||
assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseOrAcquire(recv, false);
|
||||
assertEquals(o, true, "getAndBitwiseOrAcquire boolean");
|
||||
boolean x = (boolean) vh.get(recv);
|
||||
assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseOrRelease(recv, false);
|
||||
assertEquals(o, true, "getAndBitwiseOrRelease boolean");
|
||||
boolean x = (boolean) vh.get(recv);
|
||||
assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(recv, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseAnd(recv, false);
|
||||
assertEquals(o, true, "getAndBitwiseAnd boolean");
|
||||
boolean x = (boolean) vh.get(recv);
|
||||
assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseAndAcquire(recv, false);
|
||||
assertEquals(o, true, "getAndBitwiseAndAcquire boolean");
|
||||
boolean x = (boolean) vh.get(recv);
|
||||
assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseAndRelease(recv, false);
|
||||
assertEquals(o, true, "getAndBitwiseAndRelease boolean");
|
||||
boolean x = (boolean) vh.get(recv);
|
||||
assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(recv, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseXor(recv, false);
|
||||
assertEquals(o, true, "getAndBitwiseXor boolean");
|
||||
boolean x = (boolean) vh.get(recv);
|
||||
assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseXorAcquire(recv, false);
|
||||
assertEquals(o, true, "getAndBitwiseXorAcquire boolean");
|
||||
boolean x = (boolean) vh.get(recv);
|
||||
assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseXorRelease(recv, false);
|
||||
assertEquals(o, true, "getAndBitwiseXorRelease boolean");
|
||||
boolean x = (boolean) vh.get(recv);
|
||||
assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestAccessBoolean recv, VarHandle vh) {
|
||||
@ -471,9 +607,18 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
|
||||
boolean o = (boolean) vh.getAndAdd(recv, true);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
boolean o = (boolean) vh.getAndAddAcquire(recv, true);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
boolean o = (boolean) vh.getAndAddRelease(recv, true);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
boolean o = (boolean) vh.addAndGet(recv, true);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -608,12 +753,116 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(true);
|
||||
|
||||
boolean o = (boolean) vh.getAndSet(false);
|
||||
assertEquals(o, true, "getAndSet boolean");
|
||||
boolean x = (boolean) vh.get();
|
||||
assertEquals(x, false, "getAndSet boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(true);
|
||||
|
||||
boolean o = (boolean) vh.getAndSetAcquire(false);
|
||||
assertEquals(o, true, "getAndSetAcquire boolean");
|
||||
boolean x = (boolean) vh.get();
|
||||
assertEquals(x, false, "getAndSetAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(true);
|
||||
|
||||
boolean o = (boolean) vh.getAndSetRelease(false);
|
||||
assertEquals(o, true, "getAndSetRelease boolean");
|
||||
boolean x = (boolean) vh.get();
|
||||
assertEquals(x, false, "getAndSetRelease boolean value");
|
||||
}
|
||||
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseOr(false);
|
||||
assertEquals(o, true, "getAndBitwiseOr boolean");
|
||||
boolean x = (boolean) vh.get();
|
||||
assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseOrAcquire(false);
|
||||
assertEquals(o, true, "getAndBitwiseOrAcquire boolean");
|
||||
boolean x = (boolean) vh.get();
|
||||
assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseOrRelease(false);
|
||||
assertEquals(o, true, "getAndBitwiseOrRelease boolean");
|
||||
boolean x = (boolean) vh.get();
|
||||
assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseAnd(false);
|
||||
assertEquals(o, true, "getAndBitwiseAnd boolean");
|
||||
boolean x = (boolean) vh.get();
|
||||
assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseAndAcquire(false);
|
||||
assertEquals(o, true, "getAndBitwiseAndAcquire boolean");
|
||||
boolean x = (boolean) vh.get();
|
||||
assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseAndRelease(false);
|
||||
assertEquals(o, true, "getAndBitwiseAndRelease boolean");
|
||||
boolean x = (boolean) vh.get();
|
||||
assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseXor(false);
|
||||
assertEquals(o, true, "getAndBitwiseXor boolean");
|
||||
boolean x = (boolean) vh.get();
|
||||
assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseXorAcquire(false);
|
||||
assertEquals(o, true, "getAndBitwiseXorAcquire boolean");
|
||||
boolean x = (boolean) vh.get();
|
||||
assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseXorRelease(false);
|
||||
assertEquals(o, true, "getAndBitwiseXorRelease boolean");
|
||||
boolean x = (boolean) vh.get();
|
||||
assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(VarHandle vh) {
|
||||
@ -622,9 +871,18 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
|
||||
boolean o = (boolean) vh.getAndAdd(true);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
boolean o = (boolean) vh.getAndAddAcquire(true);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
boolean o = (boolean) vh.getAndAddRelease(true);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
boolean o = (boolean) vh.addAndGet(true);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -762,12 +1020,116 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(array, i, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndSet(array, i, false);
|
||||
assertEquals(o, true, "getAndSet boolean");
|
||||
boolean x = (boolean) vh.get(array, i);
|
||||
assertEquals(x, false, "getAndSet boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndSetAcquire(array, i, false);
|
||||
assertEquals(o, true, "getAndSetAcquire boolean");
|
||||
boolean x = (boolean) vh.get(array, i);
|
||||
assertEquals(x, false, "getAndSetAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndSetRelease(array, i, false);
|
||||
assertEquals(o, true, "getAndSetRelease boolean");
|
||||
boolean x = (boolean) vh.get(array, i);
|
||||
assertEquals(x, false, "getAndSetRelease boolean value");
|
||||
}
|
||||
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(array, i, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseOr(array, i, false);
|
||||
assertEquals(o, true, "getAndBitwiseOr boolean");
|
||||
boolean x = (boolean) vh.get(array, i);
|
||||
assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseOrAcquire(array, i, false);
|
||||
assertEquals(o, true, "getAndBitwiseOrAcquire boolean");
|
||||
boolean x = (boolean) vh.get(array, i);
|
||||
assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseOrRelease(array, i, false);
|
||||
assertEquals(o, true, "getAndBitwiseOrRelease boolean");
|
||||
boolean x = (boolean) vh.get(array, i);
|
||||
assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(array, i, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseAnd(array, i, false);
|
||||
assertEquals(o, true, "getAndBitwiseAnd boolean");
|
||||
boolean x = (boolean) vh.get(array, i);
|
||||
assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseAndAcquire(array, i, false);
|
||||
assertEquals(o, true, "getAndBitwiseAndAcquire boolean");
|
||||
boolean x = (boolean) vh.get(array, i);
|
||||
assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseAndRelease(array, i, false);
|
||||
assertEquals(o, true, "getAndBitwiseAndRelease boolean");
|
||||
boolean x = (boolean) vh.get(array, i);
|
||||
assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(array, i, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseXor(array, i, false);
|
||||
assertEquals(o, true, "getAndBitwiseXor boolean");
|
||||
boolean x = (boolean) vh.get(array, i);
|
||||
assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseXorAcquire(array, i, false);
|
||||
assertEquals(o, true, "getAndBitwiseXorAcquire boolean");
|
||||
boolean x = (boolean) vh.get(array, i);
|
||||
assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, true);
|
||||
|
||||
boolean o = (boolean) vh.getAndBitwiseXorRelease(array, i, false);
|
||||
assertEquals(o, true, "getAndBitwiseXorRelease boolean");
|
||||
boolean x = (boolean) vh.get(array, i);
|
||||
assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -780,9 +1142,18 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
|
||||
boolean o = (boolean) vh.getAndAdd(array, i, true);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
boolean o = (boolean) vh.getAndAddAcquire(array, i, true);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
boolean o = (boolean) vh.getAndAddRelease(array, i, true);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
boolean o = (boolean) vh.addAndGet(array, i, true);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable {
|
||||
@ -859,6 +1230,50 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
|
||||
boolean o = (boolean) vh.getAndSet(array, ci, true);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
boolean o = (boolean) vh.getAndSetAcquire(array, ci, true);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
boolean o = (boolean) vh.getAndSetRelease(array, ci, true);
|
||||
});
|
||||
|
||||
|
||||
checkIOOBE(() -> {
|
||||
boolean o = (boolean) vh.getAndBitwiseOr(array, ci, true);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
boolean o = (boolean) vh.getAndBitwiseOrAcquire(array, ci, true);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
boolean o = (boolean) vh.getAndBitwiseOrRelease(array, ci, true);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
boolean o = (boolean) vh.getAndBitwiseAnd(array, ci, true);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
boolean o = (boolean) vh.getAndBitwiseAndAcquire(array, ci, true);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
boolean o = (boolean) vh.getAndBitwiseAndRelease(array, ci, true);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
boolean o = (boolean) vh.getAndBitwiseXor(array, ci, true);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
boolean o = (boolean) vh.getAndBitwiseXorAcquire(array, ci, true);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
boolean o = (boolean) vh.getAndBitwiseXorRelease(array, ci, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,9 +108,23 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
|
||||
}
|
||||
|
||||
|
||||
@ -261,6 +275,7 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -309,6 +324,7 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -443,25 +459,148 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndSet(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndSet byte");
|
||||
byte x = (byte) vh.get(recv);
|
||||
assertEquals(x, (byte)0x23, "getAndSet byte value");
|
||||
}
|
||||
|
||||
vh.set(recv, (byte)0x01);
|
||||
{
|
||||
vh.set(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndSetAcquire(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndSetAcquire byte");
|
||||
byte x = (byte) vh.get(recv);
|
||||
assertEquals(x, (byte)0x23, "getAndSetAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndSetRelease(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndSetRelease byte");
|
||||
byte x = (byte) vh.get(recv);
|
||||
assertEquals(x, (byte)0x23, "getAndSetRelease byte value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndAdd(recv, (byte)0x45);
|
||||
assertEquals(o, (byte)0x01, "getAndAdd byte");
|
||||
byte c = (byte) vh.addAndGet(recv, (byte)0x45);
|
||||
assertEquals(c, (byte)((byte)0x01 + (byte)0x45 + (byte)0x45), "getAndAdd byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndAddAcquire(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndAddAcquire byte");
|
||||
byte x = (byte) vh.get(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndAddRelease(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndAddReleasebyte");
|
||||
byte x = (byte) vh.get(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseOr(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseOr byte");
|
||||
byte x = (byte) vh.get(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseOrAcquire(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte");
|
||||
byte x = (byte) vh.get(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseOrRelease(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte");
|
||||
byte x = (byte) vh.get(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseAnd(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte");
|
||||
byte x = (byte) vh.get(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseAndAcquire(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte");
|
||||
byte x = (byte) vh.get(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseAndRelease(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte");
|
||||
byte x = (byte) vh.get(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseXor(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseXor byte");
|
||||
byte x = (byte) vh.get(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseXorAcquire(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte");
|
||||
byte x = (byte) vh.get(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseXorRelease(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte");
|
||||
byte x = (byte) vh.get(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestAccessByte recv, VarHandle vh) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -596,25 +735,148 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set((byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndSet((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndSet byte");
|
||||
byte x = (byte) vh.get();
|
||||
assertEquals(x, (byte)0x23, "getAndSet byte value");
|
||||
}
|
||||
|
||||
vh.set((byte)0x01);
|
||||
{
|
||||
vh.set((byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndSetAcquire((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndSetAcquire byte");
|
||||
byte x = (byte) vh.get();
|
||||
assertEquals(x, (byte)0x23, "getAndSetAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set((byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndSetRelease((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndSetRelease byte");
|
||||
byte x = (byte) vh.get();
|
||||
assertEquals(x, (byte)0x23, "getAndSetRelease byte value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set((byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndAdd( (byte)0x45);
|
||||
assertEquals(o, (byte)0x01, "getAndAdd byte");
|
||||
byte c = (byte) vh.addAndGet((byte)0x45);
|
||||
assertEquals(c, (byte)((byte)0x01 + (byte)0x45 + (byte)0x45), "getAndAdd byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set((byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndAddAcquire((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndAddAcquire byte");
|
||||
byte x = (byte) vh.get();
|
||||
assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set((byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndAddRelease((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndAddReleasebyte");
|
||||
byte x = (byte) vh.get();
|
||||
assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set((byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseOr((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseOr byte");
|
||||
byte x = (byte) vh.get();
|
||||
assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set((byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseOrAcquire((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte");
|
||||
byte x = (byte) vh.get();
|
||||
assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set((byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseOrRelease((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte");
|
||||
byte x = (byte) vh.get();
|
||||
assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set((byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseAnd((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte");
|
||||
byte x = (byte) vh.get();
|
||||
assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set((byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseAndAcquire((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte");
|
||||
byte x = (byte) vh.get();
|
||||
assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set((byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseAndRelease((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte");
|
||||
byte x = (byte) vh.get();
|
||||
assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set((byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseXor((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseXor byte");
|
||||
byte x = (byte) vh.get();
|
||||
assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set((byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseXorAcquire((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte");
|
||||
byte x = (byte) vh.get();
|
||||
assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set((byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseXorRelease((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte");
|
||||
byte x = (byte) vh.get();
|
||||
assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(VarHandle vh) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -752,21 +1014,143 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndSet(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndSet byte");
|
||||
byte x = (byte) vh.get(array, i);
|
||||
assertEquals(x, (byte)0x23, "getAndSet byte value");
|
||||
}
|
||||
|
||||
vh.set(array, i, (byte)0x01);
|
||||
{
|
||||
vh.set(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndSetAcquire(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndSetAcquire byte");
|
||||
byte x = (byte) vh.get(array, i);
|
||||
assertEquals(x, (byte)0x23, "getAndSetAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndSetRelease(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndSetRelease byte");
|
||||
byte x = (byte) vh.get(array, i);
|
||||
assertEquals(x, (byte)0x23, "getAndSetRelease byte value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndAdd(array, i, (byte)0x45);
|
||||
assertEquals(o, (byte)0x01, "getAndAdd byte");
|
||||
byte c = (byte) vh.addAndGet(array, i, (byte)0x45);
|
||||
assertEquals(c, (byte)((byte)0x01 + (byte)0x45 + (byte)0x45), "getAndAdd byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndAddAcquire(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndAddAcquire byte");
|
||||
byte x = (byte) vh.get(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndAddRelease(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndAddReleasebyte");
|
||||
byte x = (byte) vh.get(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseOr(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseOr byte");
|
||||
byte x = (byte) vh.get(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseOrAcquire(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte");
|
||||
byte x = (byte) vh.get(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseOrRelease(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte");
|
||||
byte x = (byte) vh.get(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseAnd(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte");
|
||||
byte x = (byte) vh.get(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseAndAcquire(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte");
|
||||
byte x = (byte) vh.get(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseAndRelease(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte");
|
||||
byte x = (byte) vh.get(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseXor(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseXor byte");
|
||||
byte x = (byte) vh.get(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseXorAcquire(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte");
|
||||
byte x = (byte) vh.get(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) vh.getAndBitwiseXorRelease(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte");
|
||||
byte x = (byte) vh.get(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -775,6 +1159,7 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
|
||||
|
||||
int i = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable {
|
||||
@ -852,11 +1237,63 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
byte o = (byte) vh.getAndAdd(array, ci, (byte)0x45);
|
||||
byte o = (byte) vh.getAndSetAcquire(array, ci, (byte)0x01);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
byte o = (byte) vh.addAndGet(array, ci, (byte)0x45);
|
||||
byte o = (byte) vh.getAndSetRelease(array, ci, (byte)0x01);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
byte o = (byte) vh.getAndAdd(array, ci, (byte)0x01);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
byte o = (byte) vh.getAndAddAcquire(array, ci, (byte)0x01);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
byte o = (byte) vh.getAndAddRelease(array, ci, (byte)0x01);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
byte o = (byte) vh.addAndGet(array, ci, (byte)0x01);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
byte o = (byte) vh.getAndBitwiseOr(array, ci, (byte)0x01);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
byte o = (byte) vh.getAndBitwiseOrAcquire(array, ci, (byte)0x01);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
byte o = (byte) vh.getAndBitwiseOrRelease(array, ci, (byte)0x01);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
byte o = (byte) vh.getAndBitwiseAnd(array, ci, (byte)0x01);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
byte o = (byte) vh.getAndBitwiseAndAcquire(array, ci, (byte)0x01);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
byte o = (byte) vh.getAndBitwiseAndRelease(array, ci, (byte)0x01);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
byte o = (byte) vh.getAndBitwiseXor(array, ci, (byte)0x01);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
byte o = (byte) vh.getAndBitwiseXorAcquire(array, ci, (byte)0x01);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
byte o = (byte) vh.getAndBitwiseXorRelease(array, ci, (byte)0x01);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,9 +108,23 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
|
||||
}
|
||||
|
||||
|
||||
@ -261,6 +275,7 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -309,6 +324,7 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -443,25 +459,148 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(recv, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndSet(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndSet char");
|
||||
char x = (char) vh.get(recv);
|
||||
assertEquals(x, '\u4567', "getAndSet char value");
|
||||
}
|
||||
|
||||
vh.set(recv, '\u0123');
|
||||
{
|
||||
vh.set(recv, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndSetAcquire(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndSetAcquire char");
|
||||
char x = (char) vh.get(recv);
|
||||
assertEquals(x, '\u4567', "getAndSetAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndSetRelease(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndSetRelease char");
|
||||
char x = (char) vh.get(recv);
|
||||
assertEquals(x, '\u4567', "getAndSetRelease char value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(recv, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndAdd(recv, '\u89AB');
|
||||
assertEquals(o, '\u0123', "getAndAdd char");
|
||||
char c = (char) vh.addAndGet(recv, '\u89AB');
|
||||
assertEquals(c, (char)('\u0123' + '\u89AB' + '\u89AB'), "getAndAdd char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndAddAcquire(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndAddAcquire char");
|
||||
char x = (char) vh.get(recv);
|
||||
assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndAddRelease(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndAddReleasechar");
|
||||
char x = (char) vh.get(recv);
|
||||
assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(recv, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseOr(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseOr char");
|
||||
char x = (char) vh.get(recv);
|
||||
assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseOrAcquire(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char");
|
||||
char x = (char) vh.get(recv);
|
||||
assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseOrRelease(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseOrRelease char");
|
||||
char x = (char) vh.get(recv);
|
||||
assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(recv, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseAnd(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseAnd char");
|
||||
char x = (char) vh.get(recv);
|
||||
assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseAndAcquire(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char");
|
||||
char x = (char) vh.get(recv);
|
||||
assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseAndRelease(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseAndRelease char");
|
||||
char x = (char) vh.get(recv);
|
||||
assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(recv, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseXor(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseXor char");
|
||||
char x = (char) vh.get(recv);
|
||||
assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseXorAcquire(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char");
|
||||
char x = (char) vh.get(recv);
|
||||
assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseXorRelease(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseXorRelease char");
|
||||
char x = (char) vh.get(recv);
|
||||
assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestAccessChar recv, VarHandle vh) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -596,25 +735,148 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set('\u0123');
|
||||
|
||||
char o = (char) vh.getAndSet('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndSet char");
|
||||
char x = (char) vh.get();
|
||||
assertEquals(x, '\u4567', "getAndSet char value");
|
||||
}
|
||||
|
||||
vh.set('\u0123');
|
||||
{
|
||||
vh.set('\u0123');
|
||||
|
||||
char o = (char) vh.getAndSetAcquire('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndSetAcquire char");
|
||||
char x = (char) vh.get();
|
||||
assertEquals(x, '\u4567', "getAndSetAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set('\u0123');
|
||||
|
||||
char o = (char) vh.getAndSetRelease('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndSetRelease char");
|
||||
char x = (char) vh.get();
|
||||
assertEquals(x, '\u4567', "getAndSetRelease char value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set('\u0123');
|
||||
|
||||
char o = (char) vh.getAndAdd( '\u89AB');
|
||||
assertEquals(o, '\u0123', "getAndAdd char");
|
||||
char c = (char) vh.addAndGet('\u89AB');
|
||||
assertEquals(c, (char)('\u0123' + '\u89AB' + '\u89AB'), "getAndAdd char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set('\u0123');
|
||||
|
||||
char o = (char) vh.getAndAddAcquire('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndAddAcquire char");
|
||||
char x = (char) vh.get();
|
||||
assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set('\u0123');
|
||||
|
||||
char o = (char) vh.getAndAddRelease('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndAddReleasechar");
|
||||
char x = (char) vh.get();
|
||||
assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set('\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseOr('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseOr char");
|
||||
char x = (char) vh.get();
|
||||
assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set('\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseOrAcquire('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char");
|
||||
char x = (char) vh.get();
|
||||
assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set('\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseOrRelease('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseOrRelease char");
|
||||
char x = (char) vh.get();
|
||||
assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set('\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseAnd('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseAnd char");
|
||||
char x = (char) vh.get();
|
||||
assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set('\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseAndAcquire('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char");
|
||||
char x = (char) vh.get();
|
||||
assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set('\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseAndRelease('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseAndRelease char");
|
||||
char x = (char) vh.get();
|
||||
assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set('\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseXor('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseXor char");
|
||||
char x = (char) vh.get();
|
||||
assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set('\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseXorAcquire('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char");
|
||||
char x = (char) vh.get();
|
||||
assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set('\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseXorRelease('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseXorRelease char");
|
||||
char x = (char) vh.get();
|
||||
assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(VarHandle vh) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -752,21 +1014,143 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(array, i, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndSet(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndSet char");
|
||||
char x = (char) vh.get(array, i);
|
||||
assertEquals(x, '\u4567', "getAndSet char value");
|
||||
}
|
||||
|
||||
vh.set(array, i, '\u0123');
|
||||
{
|
||||
vh.set(array, i, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndSetAcquire(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndSetAcquire char");
|
||||
char x = (char) vh.get(array, i);
|
||||
assertEquals(x, '\u4567', "getAndSetAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndSetRelease(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndSetRelease char");
|
||||
char x = (char) vh.get(array, i);
|
||||
assertEquals(x, '\u4567', "getAndSetRelease char value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(array, i, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndAdd(array, i, '\u89AB');
|
||||
assertEquals(o, '\u0123', "getAndAdd char");
|
||||
char c = (char) vh.addAndGet(array, i, '\u89AB');
|
||||
assertEquals(c, (char)('\u0123' + '\u89AB' + '\u89AB'), "getAndAdd char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndAddAcquire(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndAddAcquire char");
|
||||
char x = (char) vh.get(array, i);
|
||||
assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndAddRelease(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndAddReleasechar");
|
||||
char x = (char) vh.get(array, i);
|
||||
assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(array, i, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseOr(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseOr char");
|
||||
char x = (char) vh.get(array, i);
|
||||
assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseOrAcquire(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char");
|
||||
char x = (char) vh.get(array, i);
|
||||
assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseOrRelease(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseOrRelease char");
|
||||
char x = (char) vh.get(array, i);
|
||||
assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(array, i, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseAnd(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseAnd char");
|
||||
char x = (char) vh.get(array, i);
|
||||
assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseAndAcquire(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char");
|
||||
char x = (char) vh.get(array, i);
|
||||
assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseAndRelease(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseAndRelease char");
|
||||
char x = (char) vh.get(array, i);
|
||||
assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(array, i, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseXor(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseXor char");
|
||||
char x = (char) vh.get(array, i);
|
||||
assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseXorAcquire(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char");
|
||||
char x = (char) vh.get(array, i);
|
||||
assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, '\u0123');
|
||||
|
||||
char o = (char) vh.getAndBitwiseXorRelease(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseXorRelease char");
|
||||
char x = (char) vh.get(array, i);
|
||||
assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -775,6 +1159,7 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
|
||||
|
||||
int i = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable {
|
||||
@ -852,11 +1237,63 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
char o = (char) vh.getAndAdd(array, ci, '\u89AB');
|
||||
char o = (char) vh.getAndSetAcquire(array, ci, '\u0123');
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
char o = (char) vh.addAndGet(array, ci, '\u89AB');
|
||||
char o = (char) vh.getAndSetRelease(array, ci, '\u0123');
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
char o = (char) vh.getAndAdd(array, ci, '\u0123');
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
char o = (char) vh.getAndAddAcquire(array, ci, '\u0123');
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
char o = (char) vh.getAndAddRelease(array, ci, '\u0123');
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
char o = (char) vh.addAndGet(array, ci, '\u0123');
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
char o = (char) vh.getAndBitwiseOr(array, ci, '\u0123');
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
char o = (char) vh.getAndBitwiseOrAcquire(array, ci, '\u0123');
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
char o = (char) vh.getAndBitwiseOrRelease(array, ci, '\u0123');
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
char o = (char) vh.getAndBitwiseAnd(array, ci, '\u0123');
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
char o = (char) vh.getAndBitwiseAndAcquire(array, ci, '\u0123');
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
char o = (char) vh.getAndBitwiseAndRelease(array, ci, '\u0123');
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
char o = (char) vh.getAndBitwiseXor(array, ci, '\u0123');
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
char o = (char) vh.getAndBitwiseXorAcquire(array, ci, '\u0123');
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
char o = (char) vh.getAndBitwiseXorRelease(array, ci, '\u0123');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,9 +108,23 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
|
||||
}
|
||||
|
||||
|
||||
@ -261,6 +275,42 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOr(recv, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOrAcquire(recv, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOrRelease(recv, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAnd(recv, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAndAcquire(recv, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAndRelease(recv, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXor(recv, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXorAcquire(recv, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXorRelease(recv, 1.0d);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -309,6 +359,42 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOr(1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOrAcquire(1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOrRelease(1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAnd(1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAndAcquire(1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAndRelease(1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXor(1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXorAcquire(1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXorRelease(1.0d);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -443,25 +529,100 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(recv, 1.0d);
|
||||
|
||||
double o = (double) vh.getAndSet(recv, 2.0d);
|
||||
assertEquals(o, 1.0d, "getAndSet double");
|
||||
double x = (double) vh.get(recv);
|
||||
assertEquals(x, 2.0d, "getAndSet double value");
|
||||
}
|
||||
|
||||
vh.set(recv, 1.0d);
|
||||
{
|
||||
vh.set(recv, 1.0d);
|
||||
|
||||
double o = (double) vh.getAndSetAcquire(recv, 2.0d);
|
||||
assertEquals(o, 1.0d, "getAndSetAcquire double");
|
||||
double x = (double) vh.get(recv);
|
||||
assertEquals(x, 2.0d, "getAndSetAcquire double value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 1.0d);
|
||||
|
||||
double o = (double) vh.getAndSetRelease(recv, 2.0d);
|
||||
assertEquals(o, 1.0d, "getAndSetRelease double");
|
||||
double x = (double) vh.get(recv);
|
||||
assertEquals(x, 2.0d, "getAndSetRelease double value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(recv, 1.0d);
|
||||
|
||||
double o = (double) vh.getAndAdd(recv, 3.0d);
|
||||
assertEquals(o, 1.0d, "getAndAdd double");
|
||||
double c = (double) vh.addAndGet(recv, 3.0d);
|
||||
assertEquals(c, (double)(1.0d + 3.0d + 3.0d), "getAndAdd double value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 1.0d);
|
||||
|
||||
double o = (double) vh.getAndAddAcquire(recv, 2.0d);
|
||||
assertEquals(o, 1.0d, "getAndAddAcquire double");
|
||||
double x = (double) vh.get(recv);
|
||||
assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 1.0d);
|
||||
|
||||
double o = (double) vh.getAndAddRelease(recv, 2.0d);
|
||||
assertEquals(o, 1.0d, "getAndAddReleasedouble");
|
||||
double x = (double) vh.get(recv);
|
||||
assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestAccessDouble recv, VarHandle vh) {
|
||||
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOr(recv, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOrAcquire(recv, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOrRelease(recv, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAnd(recv, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAndAcquire(recv, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAndRelease(recv, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXor(recv, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXorAcquire(recv, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXorRelease(recv, 1.0d);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -596,25 +757,100 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(1.0d);
|
||||
|
||||
double o = (double) vh.getAndSet(2.0d);
|
||||
assertEquals(o, 1.0d, "getAndSet double");
|
||||
double x = (double) vh.get();
|
||||
assertEquals(x, 2.0d, "getAndSet double value");
|
||||
}
|
||||
|
||||
vh.set(1.0d);
|
||||
{
|
||||
vh.set(1.0d);
|
||||
|
||||
double o = (double) vh.getAndSetAcquire(2.0d);
|
||||
assertEquals(o, 1.0d, "getAndSetAcquire double");
|
||||
double x = (double) vh.get();
|
||||
assertEquals(x, 2.0d, "getAndSetAcquire double value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(1.0d);
|
||||
|
||||
double o = (double) vh.getAndSetRelease(2.0d);
|
||||
assertEquals(o, 1.0d, "getAndSetRelease double");
|
||||
double x = (double) vh.get();
|
||||
assertEquals(x, 2.0d, "getAndSetRelease double value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(1.0d);
|
||||
|
||||
double o = (double) vh.getAndAdd( 3.0d);
|
||||
assertEquals(o, 1.0d, "getAndAdd double");
|
||||
double c = (double) vh.addAndGet(3.0d);
|
||||
assertEquals(c, (double)(1.0d + 3.0d + 3.0d), "getAndAdd double value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(1.0d);
|
||||
|
||||
double o = (double) vh.getAndAddAcquire(2.0d);
|
||||
assertEquals(o, 1.0d, "getAndAddAcquire double");
|
||||
double x = (double) vh.get();
|
||||
assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(1.0d);
|
||||
|
||||
double o = (double) vh.getAndAddRelease(2.0d);
|
||||
assertEquals(o, 1.0d, "getAndAddReleasedouble");
|
||||
double x = (double) vh.get();
|
||||
assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(VarHandle vh) {
|
||||
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOr(1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOrAcquire(1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOrRelease(1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAnd(1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAndAcquire(1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAndRelease(1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXor(1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXorAcquire(1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXorRelease(1.0d);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -752,21 +988,60 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(array, i, 1.0d);
|
||||
|
||||
double o = (double) vh.getAndSet(array, i, 2.0d);
|
||||
assertEquals(o, 1.0d, "getAndSet double");
|
||||
double x = (double) vh.get(array, i);
|
||||
assertEquals(x, 2.0d, "getAndSet double value");
|
||||
}
|
||||
|
||||
vh.set(array, i, 1.0d);
|
||||
{
|
||||
vh.set(array, i, 1.0d);
|
||||
|
||||
double o = (double) vh.getAndSetAcquire(array, i, 2.0d);
|
||||
assertEquals(o, 1.0d, "getAndSetAcquire double");
|
||||
double x = (double) vh.get(array, i);
|
||||
assertEquals(x, 2.0d, "getAndSetAcquire double value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 1.0d);
|
||||
|
||||
double o = (double) vh.getAndSetRelease(array, i, 2.0d);
|
||||
assertEquals(o, 1.0d, "getAndSetRelease double");
|
||||
double x = (double) vh.get(array, i);
|
||||
assertEquals(x, 2.0d, "getAndSetRelease double value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(array, i, 1.0d);
|
||||
|
||||
double o = (double) vh.getAndAdd(array, i, 3.0d);
|
||||
assertEquals(o, 1.0d, "getAndAdd double");
|
||||
double c = (double) vh.addAndGet(array, i, 3.0d);
|
||||
assertEquals(c, (double)(1.0d + 3.0d + 3.0d), "getAndAdd double value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 1.0d);
|
||||
|
||||
double o = (double) vh.getAndAddAcquire(array, i, 2.0d);
|
||||
assertEquals(o, 1.0d, "getAndAddAcquire double");
|
||||
double x = (double) vh.get(array, i);
|
||||
assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 1.0d);
|
||||
|
||||
double o = (double) vh.getAndAddRelease(array, i, 2.0d);
|
||||
assertEquals(o, 1.0d, "getAndAddReleasedouble");
|
||||
double x = (double) vh.get(array, i);
|
||||
assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -775,6 +1050,42 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
|
||||
|
||||
int i = 0;
|
||||
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOr(array, i, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOrAcquire(array, i, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOrRelease(array, i, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAnd(array, i, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAndAcquire(array, i, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAndRelease(array, i, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXor(array, i, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXorAcquire(array, i, 1.0d);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXorRelease(array, i, 1.0d);
|
||||
});
|
||||
}
|
||||
|
||||
static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable {
|
||||
@ -852,12 +1163,29 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
double o = (double) vh.getAndAdd(array, ci, 3.0d);
|
||||
double o = (double) vh.getAndSetAcquire(array, ci, 1.0d);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
double o = (double) vh.addAndGet(array, ci, 3.0d);
|
||||
double o = (double) vh.getAndSetRelease(array, ci, 1.0d);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
double o = (double) vh.getAndAdd(array, ci, 1.0d);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
double o = (double) vh.getAndAddAcquire(array, ci, 1.0d);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
double o = (double) vh.getAndAddRelease(array, ci, 1.0d);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
double o = (double) vh.addAndGet(array, ci, 1.0d);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,9 +108,23 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
|
||||
}
|
||||
|
||||
|
||||
@ -261,6 +275,42 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOr(recv, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOrAcquire(recv, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOrRelease(recv, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAnd(recv, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAndAcquire(recv, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAndRelease(recv, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXor(recv, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXorAcquire(recv, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXorRelease(recv, 1.0f);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -309,6 +359,42 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOr(1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOrAcquire(1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOrRelease(1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAnd(1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAndAcquire(1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAndRelease(1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXor(1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXorAcquire(1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXorRelease(1.0f);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -443,25 +529,100 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(recv, 1.0f);
|
||||
|
||||
float o = (float) vh.getAndSet(recv, 2.0f);
|
||||
assertEquals(o, 1.0f, "getAndSet float");
|
||||
float x = (float) vh.get(recv);
|
||||
assertEquals(x, 2.0f, "getAndSet float value");
|
||||
}
|
||||
|
||||
vh.set(recv, 1.0f);
|
||||
{
|
||||
vh.set(recv, 1.0f);
|
||||
|
||||
float o = (float) vh.getAndSetAcquire(recv, 2.0f);
|
||||
assertEquals(o, 1.0f, "getAndSetAcquire float");
|
||||
float x = (float) vh.get(recv);
|
||||
assertEquals(x, 2.0f, "getAndSetAcquire float value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 1.0f);
|
||||
|
||||
float o = (float) vh.getAndSetRelease(recv, 2.0f);
|
||||
assertEquals(o, 1.0f, "getAndSetRelease float");
|
||||
float x = (float) vh.get(recv);
|
||||
assertEquals(x, 2.0f, "getAndSetRelease float value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(recv, 1.0f);
|
||||
|
||||
float o = (float) vh.getAndAdd(recv, 3.0f);
|
||||
assertEquals(o, 1.0f, "getAndAdd float");
|
||||
float c = (float) vh.addAndGet(recv, 3.0f);
|
||||
assertEquals(c, (float)(1.0f + 3.0f + 3.0f), "getAndAdd float value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 1.0f);
|
||||
|
||||
float o = (float) vh.getAndAddAcquire(recv, 2.0f);
|
||||
assertEquals(o, 1.0f, "getAndAddAcquire float");
|
||||
float x = (float) vh.get(recv);
|
||||
assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 1.0f);
|
||||
|
||||
float o = (float) vh.getAndAddRelease(recv, 2.0f);
|
||||
assertEquals(o, 1.0f, "getAndAddReleasefloat");
|
||||
float x = (float) vh.get(recv);
|
||||
assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestAccessFloat recv, VarHandle vh) {
|
||||
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOr(recv, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOrAcquire(recv, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOrRelease(recv, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAnd(recv, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAndAcquire(recv, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAndRelease(recv, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXor(recv, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXorAcquire(recv, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXorRelease(recv, 1.0f);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -596,25 +757,100 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(1.0f);
|
||||
|
||||
float o = (float) vh.getAndSet(2.0f);
|
||||
assertEquals(o, 1.0f, "getAndSet float");
|
||||
float x = (float) vh.get();
|
||||
assertEquals(x, 2.0f, "getAndSet float value");
|
||||
}
|
||||
|
||||
vh.set(1.0f);
|
||||
{
|
||||
vh.set(1.0f);
|
||||
|
||||
float o = (float) vh.getAndSetAcquire(2.0f);
|
||||
assertEquals(o, 1.0f, "getAndSetAcquire float");
|
||||
float x = (float) vh.get();
|
||||
assertEquals(x, 2.0f, "getAndSetAcquire float value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(1.0f);
|
||||
|
||||
float o = (float) vh.getAndSetRelease(2.0f);
|
||||
assertEquals(o, 1.0f, "getAndSetRelease float");
|
||||
float x = (float) vh.get();
|
||||
assertEquals(x, 2.0f, "getAndSetRelease float value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(1.0f);
|
||||
|
||||
float o = (float) vh.getAndAdd( 3.0f);
|
||||
assertEquals(o, 1.0f, "getAndAdd float");
|
||||
float c = (float) vh.addAndGet(3.0f);
|
||||
assertEquals(c, (float)(1.0f + 3.0f + 3.0f), "getAndAdd float value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(1.0f);
|
||||
|
||||
float o = (float) vh.getAndAddAcquire(2.0f);
|
||||
assertEquals(o, 1.0f, "getAndAddAcquire float");
|
||||
float x = (float) vh.get();
|
||||
assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(1.0f);
|
||||
|
||||
float o = (float) vh.getAndAddRelease(2.0f);
|
||||
assertEquals(o, 1.0f, "getAndAddReleasefloat");
|
||||
float x = (float) vh.get();
|
||||
assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(VarHandle vh) {
|
||||
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOr(1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOrAcquire(1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOrRelease(1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAnd(1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAndAcquire(1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAndRelease(1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXor(1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXorAcquire(1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXorRelease(1.0f);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -752,21 +988,60 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(array, i, 1.0f);
|
||||
|
||||
float o = (float) vh.getAndSet(array, i, 2.0f);
|
||||
assertEquals(o, 1.0f, "getAndSet float");
|
||||
float x = (float) vh.get(array, i);
|
||||
assertEquals(x, 2.0f, "getAndSet float value");
|
||||
}
|
||||
|
||||
vh.set(array, i, 1.0f);
|
||||
{
|
||||
vh.set(array, i, 1.0f);
|
||||
|
||||
float o = (float) vh.getAndSetAcquire(array, i, 2.0f);
|
||||
assertEquals(o, 1.0f, "getAndSetAcquire float");
|
||||
float x = (float) vh.get(array, i);
|
||||
assertEquals(x, 2.0f, "getAndSetAcquire float value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 1.0f);
|
||||
|
||||
float o = (float) vh.getAndSetRelease(array, i, 2.0f);
|
||||
assertEquals(o, 1.0f, "getAndSetRelease float");
|
||||
float x = (float) vh.get(array, i);
|
||||
assertEquals(x, 2.0f, "getAndSetRelease float value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(array, i, 1.0f);
|
||||
|
||||
float o = (float) vh.getAndAdd(array, i, 3.0f);
|
||||
assertEquals(o, 1.0f, "getAndAdd float");
|
||||
float c = (float) vh.addAndGet(array, i, 3.0f);
|
||||
assertEquals(c, (float)(1.0f + 3.0f + 3.0f), "getAndAdd float value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 1.0f);
|
||||
|
||||
float o = (float) vh.getAndAddAcquire(array, i, 2.0f);
|
||||
assertEquals(o, 1.0f, "getAndAddAcquire float");
|
||||
float x = (float) vh.get(array, i);
|
||||
assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 1.0f);
|
||||
|
||||
float o = (float) vh.getAndAddRelease(array, i, 2.0f);
|
||||
assertEquals(o, 1.0f, "getAndAddReleasefloat");
|
||||
float x = (float) vh.get(array, i);
|
||||
assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -775,6 +1050,42 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
|
||||
|
||||
int i = 0;
|
||||
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOr(array, i, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOrAcquire(array, i, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOrRelease(array, i, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAnd(array, i, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAndAcquire(array, i, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAndRelease(array, i, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXor(array, i, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXorAcquire(array, i, 1.0f);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXorRelease(array, i, 1.0f);
|
||||
});
|
||||
}
|
||||
|
||||
static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable {
|
||||
@ -852,12 +1163,29 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
float o = (float) vh.getAndAdd(array, ci, 3.0f);
|
||||
float o = (float) vh.getAndSetAcquire(array, ci, 1.0f);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
float o = (float) vh.addAndGet(array, ci, 3.0f);
|
||||
float o = (float) vh.getAndSetRelease(array, ci, 1.0f);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
float o = (float) vh.getAndAdd(array, ci, 1.0f);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
float o = (float) vh.getAndAddAcquire(array, ci, 1.0f);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
float o = (float) vh.getAndAddRelease(array, ci, 1.0f);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
float o = (float) vh.addAndGet(array, ci, 1.0f);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,9 +108,23 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
|
||||
}
|
||||
|
||||
|
||||
@ -261,6 +275,7 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -309,6 +324,7 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -443,25 +459,148 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(recv, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndSet(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndSet int");
|
||||
int x = (int) vh.get(recv);
|
||||
assertEquals(x, 0x89ABCDEF, "getAndSet int value");
|
||||
}
|
||||
|
||||
vh.set(recv, 0x01234567);
|
||||
{
|
||||
vh.set(recv, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndSetAcquire(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndSetAcquire int");
|
||||
int x = (int) vh.get(recv);
|
||||
assertEquals(x, 0x89ABCDEF, "getAndSetAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndSetRelease(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndSetRelease int");
|
||||
int x = (int) vh.get(recv);
|
||||
assertEquals(x, 0x89ABCDEF, "getAndSetRelease int value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(recv, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndAdd(recv, 0xCAFEBABE);
|
||||
assertEquals(o, 0x01234567, "getAndAdd int");
|
||||
int c = (int) vh.addAndGet(recv, 0xCAFEBABE);
|
||||
assertEquals(c, (int)(0x01234567 + 0xCAFEBABE + 0xCAFEBABE), "getAndAdd int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndAddAcquire(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndAddAcquire int");
|
||||
int x = (int) vh.get(recv);
|
||||
assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndAddRelease(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndAddReleaseint");
|
||||
int x = (int) vh.get(recv);
|
||||
assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(recv, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseOr(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseOr int");
|
||||
int x = (int) vh.get(recv);
|
||||
assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseOrAcquire(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int");
|
||||
int x = (int) vh.get(recv);
|
||||
assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseOrRelease(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int");
|
||||
int x = (int) vh.get(recv);
|
||||
assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(recv, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseAnd(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseAnd int");
|
||||
int x = (int) vh.get(recv);
|
||||
assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseAndAcquire(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int");
|
||||
int x = (int) vh.get(recv);
|
||||
assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseAndRelease(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int");
|
||||
int x = (int) vh.get(recv);
|
||||
assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(recv, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseXor(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseXor int");
|
||||
int x = (int) vh.get(recv);
|
||||
assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseXorAcquire(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int");
|
||||
int x = (int) vh.get(recv);
|
||||
assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseXorRelease(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int");
|
||||
int x = (int) vh.get(recv);
|
||||
assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestAccessInt recv, VarHandle vh) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -596,25 +735,148 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(0x01234567);
|
||||
|
||||
int o = (int) vh.getAndSet(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndSet int");
|
||||
int x = (int) vh.get();
|
||||
assertEquals(x, 0x89ABCDEF, "getAndSet int value");
|
||||
}
|
||||
|
||||
vh.set(0x01234567);
|
||||
{
|
||||
vh.set(0x01234567);
|
||||
|
||||
int o = (int) vh.getAndSetAcquire(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndSetAcquire int");
|
||||
int x = (int) vh.get();
|
||||
assertEquals(x, 0x89ABCDEF, "getAndSetAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(0x01234567);
|
||||
|
||||
int o = (int) vh.getAndSetRelease(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndSetRelease int");
|
||||
int x = (int) vh.get();
|
||||
assertEquals(x, 0x89ABCDEF, "getAndSetRelease int value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(0x01234567);
|
||||
|
||||
int o = (int) vh.getAndAdd( 0xCAFEBABE);
|
||||
assertEquals(o, 0x01234567, "getAndAdd int");
|
||||
int c = (int) vh.addAndGet(0xCAFEBABE);
|
||||
assertEquals(c, (int)(0x01234567 + 0xCAFEBABE + 0xCAFEBABE), "getAndAdd int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(0x01234567);
|
||||
|
||||
int o = (int) vh.getAndAddAcquire(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndAddAcquire int");
|
||||
int x = (int) vh.get();
|
||||
assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(0x01234567);
|
||||
|
||||
int o = (int) vh.getAndAddRelease(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndAddReleaseint");
|
||||
int x = (int) vh.get();
|
||||
assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseOr(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseOr int");
|
||||
int x = (int) vh.get();
|
||||
assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseOrAcquire(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int");
|
||||
int x = (int) vh.get();
|
||||
assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseOrRelease(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int");
|
||||
int x = (int) vh.get();
|
||||
assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseAnd(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseAnd int");
|
||||
int x = (int) vh.get();
|
||||
assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseAndAcquire(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int");
|
||||
int x = (int) vh.get();
|
||||
assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseAndRelease(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int");
|
||||
int x = (int) vh.get();
|
||||
assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseXor(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseXor int");
|
||||
int x = (int) vh.get();
|
||||
assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseXorAcquire(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int");
|
||||
int x = (int) vh.get();
|
||||
assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseXorRelease(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int");
|
||||
int x = (int) vh.get();
|
||||
assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(VarHandle vh) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -752,21 +1014,143 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(array, i, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndSet(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndSet int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, 0x89ABCDEF, "getAndSet int value");
|
||||
}
|
||||
|
||||
vh.set(array, i, 0x01234567);
|
||||
{
|
||||
vh.set(array, i, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndSetAcquire(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndSetAcquire int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, 0x89ABCDEF, "getAndSetAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndSetRelease(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndSetRelease int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, 0x89ABCDEF, "getAndSetRelease int value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(array, i, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndAdd(array, i, 0xCAFEBABE);
|
||||
assertEquals(o, 0x01234567, "getAndAdd int");
|
||||
int c = (int) vh.addAndGet(array, i, 0xCAFEBABE);
|
||||
assertEquals(c, (int)(0x01234567 + 0xCAFEBABE + 0xCAFEBABE), "getAndAdd int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndAddAcquire(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndAddAcquire int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndAddRelease(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndAddReleaseint");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(array, i, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseOr(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseOr int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseOrAcquire(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseOrRelease(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(array, i, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseAnd(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseAnd int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseAndAcquire(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseAndRelease(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(array, i, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseXor(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseXor int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseXorAcquire(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 0x01234567);
|
||||
|
||||
int o = (int) vh.getAndBitwiseXorRelease(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -775,6 +1159,7 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
|
||||
|
||||
int i = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable {
|
||||
@ -852,11 +1237,63 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndAdd(array, ci, 0xCAFEBABE);
|
||||
int o = (int) vh.getAndSetAcquire(array, ci, 0x01234567);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.addAndGet(array, ci, 0xCAFEBABE);
|
||||
int o = (int) vh.getAndSetRelease(array, ci, 0x01234567);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndAdd(array, ci, 0x01234567);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndAddAcquire(array, ci, 0x01234567);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndAddRelease(array, ci, 0x01234567);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.addAndGet(array, ci, 0x01234567);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseOr(array, ci, 0x01234567);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseOrAcquire(array, ci, 0x01234567);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseOrRelease(array, ci, 0x01234567);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseAnd(array, ci, 0x01234567);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseAndAcquire(array, ci, 0x01234567);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseAndRelease(array, ci, 0x01234567);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseXor(array, ci, 0x01234567);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseXorAcquire(array, ci, 0x01234567);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseXorRelease(array, ci, 0x01234567);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,9 +108,23 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
|
||||
}
|
||||
|
||||
|
||||
@ -261,6 +275,7 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -309,6 +324,7 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -443,25 +459,148 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndSet(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long");
|
||||
long x = (long) vh.get(recv);
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value");
|
||||
}
|
||||
|
||||
vh.set(recv, 0x0123456789ABCDEFL);
|
||||
{
|
||||
vh.set(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndSetAcquire(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndSetAcquire long");
|
||||
long x = (long) vh.get(recv);
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndSetRelease(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndSetRelease long");
|
||||
long x = (long) vh.get(recv);
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetRelease long value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndAdd(recv, 0xDEADBEEFDEADBEEFL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long");
|
||||
long c = (long) vh.addAndGet(recv, 0xDEADBEEFDEADBEEFL);
|
||||
assertEquals(c, (long)(0x0123456789ABCDEFL + 0xDEADBEEFDEADBEEFL + 0xDEADBEEFDEADBEEFL), "getAndAdd long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndAddAcquire(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long");
|
||||
long x = (long) vh.get(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndAddRelease(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndAddReleaselong");
|
||||
long x = (long) vh.get(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseOr(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long");
|
||||
long x = (long) vh.get(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseOrAcquire(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long");
|
||||
long x = (long) vh.get(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseOrRelease(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long");
|
||||
long x = (long) vh.get(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseAnd(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long");
|
||||
long x = (long) vh.get(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseAndAcquire(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long");
|
||||
long x = (long) vh.get(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseAndRelease(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long");
|
||||
long x = (long) vh.get(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseXor(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long");
|
||||
long x = (long) vh.get(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseXorAcquire(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long");
|
||||
long x = (long) vh.get(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseXorRelease(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long");
|
||||
long x = (long) vh.get(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestAccessLong recv, VarHandle vh) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -596,25 +735,148 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndSet(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long");
|
||||
long x = (long) vh.get();
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value");
|
||||
}
|
||||
|
||||
vh.set(0x0123456789ABCDEFL);
|
||||
{
|
||||
vh.set(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndSetAcquire(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndSetAcquire long");
|
||||
long x = (long) vh.get();
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndSetRelease(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndSetRelease long");
|
||||
long x = (long) vh.get();
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetRelease long value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndAdd( 0xDEADBEEFDEADBEEFL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long");
|
||||
long c = (long) vh.addAndGet(0xDEADBEEFDEADBEEFL);
|
||||
assertEquals(c, (long)(0x0123456789ABCDEFL + 0xDEADBEEFDEADBEEFL + 0xDEADBEEFDEADBEEFL), "getAndAdd long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndAddAcquire(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long");
|
||||
long x = (long) vh.get();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndAddRelease(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndAddReleaselong");
|
||||
long x = (long) vh.get();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseOr(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long");
|
||||
long x = (long) vh.get();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseOrAcquire(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long");
|
||||
long x = (long) vh.get();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseOrRelease(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long");
|
||||
long x = (long) vh.get();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseAnd(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long");
|
||||
long x = (long) vh.get();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseAndAcquire(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long");
|
||||
long x = (long) vh.get();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseAndRelease(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long");
|
||||
long x = (long) vh.get();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseXor(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long");
|
||||
long x = (long) vh.get();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseXorAcquire(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long");
|
||||
long x = (long) vh.get();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseXorRelease(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long");
|
||||
long x = (long) vh.get();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(VarHandle vh) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -752,21 +1014,143 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndSet(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value");
|
||||
}
|
||||
|
||||
vh.set(array, i, 0x0123456789ABCDEFL);
|
||||
{
|
||||
vh.set(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndSetAcquire(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndSetAcquire long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndSetRelease(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndSetRelease long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetRelease long value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndAdd(array, i, 0xDEADBEEFDEADBEEFL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long");
|
||||
long c = (long) vh.addAndGet(array, i, 0xDEADBEEFDEADBEEFL);
|
||||
assertEquals(c, (long)(0x0123456789ABCDEFL + 0xDEADBEEFDEADBEEFL + 0xDEADBEEFDEADBEEFL), "getAndAdd long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndAddAcquire(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndAddRelease(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndAddReleaselong");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseOr(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseOrAcquire(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseOrRelease(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseAnd(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseAndAcquire(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseAndRelease(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseXor(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseXorAcquire(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) vh.getAndBitwiseXorRelease(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -775,6 +1159,7 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
|
||||
|
||||
int i = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable {
|
||||
@ -852,11 +1237,63 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndAdd(array, ci, 0xDEADBEEFDEADBEEFL);
|
||||
long o = (long) vh.getAndSetAcquire(array, ci, 0x0123456789ABCDEFL);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.addAndGet(array, ci, 0xDEADBEEFDEADBEEFL);
|
||||
long o = (long) vh.getAndSetRelease(array, ci, 0x0123456789ABCDEFL);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndAdd(array, ci, 0x0123456789ABCDEFL);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndAddAcquire(array, ci, 0x0123456789ABCDEFL);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndAddRelease(array, ci, 0x0123456789ABCDEFL);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.addAndGet(array, ci, 0x0123456789ABCDEFL);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseOr(array, ci, 0x0123456789ABCDEFL);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseOrAcquire(array, ci, 0x0123456789ABCDEFL);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseOrRelease(array, ci, 0x0123456789ABCDEFL);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseAnd(array, ci, 0x0123456789ABCDEFL);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseAndAcquire(array, ci, 0x0123456789ABCDEFL);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseAndRelease(array, ci, 0x0123456789ABCDEFL);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseXor(array, ci, 0x0123456789ABCDEFL);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseXorAcquire(array, ci, 0x0123456789ABCDEFL);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseXorRelease(array, ci, 0x0123456789ABCDEFL);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,9 +108,23 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
|
||||
}
|
||||
|
||||
|
||||
@ -261,6 +275,7 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -309,6 +324,7 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -443,25 +459,148 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(recv, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndSet(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndSet short");
|
||||
short x = (short) vh.get(recv);
|
||||
assertEquals(x, (short)0x4567, "getAndSet short value");
|
||||
}
|
||||
|
||||
vh.set(recv, (short)0x0123);
|
||||
{
|
||||
vh.set(recv, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndSetAcquire(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndSetAcquire short");
|
||||
short x = (short) vh.get(recv);
|
||||
assertEquals(x, (short)0x4567, "getAndSetAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndSetRelease(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndSetRelease short");
|
||||
short x = (short) vh.get(recv);
|
||||
assertEquals(x, (short)0x4567, "getAndSetRelease short value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(recv, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndAdd(recv, (short)0x89AB);
|
||||
assertEquals(o, (short)0x0123, "getAndAdd short");
|
||||
short c = (short) vh.addAndGet(recv, (short)0x89AB);
|
||||
assertEquals(c, (short)((short)0x0123 + (short)0x89AB + (short)0x89AB), "getAndAdd short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndAddAcquire(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndAddAcquire short");
|
||||
short x = (short) vh.get(recv);
|
||||
assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndAddRelease(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndAddReleaseshort");
|
||||
short x = (short) vh.get(recv);
|
||||
assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(recv, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseOr(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseOr short");
|
||||
short x = (short) vh.get(recv);
|
||||
assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseOrAcquire(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short");
|
||||
short x = (short) vh.get(recv);
|
||||
assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseOrRelease(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short");
|
||||
short x = (short) vh.get(recv);
|
||||
assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(recv, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseAnd(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseAnd short");
|
||||
short x = (short) vh.get(recv);
|
||||
assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseAndAcquire(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short");
|
||||
short x = (short) vh.get(recv);
|
||||
assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseAndRelease(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short");
|
||||
short x = (short) vh.get(recv);
|
||||
assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(recv, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseXor(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseXor short");
|
||||
short x = (short) vh.get(recv);
|
||||
assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseXorAcquire(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short");
|
||||
short x = (short) vh.get(recv);
|
||||
assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseXorRelease(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short");
|
||||
short x = (short) vh.get(recv);
|
||||
assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestAccessShort recv, VarHandle vh) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -596,25 +735,148 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set((short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndSet((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndSet short");
|
||||
short x = (short) vh.get();
|
||||
assertEquals(x, (short)0x4567, "getAndSet short value");
|
||||
}
|
||||
|
||||
vh.set((short)0x0123);
|
||||
{
|
||||
vh.set((short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndSetAcquire((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndSetAcquire short");
|
||||
short x = (short) vh.get();
|
||||
assertEquals(x, (short)0x4567, "getAndSetAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set((short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndSetRelease((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndSetRelease short");
|
||||
short x = (short) vh.get();
|
||||
assertEquals(x, (short)0x4567, "getAndSetRelease short value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set((short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndAdd( (short)0x89AB);
|
||||
assertEquals(o, (short)0x0123, "getAndAdd short");
|
||||
short c = (short) vh.addAndGet((short)0x89AB);
|
||||
assertEquals(c, (short)((short)0x0123 + (short)0x89AB + (short)0x89AB), "getAndAdd short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set((short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndAddAcquire((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndAddAcquire short");
|
||||
short x = (short) vh.get();
|
||||
assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set((short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndAddRelease((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndAddReleaseshort");
|
||||
short x = (short) vh.get();
|
||||
assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set((short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseOr((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseOr short");
|
||||
short x = (short) vh.get();
|
||||
assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set((short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseOrAcquire((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short");
|
||||
short x = (short) vh.get();
|
||||
assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set((short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseOrRelease((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short");
|
||||
short x = (short) vh.get();
|
||||
assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set((short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseAnd((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseAnd short");
|
||||
short x = (short) vh.get();
|
||||
assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set((short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseAndAcquire((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short");
|
||||
short x = (short) vh.get();
|
||||
assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set((short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseAndRelease((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short");
|
||||
short x = (short) vh.get();
|
||||
assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set((short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseXor((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseXor short");
|
||||
short x = (short) vh.get();
|
||||
assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set((short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseXorAcquire((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short");
|
||||
short x = (short) vh.get();
|
||||
assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set((short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseXorRelease((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short");
|
||||
short x = (short) vh.get();
|
||||
assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(VarHandle vh) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -752,21 +1014,143 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndSet(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndSet short");
|
||||
short x = (short) vh.get(array, i);
|
||||
assertEquals(x, (short)0x4567, "getAndSet short value");
|
||||
}
|
||||
|
||||
vh.set(array, i, (short)0x0123);
|
||||
{
|
||||
vh.set(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndSetAcquire(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndSetAcquire short");
|
||||
short x = (short) vh.get(array, i);
|
||||
assertEquals(x, (short)0x4567, "getAndSetAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndSetRelease(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndSetRelease short");
|
||||
short x = (short) vh.get(array, i);
|
||||
assertEquals(x, (short)0x4567, "getAndSetRelease short value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndAdd(array, i, (short)0x89AB);
|
||||
assertEquals(o, (short)0x0123, "getAndAdd short");
|
||||
short c = (short) vh.addAndGet(array, i, (short)0x89AB);
|
||||
assertEquals(c, (short)((short)0x0123 + (short)0x89AB + (short)0x89AB), "getAndAdd short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndAddAcquire(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndAddAcquire short");
|
||||
short x = (short) vh.get(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndAddRelease(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndAddReleaseshort");
|
||||
short x = (short) vh.get(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseOr(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseOr short");
|
||||
short x = (short) vh.get(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseOrAcquire(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short");
|
||||
short x = (short) vh.get(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseOrRelease(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short");
|
||||
short x = (short) vh.get(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseAnd(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseAnd short");
|
||||
short x = (short) vh.get(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseAndAcquire(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short");
|
||||
short x = (short) vh.get(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseAndRelease(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short");
|
||||
short x = (short) vh.get(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseXor(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseXor short");
|
||||
short x = (short) vh.get(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseXorAcquire(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short");
|
||||
short x = (short) vh.get(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) vh.getAndBitwiseXorRelease(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short");
|
||||
short x = (short) vh.get(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -775,6 +1159,7 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
|
||||
|
||||
int i = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable {
|
||||
@ -852,11 +1237,63 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
short o = (short) vh.getAndAdd(array, ci, (short)0x89AB);
|
||||
short o = (short) vh.getAndSetAcquire(array, ci, (short)0x0123);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
short o = (short) vh.addAndGet(array, ci, (short)0x89AB);
|
||||
short o = (short) vh.getAndSetRelease(array, ci, (short)0x0123);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
short o = (short) vh.getAndAdd(array, ci, (short)0x0123);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
short o = (short) vh.getAndAddAcquire(array, ci, (short)0x0123);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
short o = (short) vh.getAndAddRelease(array, ci, (short)0x0123);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
short o = (short) vh.addAndGet(array, ci, (short)0x0123);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
short o = (short) vh.getAndBitwiseOr(array, ci, (short)0x0123);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
short o = (short) vh.getAndBitwiseOrAcquire(array, ci, (short)0x0123);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
short o = (short) vh.getAndBitwiseOrRelease(array, ci, (short)0x0123);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
short o = (short) vh.getAndBitwiseAnd(array, ci, (short)0x0123);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
short o = (short) vh.getAndBitwiseAndAcquire(array, ci, (short)0x0123);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
short o = (short) vh.getAndBitwiseAndRelease(array, ci, (short)0x0123);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
short o = (short) vh.getAndBitwiseXor(array, ci, (short)0x0123);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
short o = (short) vh.getAndBitwiseXorAcquire(array, ci, (short)0x0123);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
short o = (short) vh.getAndBitwiseXorRelease(array, ci, (short)0x0123);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,9 +108,23 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
|
||||
}
|
||||
|
||||
|
||||
@ -265,9 +279,53 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
|
||||
String o = (String) vh.getAndAdd(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndAddAcquire(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndAddRelease(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.addAndGet(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseOr(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseOrAcquire(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseOrRelease(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseAnd(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseAndAcquire(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseAndRelease(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseXor(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseXorAcquire(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseXorRelease(recv, "foo");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -320,9 +378,53 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
|
||||
String o = (String) vh.getAndAdd("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndAddAcquire("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndAddRelease("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.addAndGet("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseOr("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseOrAcquire("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseOrRelease("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseAnd("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseAndAcquire("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseAndRelease("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseXor("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseXorAcquire("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseXorRelease("foo");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -457,12 +559,33 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(recv, "foo");
|
||||
|
||||
String o = (String) vh.getAndSet(recv, "bar");
|
||||
assertEquals(o, "foo", "getAndSet String");
|
||||
String x = (String) vh.get(recv);
|
||||
assertEquals(x, "bar", "getAndSet String value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, "foo");
|
||||
|
||||
String o = (String) vh.getAndSetAcquire(recv, "bar");
|
||||
assertEquals(o, "foo", "getAndSetAcquire String");
|
||||
String x = (String) vh.get(recv);
|
||||
assertEquals(x, "bar", "getAndSetAcquire String value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, "foo");
|
||||
|
||||
String o = (String) vh.getAndSetRelease(recv, "bar");
|
||||
assertEquals(o, "foo", "getAndSetRelease String");
|
||||
String x = (String) vh.get(recv);
|
||||
assertEquals(x, "bar", "getAndSetRelease String value");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestAccessString recv, VarHandle vh) {
|
||||
@ -471,9 +594,53 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
|
||||
String o = (String) vh.getAndAdd(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndAddAcquire(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndAddRelease(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.addAndGet(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseOr(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseOrAcquire(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseOrRelease(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseAnd(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseAndAcquire(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseAndRelease(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseXor(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseXorAcquire(recv, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseXorRelease(recv, "foo");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -608,12 +775,33 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set("foo");
|
||||
|
||||
String o = (String) vh.getAndSet("bar");
|
||||
assertEquals(o, "foo", "getAndSet String");
|
||||
String x = (String) vh.get();
|
||||
assertEquals(x, "bar", "getAndSet String value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set("foo");
|
||||
|
||||
String o = (String) vh.getAndSetAcquire("bar");
|
||||
assertEquals(o, "foo", "getAndSetAcquire String");
|
||||
String x = (String) vh.get();
|
||||
assertEquals(x, "bar", "getAndSetAcquire String value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set("foo");
|
||||
|
||||
String o = (String) vh.getAndSetRelease("bar");
|
||||
assertEquals(o, "foo", "getAndSetRelease String");
|
||||
String x = (String) vh.get();
|
||||
assertEquals(x, "bar", "getAndSetRelease String value");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(VarHandle vh) {
|
||||
@ -622,9 +810,53 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
|
||||
String o = (String) vh.getAndAdd("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndAddAcquire("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndAddRelease("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.addAndGet("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseOr("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseOrAcquire("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseOrRelease("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseAnd("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseAndAcquire("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseAndRelease("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseXor("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseXorAcquire("foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseXorRelease("foo");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -762,12 +994,33 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(array, i, "foo");
|
||||
|
||||
String o = (String) vh.getAndSet(array, i, "bar");
|
||||
assertEquals(o, "foo", "getAndSet String");
|
||||
String x = (String) vh.get(array, i);
|
||||
assertEquals(x, "bar", "getAndSet String value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, "foo");
|
||||
|
||||
String o = (String) vh.getAndSetAcquire(array, i, "bar");
|
||||
assertEquals(o, "foo", "getAndSetAcquire String");
|
||||
String x = (String) vh.get(array, i);
|
||||
assertEquals(x, "bar", "getAndSetAcquire String value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, "foo");
|
||||
|
||||
String o = (String) vh.getAndSetRelease(array, i, "bar");
|
||||
assertEquals(o, "foo", "getAndSetRelease String");
|
||||
String x = (String) vh.get(array, i);
|
||||
assertEquals(x, "bar", "getAndSetRelease String value");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -780,9 +1033,53 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
|
||||
String o = (String) vh.getAndAdd(array, i, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndAddAcquire(array, i, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndAddRelease(array, i, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.addAndGet(array, i, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseOr(array, i, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseOrAcquire(array, i, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseOrRelease(array, i, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseAnd(array, i, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseAndAcquire(array, i, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseAndRelease(array, i, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseXor(array, i, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseXorAcquire(array, i, "foo");
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
String o = (String) vh.getAndBitwiseXorRelease(array, i, "foo");
|
||||
});
|
||||
}
|
||||
|
||||
static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable {
|
||||
@ -859,6 +1156,15 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
|
||||
String o = (String) vh.getAndSet(array, ci, "foo");
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
String o = (String) vh.getAndSetAcquire(array, ci, "foo");
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
String o = (String) vh.getAndSetRelease(array, ci, "foo");
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,9 +97,23 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
|
||||
}
|
||||
|
||||
@Test(dataProvider = "typesProvider")
|
||||
@ -220,13 +234,65 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
|
||||
char o = (char) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
}
|
||||
|
||||
static void testArrayUnsupported(ByteBufferSource bs, VarHandleSource vhs) {
|
||||
@ -289,13 +355,65 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
|
||||
char o = (char) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
}
|
||||
else {
|
||||
checkUOE(() -> {
|
||||
@ -333,13 +451,64 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
char o = (char) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -385,6 +554,7 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -434,6 +604,7 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -518,6 +689,7 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -564,6 +736,7 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
|
||||
assertEquals(x, VALUE_2, "setOpaque char value");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -609,6 +782,7 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
|
||||
assertEquals(x, VALUE_2, "setOpaque char value");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,9 +97,23 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
|
||||
}
|
||||
|
||||
@Test(dataProvider = "typesProvider")
|
||||
@ -189,9 +203,53 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
|
||||
double o = (double) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
}
|
||||
|
||||
static void testArrayUnsupported(ByteBufferSource bs, VarHandleSource vhs) {
|
||||
@ -255,23 +313,118 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
|
||||
double o = (double) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
double o = (double) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
double o = (double) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
}
|
||||
else {
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
double o = (double) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -352,6 +505,15 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
|
||||
double o = (double) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
double o = (double) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
double o = (double) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -437,6 +599,15 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
|
||||
double o = (double) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
double o = (double) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
double o = (double) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -513,6 +684,14 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
|
||||
double o = (double) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
double o = (double) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
double o = (double) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -592,6 +771,15 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
|
||||
double o = (double) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
double o = (double) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
double o = (double) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -736,12 +924,33 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
double o = (double) vh.getAndSet(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSet double");
|
||||
double x = (double) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSet double value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
double o = (double) vh.getAndSetAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSetAcquire double");
|
||||
double x = (double) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSetAcquire double value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
double o = (double) vh.getAndSetRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSetRelease double");
|
||||
double x = (double) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSetRelease double value");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -885,12 +1094,33 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
double o = (double) vh.getAndSet(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSet double");
|
||||
double x = (double) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSet double value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
double o = (double) vh.getAndSetAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSetAcquire double");
|
||||
double x = (double) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSetAcquire double value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
double o = (double) vh.getAndSetRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSetRelease double");
|
||||
double x = (double) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSetRelease double value");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,9 +97,23 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
|
||||
}
|
||||
|
||||
@Test(dataProvider = "typesProvider")
|
||||
@ -189,9 +203,53 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
|
||||
float o = (float) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
}
|
||||
|
||||
static void testArrayUnsupported(ByteBufferSource bs, VarHandleSource vhs) {
|
||||
@ -255,23 +313,118 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
|
||||
float o = (float) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
float o = (float) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
float o = (float) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
}
|
||||
else {
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
float o = (float) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -352,6 +505,15 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
|
||||
float o = (float) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
float o = (float) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
float o = (float) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -437,6 +599,15 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
|
||||
float o = (float) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
float o = (float) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
float o = (float) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -513,6 +684,14 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
|
||||
float o = (float) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
float o = (float) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
float o = (float) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -592,6 +771,15 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
|
||||
float o = (float) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
float o = (float) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
float o = (float) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -736,12 +924,33 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
float o = (float) vh.getAndSet(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSet float");
|
||||
float x = (float) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSet float value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
float o = (float) vh.getAndSetAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSetAcquire float");
|
||||
float x = (float) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSetAcquire float value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
float o = (float) vh.getAndSetRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSetRelease float");
|
||||
float x = (float) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSetRelease float value");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -885,12 +1094,33 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
float o = (float) vh.getAndSet(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSet float");
|
||||
float x = (float) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSet float value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
float o = (float) vh.getAndSetAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSetAcquire float");
|
||||
float x = (float) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSetAcquire float value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
float o = (float) vh.getAndSetRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSetRelease float");
|
||||
float x = (float) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSetRelease float value");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,9 +97,23 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
|
||||
}
|
||||
|
||||
@Test(dataProvider = "typesProvider")
|
||||
@ -185,6 +199,7 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
|
||||
int ci = 1;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testArrayUnsupported(ByteBufferSource bs, VarHandleSource vhs) {
|
||||
@ -248,14 +263,66 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
|
||||
int o = (int) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
int o = (int) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
int o = (int) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
|
||||
checkROBE(() -> {
|
||||
int o = (int) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
int o = (int) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
int o = (int) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
int o = (int) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
}
|
||||
else {
|
||||
}
|
||||
@ -338,14 +405,66 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
|
||||
int o = (int) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -430,13 +549,65 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
|
||||
int o = (int) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
int o = (int) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -513,14 +684,65 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
|
||||
int o = (int) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -599,13 +821,65 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
|
||||
int o = (int) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
int o = (int) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -750,21 +1024,143 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndSet(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSet int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSet int value");
|
||||
}
|
||||
|
||||
vh.set(array, i, VALUE_1);
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndSetAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSetAcquire int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSetAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndSetRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSetRelease int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSetRelease int value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndAdd(array, i, VALUE_3);
|
||||
assertEquals(o, VALUE_1, "getAndAdd int");
|
||||
int c = (int) vh.addAndGet(array, i, VALUE_3);
|
||||
assertEquals(c, VALUE_1 + VALUE_3 + VALUE_3, "getAndAdd int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndAddAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndAddAcquire int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndAddRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndAddRelease int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndBitwiseOr(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseOr int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndBitwiseOrAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndBitwiseOrRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseOrRelease int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndBitwiseAnd(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseAnd int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndBitwiseAndAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndBitwiseAndRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseAndRelease int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndBitwiseXor(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseXor int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndBitwiseXorAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndBitwiseXorRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseXorRelease int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease int value");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -908,21 +1304,143 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndSet(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSet int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSet int value");
|
||||
}
|
||||
|
||||
vh.set(array, i, VALUE_1);
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndSetAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSetAcquire int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSetAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndSetRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSetRelease int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSetRelease int value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndAdd(array, i, VALUE_3);
|
||||
assertEquals(o, VALUE_1, "getAndAdd int");
|
||||
int c = (int) vh.addAndGet(array, i, VALUE_3);
|
||||
assertEquals(c, VALUE_1 + VALUE_3 + VALUE_3, "getAndAdd int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndAddAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndAddAcquire int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndAddRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndAddRelease int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndBitwiseOr(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseOr int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndBitwiseOrAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndBitwiseOrRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseOrRelease int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndBitwiseAnd(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseAnd int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndBitwiseAndAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndBitwiseAndRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseAndRelease int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndBitwiseXor(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseXor int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndBitwiseXorAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
int o = (int) vh.getAndBitwiseXorRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseXorRelease int");
|
||||
int x = (int) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease int value");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,9 +97,23 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
|
||||
}
|
||||
|
||||
@Test(dataProvider = "typesProvider")
|
||||
@ -185,6 +199,7 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
|
||||
int ci = 1;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testArrayUnsupported(ByteBufferSource bs, VarHandleSource vhs) {
|
||||
@ -248,14 +263,66 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
|
||||
long o = (long) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
long o = (long) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
long o = (long) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
|
||||
checkROBE(() -> {
|
||||
long o = (long) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
long o = (long) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
long o = (long) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
long o = (long) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
}
|
||||
else {
|
||||
}
|
||||
@ -338,14 +405,66 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
|
||||
long o = (long) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -430,13 +549,65 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
|
||||
long o = (long) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
long o = (long) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -513,14 +684,65 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
|
||||
long o = (long) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -599,13 +821,65 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
|
||||
long o = (long) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
long o = (long) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -750,21 +1024,143 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndSet(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSet long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSet long value");
|
||||
}
|
||||
|
||||
vh.set(array, i, VALUE_1);
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndSetAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSetAcquire long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSetAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndSetRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSetRelease long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSetRelease long value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndAdd(array, i, VALUE_3);
|
||||
assertEquals(o, VALUE_1, "getAndAdd long");
|
||||
long c = (long) vh.addAndGet(array, i, VALUE_3);
|
||||
assertEquals(c, VALUE_1 + VALUE_3 + VALUE_3, "getAndAdd long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndAddAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndAddAcquire long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndAddRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndAddRelease long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndBitwiseOr(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseOr long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndBitwiseOrAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndBitwiseOrRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseOrRelease long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndBitwiseAnd(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseAnd long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndBitwiseAndAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndBitwiseAndRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseAndRelease long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndBitwiseXor(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseXor long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndBitwiseXorAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndBitwiseXorRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseXorRelease long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease long value");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -908,21 +1304,143 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndSet(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSet long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSet long value");
|
||||
}
|
||||
|
||||
vh.set(array, i, VALUE_1);
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndSetAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSetAcquire long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSetAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndSetRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSetRelease long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSetRelease long value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndAdd(array, i, VALUE_3);
|
||||
assertEquals(o, VALUE_1, "getAndAdd long");
|
||||
long c = (long) vh.addAndGet(array, i, VALUE_3);
|
||||
assertEquals(c, VALUE_1 + VALUE_3 + VALUE_3, "getAndAdd long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndAddAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndAddAcquire long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndAddRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndAddRelease long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndBitwiseOr(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseOr long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndBitwiseOrAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndBitwiseOrRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseOrRelease long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndBitwiseAnd(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseAnd long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndBitwiseAndAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndBitwiseAndRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseAndRelease long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndBitwiseXor(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseXor long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndBitwiseXorAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
long o = (long) vh.getAndBitwiseXorRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseXorRelease long");
|
||||
long x = (long) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease long value");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,9 +97,23 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
|
||||
}
|
||||
|
||||
@Test(dataProvider = "typesProvider")
|
||||
@ -220,13 +234,65 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
|
||||
short o = (short) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
}
|
||||
|
||||
static void testArrayUnsupported(ByteBufferSource bs, VarHandleSource vhs) {
|
||||
@ -289,13 +355,65 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
|
||||
short o = (short) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
}
|
||||
else {
|
||||
checkUOE(() -> {
|
||||
@ -333,13 +451,64 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
short o = (short) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -385,6 +554,7 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -434,6 +604,7 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -518,6 +689,7 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -564,6 +736,7 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
|
||||
assertEquals(x, VALUE_2, "setOpaque short value");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -609,6 +782,7 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
|
||||
assertEquals(x, VALUE_2, "setOpaque short value");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,6 +255,90 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
|
||||
assertEquals(x, false, "getAndSet boolean value");
|
||||
}
|
||||
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, false);
|
||||
assertEquals(o, true, "getAndBitwiseOr boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, false);
|
||||
assertEquals(o, true, "getAndBitwiseOrAcquire boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, false);
|
||||
assertEquals(o, true, "getAndBitwiseOrRelease boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, false);
|
||||
assertEquals(o, true, "getAndBitwiseAnd boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, false);
|
||||
assertEquals(o, true, "getAndBitwiseAndAcquire boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, false);
|
||||
assertEquals(o, true, "getAndBitwiseAndRelease boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, false);
|
||||
assertEquals(o, true, "getAndBitwiseXor boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, false);
|
||||
assertEquals(o, true, "getAndBitwiseXorAcquire boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, false);
|
||||
assertEquals(o, true, "getAndBitwiseXorRelease boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessBoolean recv, Handles hs) throws Throwable {
|
||||
@ -264,6 +348,7 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(recv, true);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -398,12 +483,118 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET).invokeExact( false);
|
||||
hs.get(TestAccessMode.SET).invokeExact(true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET).invokeExact(false);
|
||||
assertEquals(o, true, "getAndSet boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, false, "getAndSet boolean value");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(false);
|
||||
assertEquals(o, true, "getAndSetAcquire boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, false, "getAndSetAcquire boolean value");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(false);
|
||||
assertEquals(o, true, "getAndSetRelease boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, false, "getAndSetRelease boolean value");
|
||||
}
|
||||
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(false);
|
||||
assertEquals(o, true, "getAndBitwiseOr boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(false);
|
||||
assertEquals(o, true, "getAndBitwiseOrAcquire boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(false);
|
||||
assertEquals(o, true, "getAndBitwiseOrRelease boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(false);
|
||||
assertEquals(o, true, "getAndBitwiseAnd boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(false);
|
||||
assertEquals(o, true, "getAndBitwiseAndAcquire boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(false);
|
||||
assertEquals(o, true, "getAndBitwiseAndRelease boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(false);
|
||||
assertEquals(o, true, "getAndBitwiseXor boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(false);
|
||||
assertEquals(o, true, "getAndBitwiseXorAcquire boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(false);
|
||||
assertEquals(o, true, "getAndBitwiseXorRelease boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
|
||||
@ -413,6 +604,7 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(true);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -550,12 +742,116 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, false);
|
||||
assertEquals(o, true, "getAndSet boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, false, "getAndSet boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, false);
|
||||
assertEquals(o, true, "getAndSetAcquire boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, false, "getAndSetAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, false);
|
||||
assertEquals(o, true, "getAndSetRelease boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, false, "getAndSetRelease boolean value");
|
||||
}
|
||||
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, false);
|
||||
assertEquals(o, true, "getAndBitwiseOr boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, false);
|
||||
assertEquals(o, true, "getAndBitwiseOrAcquire boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, false);
|
||||
assertEquals(o, true, "getAndBitwiseOrRelease boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, false);
|
||||
assertEquals(o, true, "getAndBitwiseAnd boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, false);
|
||||
assertEquals(o, true, "getAndBitwiseAndAcquire boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, false);
|
||||
assertEquals(o, true, "getAndBitwiseAndRelease boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, false);
|
||||
assertEquals(o, true, "getAndBitwiseXor boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, false);
|
||||
assertEquals(o, true, "getAndBitwiseXorAcquire boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, true);
|
||||
|
||||
boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, false);
|
||||
assertEquals(o, true, "getAndBitwiseXorRelease boolean");
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -569,6 +865,7 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
|
||||
boolean o = (boolean) hs.get(am).invokeExact(array, i, true);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void testArrayIndexOutOfBounds(Handles hs) throws Throwable {
|
||||
@ -607,6 +904,12 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
|
||||
checkIOOBE(am, () -> {
|
||||
boolean o = (boolean) hs.get(am).invokeExact(array, ci, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,19 +255,122 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
|
||||
assertEquals(x, (byte)0x23, "getAndSet byte value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, (byte)0x45);
|
||||
assertEquals(o, (byte)0x01, "getAndAdd byte");
|
||||
byte c = (byte) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, (byte)0x45);
|
||||
assertEquals(c, (byte)((byte)0x01 + (byte)0x45 + (byte)0x45), "getAndAdd byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndAddAcquire byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndAddRelease byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseOr byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseXor byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessByte recv, Handles hs) throws Throwable {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -402,25 +505,150 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_SET).invokeExact( (byte)0x23);
|
||||
hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_SET).invokeExact((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndSet byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (byte)0x23, "getAndSet byte value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndSetAcquire byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (byte)0x23, "getAndSetAcquire byte value");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndSetRelease byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (byte)0x23, "getAndSetRelease byte value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( (byte)0x45);
|
||||
hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD).invokeExact((byte)0x45);
|
||||
assertEquals(o, (byte)0x01, "getAndAdd byte");
|
||||
byte c = (byte) hs.get(TestAccessMode.ADD_AND_GET).invokeExact((byte)0x45);
|
||||
assertEquals(c, (byte)((byte)0x01 + (byte)0x45 + (byte)0x45), "getAndAdd byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndAddAcquire byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndAddRelease byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseOr byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseXor byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact((byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -558,21 +786,143 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndSet byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (byte)0x23, "getAndSet byte value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndSetAcquire byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (byte)0x23, "getAndSetAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndSetRelease byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (byte)0x23, "getAndSetRelease byte value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, (byte)0x45);
|
||||
assertEquals(o, (byte)0x01, "getAndAdd byte");
|
||||
byte c = (byte) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, (byte)0x45);
|
||||
assertEquals(c, (byte)((byte)0x01 + (byte)0x45 + (byte)0x45), "getAndAdd byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndAddAcquire byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndAddRelease byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseOr byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseXor byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
|
||||
|
||||
byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, (byte)0x23);
|
||||
assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte");
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -581,6 +931,7 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
|
||||
|
||||
final int i = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testArrayIndexOutOfBounds(Handles hs) throws Throwable {
|
||||
@ -624,6 +975,12 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
|
||||
byte o = (byte) hs.get(am).invokeExact(array, ci, (byte)0x45);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
|
||||
checkIOOBE(am, () -> {
|
||||
byte o = (byte) hs.get(am).invokeExact(array, ci, (byte)0x45);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,19 +255,122 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
|
||||
assertEquals(x, '\u4567', "getAndSet char value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, '\u89AB');
|
||||
assertEquals(o, '\u0123', "getAndAdd char");
|
||||
char c = (char) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, '\u89AB');
|
||||
assertEquals(c, (char)('\u0123' + '\u89AB' + '\u89AB'), "getAndAdd char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndAddAcquire char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndAddRelease char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseOr char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseOrRelease char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseAnd char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseAndRelease char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseXor char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseXorRelease char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessChar recv, Handles hs) throws Throwable {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -402,25 +505,150 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_SET).invokeExact( '\u4567');
|
||||
hs.get(TestAccessMode.SET).invokeExact('\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_SET).invokeExact('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndSet char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, '\u4567', "getAndSet char value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact('\u0123');
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact('\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndSetAcquire char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, '\u4567', "getAndSetAcquire char value");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact('\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndSetRelease char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, '\u4567', "getAndSetRelease char value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( '\u89AB');
|
||||
hs.get(TestAccessMode.SET).invokeExact('\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_ADD).invokeExact('\u89AB');
|
||||
assertEquals(o, '\u0123', "getAndAdd char");
|
||||
char c = (char) hs.get(TestAccessMode.ADD_AND_GET).invokeExact('\u89AB');
|
||||
assertEquals(c, (char)('\u0123' + '\u89AB' + '\u89AB'), "getAndAdd char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact('\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndAddAcquire char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact('\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndAddRelease char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact('\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseOr char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact('\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact('\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseOrRelease char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact('\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseAnd char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact('\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact('\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseAndRelease char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact('\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseXor char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact('\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact('\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact('\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseXorRelease char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -558,21 +786,143 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndSet char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, '\u4567', "getAndSet char value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndSetAcquire char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, '\u4567', "getAndSetAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndSetRelease char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, '\u4567', "getAndSetRelease char value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, '\u89AB');
|
||||
assertEquals(o, '\u0123', "getAndAdd char");
|
||||
char c = (char) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, '\u89AB');
|
||||
assertEquals(c, (char)('\u0123' + '\u89AB' + '\u89AB'), "getAndAdd char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndAddAcquire char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndAddRelease char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseOr char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseOrRelease char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseAnd char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseAndRelease char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseXor char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
|
||||
|
||||
char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, '\u4567');
|
||||
assertEquals(o, '\u0123', "getAndBitwiseXorRelease char");
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -581,6 +931,7 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
|
||||
|
||||
final int i = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testArrayIndexOutOfBounds(Handles hs) throws Throwable {
|
||||
@ -624,6 +975,12 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
|
||||
char o = (char) hs.get(am).invokeExact(array, ci, '\u89AB');
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
|
||||
checkIOOBE(am, () -> {
|
||||
char o = (char) hs.get(am).invokeExact(array, ci, '\u89AB');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,19 +255,44 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
|
||||
assertEquals(x, 2.0d, "getAndSet double value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 1.0d);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 1.0d);
|
||||
|
||||
double o = (double) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 3.0d);
|
||||
assertEquals(o, 1.0d, "getAndAdd double");
|
||||
double c = (double) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, 3.0d);
|
||||
assertEquals(c, (double)(1.0d + 3.0d + 3.0d), "getAndAdd double value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 1.0d);
|
||||
|
||||
double o = (double) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, 2.0d);
|
||||
assertEquals(o, 1.0d, "getAndAddAcquire double");
|
||||
double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 1.0d);
|
||||
|
||||
double o = (double) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, 2.0d);
|
||||
assertEquals(o, 1.0d, "getAndAddRelease double");
|
||||
double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessDouble recv, Handles hs) throws Throwable {
|
||||
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
|
||||
checkUOE(am, () -> {
|
||||
double r = (double) hs.get(am).invokeExact(recv, 1.0d);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -402,25 +427,72 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
double o = (double) hs.get(TestAccessMode.GET_AND_SET).invokeExact( 2.0d);
|
||||
hs.get(TestAccessMode.SET).invokeExact(1.0d);
|
||||
|
||||
double o = (double) hs.get(TestAccessMode.GET_AND_SET).invokeExact(2.0d);
|
||||
assertEquals(o, 1.0d, "getAndSet double");
|
||||
double x = (double) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 2.0d, "getAndSet double value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact(1.0d);
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(1.0d);
|
||||
|
||||
double o = (double) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(2.0d);
|
||||
assertEquals(o, 1.0d, "getAndSetAcquire double");
|
||||
double x = (double) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 2.0d, "getAndSetAcquire double value");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(1.0d);
|
||||
|
||||
double o = (double) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(2.0d);
|
||||
assertEquals(o, 1.0d, "getAndSetRelease double");
|
||||
double x = (double) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 2.0d, "getAndSetRelease double value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
double o = (double) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( 3.0d);
|
||||
hs.get(TestAccessMode.SET).invokeExact(1.0d);
|
||||
|
||||
double o = (double) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(3.0d);
|
||||
assertEquals(o, 1.0d, "getAndAdd double");
|
||||
double c = (double) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(3.0d);
|
||||
assertEquals(c, (double)(1.0d + 3.0d + 3.0d), "getAndAdd double value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(1.0d);
|
||||
|
||||
double o = (double) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(2.0d);
|
||||
assertEquals(o, 1.0d, "getAndAddAcquire double");
|
||||
double x = (double) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(1.0d);
|
||||
|
||||
double o = (double) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(2.0d);
|
||||
assertEquals(o, 1.0d, "getAndAddRelease double");
|
||||
double x = (double) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
|
||||
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
|
||||
checkUOE(am, () -> {
|
||||
double r = (double) hs.get(am).invokeExact(1.0d);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -558,21 +630,60 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d);
|
||||
|
||||
double o = (double) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, 2.0d);
|
||||
assertEquals(o, 1.0d, "getAndSet double");
|
||||
double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 2.0d, "getAndSet double value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d);
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d);
|
||||
|
||||
double o = (double) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, 2.0d);
|
||||
assertEquals(o, 1.0d, "getAndSetAcquire double");
|
||||
double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 2.0d, "getAndSetAcquire double value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d);
|
||||
|
||||
double o = (double) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, 2.0d);
|
||||
assertEquals(o, 1.0d, "getAndSetRelease double");
|
||||
double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 2.0d, "getAndSetRelease double value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d);
|
||||
|
||||
double o = (double) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 3.0d);
|
||||
assertEquals(o, 1.0d, "getAndAdd double");
|
||||
double c = (double) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, 3.0d);
|
||||
assertEquals(c, (double)(1.0d + 3.0d + 3.0d), "getAndAdd double value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d);
|
||||
|
||||
double o = (double) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, 2.0d);
|
||||
assertEquals(o, 1.0d, "getAndAddAcquire double");
|
||||
double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d);
|
||||
|
||||
double o = (double) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, 2.0d);
|
||||
assertEquals(o, 1.0d, "getAndAddRelease double");
|
||||
double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -581,6 +692,12 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
|
||||
|
||||
final int i = 0;
|
||||
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
|
||||
checkUOE(am, () -> {
|
||||
double o = (double) hs.get(am).invokeExact(array, i, 1.0d);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
static void testArrayIndexOutOfBounds(Handles hs) throws Throwable {
|
||||
@ -624,6 +741,7 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
|
||||
double o = (double) hs.get(am).invokeExact(array, ci, 3.0d);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,19 +255,44 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
|
||||
assertEquals(x, 2.0f, "getAndSet float value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 1.0f);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 1.0f);
|
||||
|
||||
float o = (float) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 3.0f);
|
||||
assertEquals(o, 1.0f, "getAndAdd float");
|
||||
float c = (float) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, 3.0f);
|
||||
assertEquals(c, (float)(1.0f + 3.0f + 3.0f), "getAndAdd float value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 1.0f);
|
||||
|
||||
float o = (float) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, 2.0f);
|
||||
assertEquals(o, 1.0f, "getAndAddAcquire float");
|
||||
float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 1.0f);
|
||||
|
||||
float o = (float) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, 2.0f);
|
||||
assertEquals(o, 1.0f, "getAndAddRelease float");
|
||||
float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessFloat recv, Handles hs) throws Throwable {
|
||||
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
|
||||
checkUOE(am, () -> {
|
||||
float r = (float) hs.get(am).invokeExact(recv, 1.0f);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -402,25 +427,72 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
float o = (float) hs.get(TestAccessMode.GET_AND_SET).invokeExact( 2.0f);
|
||||
hs.get(TestAccessMode.SET).invokeExact(1.0f);
|
||||
|
||||
float o = (float) hs.get(TestAccessMode.GET_AND_SET).invokeExact(2.0f);
|
||||
assertEquals(o, 1.0f, "getAndSet float");
|
||||
float x = (float) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 2.0f, "getAndSet float value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact(1.0f);
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(1.0f);
|
||||
|
||||
float o = (float) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(2.0f);
|
||||
assertEquals(o, 1.0f, "getAndSetAcquire float");
|
||||
float x = (float) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 2.0f, "getAndSetAcquire float value");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(1.0f);
|
||||
|
||||
float o = (float) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(2.0f);
|
||||
assertEquals(o, 1.0f, "getAndSetRelease float");
|
||||
float x = (float) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 2.0f, "getAndSetRelease float value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
float o = (float) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( 3.0f);
|
||||
hs.get(TestAccessMode.SET).invokeExact(1.0f);
|
||||
|
||||
float o = (float) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(3.0f);
|
||||
assertEquals(o, 1.0f, "getAndAdd float");
|
||||
float c = (float) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(3.0f);
|
||||
assertEquals(c, (float)(1.0f + 3.0f + 3.0f), "getAndAdd float value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(1.0f);
|
||||
|
||||
float o = (float) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(2.0f);
|
||||
assertEquals(o, 1.0f, "getAndAddAcquire float");
|
||||
float x = (float) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(1.0f);
|
||||
|
||||
float o = (float) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(2.0f);
|
||||
assertEquals(o, 1.0f, "getAndAddRelease float");
|
||||
float x = (float) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
|
||||
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
|
||||
checkUOE(am, () -> {
|
||||
float r = (float) hs.get(am).invokeExact(1.0f);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -558,21 +630,60 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f);
|
||||
|
||||
float o = (float) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, 2.0f);
|
||||
assertEquals(o, 1.0f, "getAndSet float");
|
||||
float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 2.0f, "getAndSet float value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f);
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f);
|
||||
|
||||
float o = (float) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, 2.0f);
|
||||
assertEquals(o, 1.0f, "getAndSetAcquire float");
|
||||
float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 2.0f, "getAndSetAcquire float value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f);
|
||||
|
||||
float o = (float) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, 2.0f);
|
||||
assertEquals(o, 1.0f, "getAndSetRelease float");
|
||||
float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 2.0f, "getAndSetRelease float value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f);
|
||||
|
||||
float o = (float) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 3.0f);
|
||||
assertEquals(o, 1.0f, "getAndAdd float");
|
||||
float c = (float) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, 3.0f);
|
||||
assertEquals(c, (float)(1.0f + 3.0f + 3.0f), "getAndAdd float value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f);
|
||||
|
||||
float o = (float) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, 2.0f);
|
||||
assertEquals(o, 1.0f, "getAndAddAcquire float");
|
||||
float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f);
|
||||
|
||||
float o = (float) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, 2.0f);
|
||||
assertEquals(o, 1.0f, "getAndAddRelease float");
|
||||
float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -581,6 +692,12 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
|
||||
|
||||
final int i = 0;
|
||||
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
|
||||
checkUOE(am, () -> {
|
||||
float o = (float) hs.get(am).invokeExact(array, i, 1.0f);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
static void testArrayIndexOutOfBounds(Handles hs) throws Throwable {
|
||||
@ -624,6 +741,7 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
|
||||
float o = (float) hs.get(am).invokeExact(array, ci, 3.0f);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,19 +255,122 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
|
||||
assertEquals(x, 0x89ABCDEF, "getAndSet int value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 0xCAFEBABE);
|
||||
assertEquals(o, 0x01234567, "getAndAdd int");
|
||||
int c = (int) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, 0xCAFEBABE);
|
||||
assertEquals(c, (int)(0x01234567 + 0xCAFEBABE + 0xCAFEBABE), "getAndAdd int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndAddAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndAddRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseOr int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseAnd int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseXor int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessInt recv, Handles hs) throws Throwable {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -402,25 +505,150 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_SET).invokeExact( 0x89ABCDEF);
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_SET).invokeExact(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndSet int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 0x89ABCDEF, "getAndSet int value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x01234567);
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndSetAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 0x89ABCDEF, "getAndSetAcquire int value");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndSetRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 0x89ABCDEF, "getAndSetRelease int value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( 0xCAFEBABE);
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(0xCAFEBABE);
|
||||
assertEquals(o, 0x01234567, "getAndAdd int");
|
||||
int c = (int) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(0xCAFEBABE);
|
||||
assertEquals(c, (int)(0x01234567 + 0xCAFEBABE + 0xCAFEBABE), "getAndAdd int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndAddAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndAddRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseOr int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseAnd int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseXor int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -558,21 +786,143 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndSet int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 0x89ABCDEF, "getAndSet int value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndSetAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 0x89ABCDEF, "getAndSetAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndSetRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 0x89ABCDEF, "getAndSetRelease int value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 0xCAFEBABE);
|
||||
assertEquals(o, 0x01234567, "getAndAdd int");
|
||||
int c = (int) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, 0xCAFEBABE);
|
||||
assertEquals(c, (int)(0x01234567 + 0xCAFEBABE + 0xCAFEBABE), "getAndAdd int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndAddAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndAddRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseOr int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseAnd int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseXor int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
|
||||
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, 0x89ABCDEF);
|
||||
assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -581,6 +931,7 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
|
||||
|
||||
final int i = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testArrayIndexOutOfBounds(Handles hs) throws Throwable {
|
||||
@ -624,6 +975,12 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
|
||||
int o = (int) hs.get(am).invokeExact(array, ci, 0xCAFEBABE);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
|
||||
checkIOOBE(am, () -> {
|
||||
int o = (int) hs.get(am).invokeExact(array, ci, 0xCAFEBABE);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,19 +255,122 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 0xDEADBEEFDEADBEEFL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long");
|
||||
long c = (long) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, 0xDEADBEEFDEADBEEFL);
|
||||
assertEquals(c, (long)(0x0123456789ABCDEFL + 0xDEADBEEFDEADBEEFL + 0xDEADBEEFDEADBEEFL), "getAndAdd long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndAddRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessLong recv, Handles hs) throws Throwable {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -402,25 +505,150 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_SET).invokeExact( 0xCAFEBABECAFEBABEL);
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_SET).invokeExact(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndSetAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetAcquire long value");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndSetRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetRelease long value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( 0xDEADBEEFDEADBEEFL);
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(0xDEADBEEFDEADBEEFL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long");
|
||||
long c = (long) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(0xDEADBEEFDEADBEEFL);
|
||||
assertEquals(c, (long)(0x0123456789ABCDEFL + 0xDEADBEEFDEADBEEFL + 0xDEADBEEFDEADBEEFL), "getAndAdd long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndAddRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -558,21 +786,143 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndSetAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndSetRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetRelease long value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 0xDEADBEEFDEADBEEFL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long");
|
||||
long c = (long) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, 0xDEADBEEFDEADBEEFL);
|
||||
assertEquals(c, (long)(0x0123456789ABCDEFL + 0xDEADBEEFDEADBEEFL + 0xDEADBEEFDEADBEEFL), "getAndAdd long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndAddRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
|
||||
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -581,6 +931,7 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
|
||||
|
||||
final int i = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testArrayIndexOutOfBounds(Handles hs) throws Throwable {
|
||||
@ -624,6 +975,12 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
|
||||
long o = (long) hs.get(am).invokeExact(array, ci, 0xDEADBEEFDEADBEEFL);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
|
||||
checkIOOBE(am, () -> {
|
||||
long o = (long) hs.get(am).invokeExact(array, ci, 0xDEADBEEFDEADBEEFL);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,19 +255,122 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
|
||||
assertEquals(x, (short)0x4567, "getAndSet short value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, (short)0x89AB);
|
||||
assertEquals(o, (short)0x0123, "getAndAdd short");
|
||||
short c = (short) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, (short)0x89AB);
|
||||
assertEquals(c, (short)((short)0x0123 + (short)0x89AB + (short)0x89AB), "getAndAdd short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndAddAcquire short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndAddRelease short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseOr short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseAnd short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseXor short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessShort recv, Handles hs) throws Throwable {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -402,25 +505,150 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_SET).invokeExact( (short)0x4567);
|
||||
hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_SET).invokeExact((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndSet short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (short)0x4567, "getAndSet short value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndSetAcquire short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (short)0x4567, "getAndSetAcquire short value");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndSetRelease short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (short)0x4567, "getAndSetRelease short value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( (short)0x89AB);
|
||||
hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_ADD).invokeExact((short)0x89AB);
|
||||
assertEquals(o, (short)0x0123, "getAndAdd short");
|
||||
short c = (short) hs.get(TestAccessMode.ADD_AND_GET).invokeExact((short)0x89AB);
|
||||
assertEquals(c, (short)((short)0x0123 + (short)0x89AB + (short)0x89AB), "getAndAdd short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndAddAcquire short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndAddRelease short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseOr short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseAnd short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseXor short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact((short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value");
|
||||
}
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -558,21 +786,143 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndSet short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (short)0x4567, "getAndSet short value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndSetAcquire short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (short)0x4567, "getAndSetAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndSetRelease short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (short)0x4567, "getAndSetRelease short value");
|
||||
}
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, (short)0x89AB);
|
||||
assertEquals(o, (short)0x0123, "getAndAdd short");
|
||||
short c = (short) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, (short)0x89AB);
|
||||
assertEquals(c, (short)((short)0x0123 + (short)0x89AB + (short)0x89AB), "getAndAdd short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndAddAcquire short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndAddRelease short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value");
|
||||
}
|
||||
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseOr short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseAnd short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseXor short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
|
||||
|
||||
short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, (short)0x4567);
|
||||
assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short");
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -581,6 +931,7 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
|
||||
|
||||
final int i = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testArrayIndexOutOfBounds(Handles hs) throws Throwable {
|
||||
@ -624,6 +975,12 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
|
||||
short o = (short) hs.get(am).invokeExact(array, ci, (short)0x89AB);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
|
||||
checkIOOBE(am, () -> {
|
||||
short o = (short) hs.get(am).invokeExact(array, ci, (short)0x89AB);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,6 +255,7 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
|
||||
assertEquals(x, "bar", "getAndSet String value");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessString recv, Handles hs) throws Throwable {
|
||||
@ -264,6 +265,12 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
|
||||
String r = (String) hs.get(am).invokeExact(recv, "foo");
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
|
||||
checkUOE(am, () -> {
|
||||
String r = (String) hs.get(am).invokeExact(recv, "foo");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -398,12 +405,35 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
String o = (String) hs.get(TestAccessMode.GET_AND_SET).invokeExact( "bar");
|
||||
hs.get(TestAccessMode.SET).invokeExact("foo");
|
||||
|
||||
String o = (String) hs.get(TestAccessMode.GET_AND_SET).invokeExact("bar");
|
||||
assertEquals(o, "foo", "getAndSet String");
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, "bar", "getAndSet String value");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact("foo");
|
||||
|
||||
String o = (String) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact("bar");
|
||||
assertEquals(o, "foo", "getAndSetAcquire String");
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, "bar", "getAndSetAcquire String value");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact("foo");
|
||||
|
||||
String o = (String) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact("bar");
|
||||
assertEquals(o, "foo", "getAndSetRelease String");
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, "bar", "getAndSetRelease String value");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
|
||||
@ -413,6 +443,12 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
|
||||
String r = (String) hs.get(am).invokeExact("foo");
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
|
||||
checkUOE(am, () -> {
|
||||
String r = (String) hs.get(am).invokeExact("foo");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -550,12 +586,33 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, "foo");
|
||||
|
||||
String o = (String) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, "bar");
|
||||
assertEquals(o, "foo", "getAndSet String");
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, "bar", "getAndSet String value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, "foo");
|
||||
|
||||
String o = (String) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, "bar");
|
||||
assertEquals(o, "foo", "getAndSetAcquire String");
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, "bar", "getAndSetAcquire String value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, "foo");
|
||||
|
||||
String o = (String) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, "bar");
|
||||
assertEquals(o, "foo", "getAndSetRelease String");
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, "bar", "getAndSetRelease String value");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -569,6 +626,12 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
|
||||
String o = (String) hs.get(am).invokeExact(array, i, "foo");
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
|
||||
checkUOE(am, () -> {
|
||||
String o = (String) hs.get(am).invokeExact(array, i, "foo");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
static void testArrayIndexOutOfBounds(Handles hs) throws Throwable {
|
||||
@ -607,6 +670,7 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -582,6 +582,64 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
|
||||
double x = (double) vh.getAndSet(recv, 1.0d, Void.class);
|
||||
});
|
||||
|
||||
// GetAndSetAcquire
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
double x = (double) vh.getAndSetAcquire(null, 1.0d);
|
||||
});
|
||||
checkCCE(() -> { // receiver reference class
|
||||
double x = (double) vh.getAndSetAcquire(Void.class, 1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // value reference class
|
||||
double x = (double) vh.getAndSetAcquire(recv, Void.class);
|
||||
});
|
||||
checkWMTE(() -> { // reciever primitive class
|
||||
double x = (double) vh.getAndSetAcquire(0, 1.0d);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndSetAcquire(recv, 1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndSetAcquire(recv, 1.0d);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
double x = (double) vh.getAndSetAcquire();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
double x = (double) vh.getAndSetAcquire(recv, 1.0d, Void.class);
|
||||
});
|
||||
|
||||
// GetAndSetRelease
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
double x = (double) vh.getAndSetRelease(null, 1.0d);
|
||||
});
|
||||
checkCCE(() -> { // receiver reference class
|
||||
double x = (double) vh.getAndSetRelease(Void.class, 1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // value reference class
|
||||
double x = (double) vh.getAndSetRelease(recv, Void.class);
|
||||
});
|
||||
checkWMTE(() -> { // reciever primitive class
|
||||
double x = (double) vh.getAndSetRelease(0, 1.0d);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndSetRelease(recv, 1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndSetRelease(recv, 1.0d);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
double x = (double) vh.getAndSetRelease();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
double x = (double) vh.getAndSetRelease(recv, 1.0d, Void.class);
|
||||
});
|
||||
|
||||
// GetAndAdd
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
@ -611,6 +669,63 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
|
||||
double x = (double) vh.getAndAdd(recv, 1.0d, Void.class);
|
||||
});
|
||||
|
||||
// GetAndAddAcquire
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
double x = (double) vh.getAndAddAcquire(null, 1.0d);
|
||||
});
|
||||
checkCCE(() -> { // receiver reference class
|
||||
double x = (double) vh.getAndAddAcquire(Void.class, 1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // value reference class
|
||||
double x = (double) vh.getAndAddAcquire(recv, Void.class);
|
||||
});
|
||||
checkWMTE(() -> { // reciever primitive class
|
||||
double x = (double) vh.getAndAddAcquire(0, 1.0d);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndAddAcquire(recv, 1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndAddAcquire(recv, 1.0d);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
double x = (double) vh.getAndAddAcquire();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
double x = (double) vh.getAndAddAcquire(recv, 1.0d, Void.class);
|
||||
});
|
||||
|
||||
// GetAndAddRelease
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
double x = (double) vh.getAndAddRelease(null, 1.0d);
|
||||
});
|
||||
checkCCE(() -> { // receiver reference class
|
||||
double x = (double) vh.getAndAddRelease(Void.class, 1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // value reference class
|
||||
double x = (double) vh.getAndAddRelease(recv, Void.class);
|
||||
});
|
||||
checkWMTE(() -> { // reciever primitive class
|
||||
double x = (double) vh.getAndAddRelease(0, 1.0d);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndAddRelease(recv, 1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndAddRelease(recv, 1.0d);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
double x = (double) vh.getAndAddRelease();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
double x = (double) vh.getAndAddRelease(recv, 1.0d, Void.class);
|
||||
});
|
||||
|
||||
// AddAndGet
|
||||
// Incorrect argument types
|
||||
@ -640,6 +755,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
|
||||
checkWMTE(() -> { // >
|
||||
double x = (double) vh.addAndGet(recv, 1.0d, Void.class);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeDouble recv, Handles hs) throws Throwable {
|
||||
@ -853,6 +969,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
|
||||
invokeExact(recv, 1.0d, Void.class);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1143,6 +1260,48 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
|
||||
double x = (double) vh.getAndSet(1.0d, Void.class);
|
||||
});
|
||||
|
||||
|
||||
// GetAndSetAcquire
|
||||
// Incorrect argument types
|
||||
checkWMTE(() -> { // value reference class
|
||||
double x = (double) vh.getAndSetAcquire(Void.class);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndSetAcquire(1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndSetAcquire(1.0d);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
double x = (double) vh.getAndSetAcquire();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
double x = (double) vh.getAndSetAcquire(1.0d, Void.class);
|
||||
});
|
||||
|
||||
|
||||
// GetAndSetRelease
|
||||
// Incorrect argument types
|
||||
checkWMTE(() -> { // value reference class
|
||||
double x = (double) vh.getAndSetRelease(Void.class);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndSetRelease(1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndSetRelease(1.0d);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
double x = (double) vh.getAndSetRelease();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
double x = (double) vh.getAndSetRelease(1.0d, Void.class);
|
||||
});
|
||||
|
||||
// GetAndAdd
|
||||
// Incorrect argument types
|
||||
checkWMTE(() -> { // value reference class
|
||||
@ -1164,6 +1323,48 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
|
||||
// GetAndAddAcquire
|
||||
// Incorrect argument types
|
||||
checkWMTE(() -> { // value reference class
|
||||
double x = (double) vh.getAndAddAcquire(Void.class);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndAddAcquire(1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndAddAcquire(1.0d);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
double x = (double) vh.getAndAddAcquire();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
double x = (double) vh.getAndAddAcquire(1.0d, Void.class);
|
||||
});
|
||||
|
||||
|
||||
// GetAndAddRelease
|
||||
// Incorrect argument types
|
||||
checkWMTE(() -> { // value reference class
|
||||
double x = (double) vh.getAndAddRelease(Void.class);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndAddRelease(1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndAddRelease(1.0d);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
double x = (double) vh.getAndAddRelease();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
double x = (double) vh.getAndAddRelease(1.0d, Void.class);
|
||||
});
|
||||
|
||||
|
||||
// AddAndGet
|
||||
// Incorrect argument types
|
||||
checkWMTE(() -> { // value reference class
|
||||
@ -1183,6 +1384,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
|
||||
checkWMTE(() -> { // >
|
||||
double x = (double) vh.addAndGet(1.0d, Void.class);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
|
||||
@ -1322,6 +1524,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
|
||||
invokeExact(1.0d, Void.class);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1838,6 +2041,72 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
|
||||
double x = (double) vh.getAndSet(array, 0, 1.0d, Void.class);
|
||||
});
|
||||
|
||||
|
||||
// GetAndSetAcquire
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
double x = (double) vh.getAndSetAcquire(null, 0, 1.0d);
|
||||
});
|
||||
checkCCE(() -> { // array reference class
|
||||
double x = (double) vh.getAndSetAcquire(Void.class, 0, 1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // value reference class
|
||||
double x = (double) vh.getAndSetAcquire(array, 0, Void.class);
|
||||
});
|
||||
checkWMTE(() -> { // reciarrayever primitive class
|
||||
double x = (double) vh.getAndSetAcquire(0, 0, 1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // index reference class
|
||||
double x = (double) vh.getAndSetAcquire(array, Void.class, 1.0d);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndSetAcquire(array, 0, 1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndSetAcquire(array, 0, 1.0d);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
double x = (double) vh.getAndSetAcquire();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
double x = (double) vh.getAndSetAcquire(array, 0, 1.0d, Void.class);
|
||||
});
|
||||
|
||||
|
||||
// GetAndSetRelease
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
double x = (double) vh.getAndSetRelease(null, 0, 1.0d);
|
||||
});
|
||||
checkCCE(() -> { // array reference class
|
||||
double x = (double) vh.getAndSetRelease(Void.class, 0, 1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // value reference class
|
||||
double x = (double) vh.getAndSetRelease(array, 0, Void.class);
|
||||
});
|
||||
checkWMTE(() -> { // reciarrayever primitive class
|
||||
double x = (double) vh.getAndSetRelease(0, 0, 1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // index reference class
|
||||
double x = (double) vh.getAndSetRelease(array, Void.class, 1.0d);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndSetRelease(array, 0, 1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndSetRelease(array, 0, 1.0d);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
double x = (double) vh.getAndSetRelease();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
double x = (double) vh.getAndSetRelease(array, 0, 1.0d, Void.class);
|
||||
});
|
||||
|
||||
// GetAndAdd
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
@ -1871,6 +2140,72 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
|
||||
// GetAndAddAcquire
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
double x = (double) vh.getAndAddAcquire(null, 0, 1.0d);
|
||||
});
|
||||
checkCCE(() -> { // array reference class
|
||||
double x = (double) vh.getAndAddAcquire(Void.class, 0, 1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // value reference class
|
||||
double x = (double) vh.getAndAddAcquire(array, 0, Void.class);
|
||||
});
|
||||
checkWMTE(() -> { // array primitive class
|
||||
double x = (double) vh.getAndAddAcquire(0, 0, 1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // index reference class
|
||||
double x = (double) vh.getAndAddAcquire(array, Void.class, 1.0d);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndAddAcquire(array, 0, 1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndAddAcquire(array, 0, 1.0d);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
double x = (double) vh.getAndAddAcquire();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
double x = (double) vh.getAndAddAcquire(array, 0, 1.0d, Void.class);
|
||||
});
|
||||
|
||||
|
||||
// GetAndAddRelease
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
double x = (double) vh.getAndAddRelease(null, 0, 1.0d);
|
||||
});
|
||||
checkCCE(() -> { // array reference class
|
||||
double x = (double) vh.getAndAddRelease(Void.class, 0, 1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // value reference class
|
||||
double x = (double) vh.getAndAddRelease(array, 0, Void.class);
|
||||
});
|
||||
checkWMTE(() -> { // array primitive class
|
||||
double x = (double) vh.getAndAddRelease(0, 0, 1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // index reference class
|
||||
double x = (double) vh.getAndAddRelease(array, Void.class, 1.0d);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndAddRelease(array, 0, 1.0d);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndAddRelease(array, 0, 1.0d);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
double x = (double) vh.getAndAddRelease();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
double x = (double) vh.getAndAddRelease(array, 0, 1.0d, Void.class);
|
||||
});
|
||||
|
||||
|
||||
// AddAndGet
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
@ -1902,6 +2237,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
|
||||
checkWMTE(() -> { // >
|
||||
double x = (double) vh.addAndGet(array, 0, 1.0d, Void.class);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
static void testArrayWrongMethodType(Handles hs) throws Throwable {
|
||||
@ -2144,6 +2480,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
|
||||
invokeExact(array, 0, 1.0d, Void.class);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -582,6 +582,64 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
|
||||
float x = (float) vh.getAndSet(recv, 1.0f, Void.class);
|
||||
});
|
||||
|
||||
// GetAndSetAcquire
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
float x = (float) vh.getAndSetAcquire(null, 1.0f);
|
||||
});
|
||||
checkCCE(() -> { // receiver reference class
|
||||
float x = (float) vh.getAndSetAcquire(Void.class, 1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // value reference class
|
||||
float x = (float) vh.getAndSetAcquire(recv, Void.class);
|
||||
});
|
||||
checkWMTE(() -> { // reciever primitive class
|
||||
float x = (float) vh.getAndSetAcquire(0, 1.0f);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndSetAcquire(recv, 1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndSetAcquire(recv, 1.0f);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
float x = (float) vh.getAndSetAcquire();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
float x = (float) vh.getAndSetAcquire(recv, 1.0f, Void.class);
|
||||
});
|
||||
|
||||
// GetAndSetRelease
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
float x = (float) vh.getAndSetRelease(null, 1.0f);
|
||||
});
|
||||
checkCCE(() -> { // receiver reference class
|
||||
float x = (float) vh.getAndSetRelease(Void.class, 1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // value reference class
|
||||
float x = (float) vh.getAndSetRelease(recv, Void.class);
|
||||
});
|
||||
checkWMTE(() -> { // reciever primitive class
|
||||
float x = (float) vh.getAndSetRelease(0, 1.0f);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndSetRelease(recv, 1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndSetRelease(recv, 1.0f);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
float x = (float) vh.getAndSetRelease();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
float x = (float) vh.getAndSetRelease(recv, 1.0f, Void.class);
|
||||
});
|
||||
|
||||
// GetAndAdd
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
@ -611,6 +669,63 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
|
||||
float x = (float) vh.getAndAdd(recv, 1.0f, Void.class);
|
||||
});
|
||||
|
||||
// GetAndAddAcquire
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
float x = (float) vh.getAndAddAcquire(null, 1.0f);
|
||||
});
|
||||
checkCCE(() -> { // receiver reference class
|
||||
float x = (float) vh.getAndAddAcquire(Void.class, 1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // value reference class
|
||||
float x = (float) vh.getAndAddAcquire(recv, Void.class);
|
||||
});
|
||||
checkWMTE(() -> { // reciever primitive class
|
||||
float x = (float) vh.getAndAddAcquire(0, 1.0f);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndAddAcquire(recv, 1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndAddAcquire(recv, 1.0f);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
float x = (float) vh.getAndAddAcquire();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
float x = (float) vh.getAndAddAcquire(recv, 1.0f, Void.class);
|
||||
});
|
||||
|
||||
// GetAndAddRelease
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
float x = (float) vh.getAndAddRelease(null, 1.0f);
|
||||
});
|
||||
checkCCE(() -> { // receiver reference class
|
||||
float x = (float) vh.getAndAddRelease(Void.class, 1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // value reference class
|
||||
float x = (float) vh.getAndAddRelease(recv, Void.class);
|
||||
});
|
||||
checkWMTE(() -> { // reciever primitive class
|
||||
float x = (float) vh.getAndAddRelease(0, 1.0f);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndAddRelease(recv, 1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndAddRelease(recv, 1.0f);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
float x = (float) vh.getAndAddRelease();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
float x = (float) vh.getAndAddRelease(recv, 1.0f, Void.class);
|
||||
});
|
||||
|
||||
// AddAndGet
|
||||
// Incorrect argument types
|
||||
@ -640,6 +755,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
|
||||
checkWMTE(() -> { // >
|
||||
float x = (float) vh.addAndGet(recv, 1.0f, Void.class);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeFloat recv, Handles hs) throws Throwable {
|
||||
@ -853,6 +969,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
|
||||
invokeExact(recv, 1.0f, Void.class);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1143,6 +1260,48 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
|
||||
float x = (float) vh.getAndSet(1.0f, Void.class);
|
||||
});
|
||||
|
||||
|
||||
// GetAndSetAcquire
|
||||
// Incorrect argument types
|
||||
checkWMTE(() -> { // value reference class
|
||||
float x = (float) vh.getAndSetAcquire(Void.class);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndSetAcquire(1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndSetAcquire(1.0f);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
float x = (float) vh.getAndSetAcquire();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
float x = (float) vh.getAndSetAcquire(1.0f, Void.class);
|
||||
});
|
||||
|
||||
|
||||
// GetAndSetRelease
|
||||
// Incorrect argument types
|
||||
checkWMTE(() -> { // value reference class
|
||||
float x = (float) vh.getAndSetRelease(Void.class);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndSetRelease(1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndSetRelease(1.0f);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
float x = (float) vh.getAndSetRelease();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
float x = (float) vh.getAndSetRelease(1.0f, Void.class);
|
||||
});
|
||||
|
||||
// GetAndAdd
|
||||
// Incorrect argument types
|
||||
checkWMTE(() -> { // value reference class
|
||||
@ -1164,6 +1323,48 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
|
||||
// GetAndAddAcquire
|
||||
// Incorrect argument types
|
||||
checkWMTE(() -> { // value reference class
|
||||
float x = (float) vh.getAndAddAcquire(Void.class);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndAddAcquire(1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndAddAcquire(1.0f);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
float x = (float) vh.getAndAddAcquire();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
float x = (float) vh.getAndAddAcquire(1.0f, Void.class);
|
||||
});
|
||||
|
||||
|
||||
// GetAndAddRelease
|
||||
// Incorrect argument types
|
||||
checkWMTE(() -> { // value reference class
|
||||
float x = (float) vh.getAndAddRelease(Void.class);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndAddRelease(1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndAddRelease(1.0f);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
float x = (float) vh.getAndAddRelease();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
float x = (float) vh.getAndAddRelease(1.0f, Void.class);
|
||||
});
|
||||
|
||||
|
||||
// AddAndGet
|
||||
// Incorrect argument types
|
||||
checkWMTE(() -> { // value reference class
|
||||
@ -1183,6 +1384,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
|
||||
checkWMTE(() -> { // >
|
||||
float x = (float) vh.addAndGet(1.0f, Void.class);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
|
||||
@ -1322,6 +1524,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
|
||||
invokeExact(1.0f, Void.class);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1838,6 +2041,72 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
|
||||
float x = (float) vh.getAndSet(array, 0, 1.0f, Void.class);
|
||||
});
|
||||
|
||||
|
||||
// GetAndSetAcquire
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
float x = (float) vh.getAndSetAcquire(null, 0, 1.0f);
|
||||
});
|
||||
checkCCE(() -> { // array reference class
|
||||
float x = (float) vh.getAndSetAcquire(Void.class, 0, 1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // value reference class
|
||||
float x = (float) vh.getAndSetAcquire(array, 0, Void.class);
|
||||
});
|
||||
checkWMTE(() -> { // reciarrayever primitive class
|
||||
float x = (float) vh.getAndSetAcquire(0, 0, 1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // index reference class
|
||||
float x = (float) vh.getAndSetAcquire(array, Void.class, 1.0f);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndSetAcquire(array, 0, 1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndSetAcquire(array, 0, 1.0f);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
float x = (float) vh.getAndSetAcquire();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
float x = (float) vh.getAndSetAcquire(array, 0, 1.0f, Void.class);
|
||||
});
|
||||
|
||||
|
||||
// GetAndSetRelease
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
float x = (float) vh.getAndSetRelease(null, 0, 1.0f);
|
||||
});
|
||||
checkCCE(() -> { // array reference class
|
||||
float x = (float) vh.getAndSetRelease(Void.class, 0, 1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // value reference class
|
||||
float x = (float) vh.getAndSetRelease(array, 0, Void.class);
|
||||
});
|
||||
checkWMTE(() -> { // reciarrayever primitive class
|
||||
float x = (float) vh.getAndSetRelease(0, 0, 1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // index reference class
|
||||
float x = (float) vh.getAndSetRelease(array, Void.class, 1.0f);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndSetRelease(array, 0, 1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndSetRelease(array, 0, 1.0f);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
float x = (float) vh.getAndSetRelease();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
float x = (float) vh.getAndSetRelease(array, 0, 1.0f, Void.class);
|
||||
});
|
||||
|
||||
// GetAndAdd
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
@ -1871,6 +2140,72 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
|
||||
});
|
||||
|
||||
|
||||
// GetAndAddAcquire
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
float x = (float) vh.getAndAddAcquire(null, 0, 1.0f);
|
||||
});
|
||||
checkCCE(() -> { // array reference class
|
||||
float x = (float) vh.getAndAddAcquire(Void.class, 0, 1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // value reference class
|
||||
float x = (float) vh.getAndAddAcquire(array, 0, Void.class);
|
||||
});
|
||||
checkWMTE(() -> { // array primitive class
|
||||
float x = (float) vh.getAndAddAcquire(0, 0, 1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // index reference class
|
||||
float x = (float) vh.getAndAddAcquire(array, Void.class, 1.0f);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndAddAcquire(array, 0, 1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndAddAcquire(array, 0, 1.0f);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
float x = (float) vh.getAndAddAcquire();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
float x = (float) vh.getAndAddAcquire(array, 0, 1.0f, Void.class);
|
||||
});
|
||||
|
||||
|
||||
// GetAndAddRelease
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
float x = (float) vh.getAndAddRelease(null, 0, 1.0f);
|
||||
});
|
||||
checkCCE(() -> { // array reference class
|
||||
float x = (float) vh.getAndAddRelease(Void.class, 0, 1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // value reference class
|
||||
float x = (float) vh.getAndAddRelease(array, 0, Void.class);
|
||||
});
|
||||
checkWMTE(() -> { // array primitive class
|
||||
float x = (float) vh.getAndAddRelease(0, 0, 1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // index reference class
|
||||
float x = (float) vh.getAndAddRelease(array, Void.class, 1.0f);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndAddRelease(array, 0, 1.0f);
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndAddRelease(array, 0, 1.0f);
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
float x = (float) vh.getAndAddRelease();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
float x = (float) vh.getAndAddRelease(array, 0, 1.0f, Void.class);
|
||||
});
|
||||
|
||||
|
||||
// AddAndGet
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
@ -1902,6 +2237,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
|
||||
checkWMTE(() -> { // >
|
||||
float x = (float) vh.addAndGet(array, 0, 1.0f, Void.class);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
static void testArrayWrongMethodType(Handles hs) throws Throwable {
|
||||
@ -2144,6 +2480,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
|
||||
invokeExact(array, 0, 1.0f, Void.class);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -582,6 +582,65 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
String x = (String) vh.getAndSet(recv, "foo", Void.class);
|
||||
});
|
||||
|
||||
// GetAndSetAcquire
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
String x = (String) vh.getAndSetAcquire(null, "foo");
|
||||
});
|
||||
checkCCE(() -> { // receiver reference class
|
||||
String x = (String) vh.getAndSetAcquire(Void.class, "foo");
|
||||
});
|
||||
checkCCE(() -> { // value reference class
|
||||
String x = (String) vh.getAndSetAcquire(recv, Void.class);
|
||||
});
|
||||
checkWMTE(() -> { // reciever primitive class
|
||||
String x = (String) vh.getAndSetAcquire(0, "foo");
|
||||
});
|
||||
// Incorrect return type
|
||||
checkCCE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndSetAcquire(recv, "foo");
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndSetAcquire(recv, "foo");
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
String x = (String) vh.getAndSetAcquire();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
String x = (String) vh.getAndSetAcquire(recv, "foo", Void.class);
|
||||
});
|
||||
|
||||
// GetAndSetRelease
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
String x = (String) vh.getAndSetRelease(null, "foo");
|
||||
});
|
||||
checkCCE(() -> { // receiver reference class
|
||||
String x = (String) vh.getAndSetRelease(Void.class, "foo");
|
||||
});
|
||||
checkCCE(() -> { // value reference class
|
||||
String x = (String) vh.getAndSetRelease(recv, Void.class);
|
||||
});
|
||||
checkWMTE(() -> { // reciever primitive class
|
||||
String x = (String) vh.getAndSetRelease(0, "foo");
|
||||
});
|
||||
// Incorrect return type
|
||||
checkCCE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndSetRelease(recv, "foo");
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndSetRelease(recv, "foo");
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
String x = (String) vh.getAndSetRelease();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
String x = (String) vh.getAndSetRelease(recv, "foo", Void.class);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeString recv, Handles hs) throws Throwable {
|
||||
@ -759,6 +818,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1049,6 +1109,49 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
String x = (String) vh.getAndSet("foo", Void.class);
|
||||
});
|
||||
|
||||
|
||||
// GetAndSetAcquire
|
||||
// Incorrect argument types
|
||||
checkCCE(() -> { // value reference class
|
||||
String x = (String) vh.getAndSetAcquire(Void.class);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkCCE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndSetAcquire("foo");
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndSetAcquire("foo");
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
String x = (String) vh.getAndSetAcquire();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
String x = (String) vh.getAndSetAcquire("foo", Void.class);
|
||||
});
|
||||
|
||||
|
||||
// GetAndSetRelease
|
||||
// Incorrect argument types
|
||||
checkCCE(() -> { // value reference class
|
||||
String x = (String) vh.getAndSetRelease(Void.class);
|
||||
});
|
||||
// Incorrect return type
|
||||
checkCCE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndSetRelease("foo");
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndSetRelease("foo");
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
String x = (String) vh.getAndSetRelease();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
String x = (String) vh.getAndSetRelease("foo", Void.class);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
|
||||
@ -1163,6 +1266,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1679,6 +1783,73 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
String x = (String) vh.getAndSet(array, 0, "foo", Void.class);
|
||||
});
|
||||
|
||||
|
||||
// GetAndSetAcquire
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
String x = (String) vh.getAndSetAcquire(null, 0, "foo");
|
||||
});
|
||||
checkCCE(() -> { // array reference class
|
||||
String x = (String) vh.getAndSetAcquire(Void.class, 0, "foo");
|
||||
});
|
||||
checkCCE(() -> { // value reference class
|
||||
String x = (String) vh.getAndSetAcquire(array, 0, Void.class);
|
||||
});
|
||||
checkWMTE(() -> { // reciarrayever primitive class
|
||||
String x = (String) vh.getAndSetAcquire(0, 0, "foo");
|
||||
});
|
||||
checkWMTE(() -> { // index reference class
|
||||
String x = (String) vh.getAndSetAcquire(array, Void.class, "foo");
|
||||
});
|
||||
// Incorrect return type
|
||||
checkCCE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndSetAcquire(array, 0, "foo");
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndSetAcquire(array, 0, "foo");
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
String x = (String) vh.getAndSetAcquire();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
String x = (String) vh.getAndSetAcquire(array, 0, "foo", Void.class);
|
||||
});
|
||||
|
||||
|
||||
// GetAndSetRelease
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
String x = (String) vh.getAndSetRelease(null, 0, "foo");
|
||||
});
|
||||
checkCCE(() -> { // array reference class
|
||||
String x = (String) vh.getAndSetRelease(Void.class, 0, "foo");
|
||||
});
|
||||
checkCCE(() -> { // value reference class
|
||||
String x = (String) vh.getAndSetRelease(array, 0, Void.class);
|
||||
});
|
||||
checkWMTE(() -> { // reciarrayever primitive class
|
||||
String x = (String) vh.getAndSetRelease(0, 0, "foo");
|
||||
});
|
||||
checkWMTE(() -> { // index reference class
|
||||
String x = (String) vh.getAndSetRelease(array, Void.class, "foo");
|
||||
});
|
||||
// Incorrect return type
|
||||
checkCCE(() -> { // reference class
|
||||
Void r = (Void) vh.getAndSetRelease(array, 0, "foo");
|
||||
});
|
||||
checkWMTE(() -> { // primitive class
|
||||
boolean x = (boolean) vh.getAndSetRelease(array, 0, "foo");
|
||||
});
|
||||
// Incorrect arity
|
||||
checkWMTE(() -> { // 0
|
||||
String x = (String) vh.getAndSetRelease();
|
||||
});
|
||||
checkWMTE(() -> { // >
|
||||
String x = (String) vh.getAndSetRelease(array, 0, "foo", Void.class);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testArrayWrongMethodType(Handles hs) throws Throwable {
|
||||
@ -1880,6 +2051,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -109,6 +109,8 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE));
|
||||
#else[CAS]
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE));
|
||||
@ -119,15 +121,43 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE));
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
#else[AtomicAdd]
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[Bitwise]
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
|
||||
#else[Bitwise]
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
|
||||
#end[Bitwise]
|
||||
}
|
||||
|
||||
|
||||
@ -313,6 +343,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
|
||||
checkUOE(() -> {
|
||||
$type$ r = ($type$) vh.getAndSet(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ r = ($type$) vh.getAndSetAcquire(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ r = ($type$) vh.getAndSetRelease(recv, $value1$);
|
||||
});
|
||||
#end[CAS]
|
||||
|
||||
#if[!AtomicAdd]
|
||||
@ -320,10 +358,56 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
|
||||
$type$ o = ($type$) vh.getAndAdd(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddAcquire(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddRelease(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.addAndGet(recv, $value1$);
|
||||
});
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[!Bitwise]
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOr(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrAcquire(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrRelease(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAnd(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndAcquire(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndRelease(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXor(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorAcquire(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorRelease(recv, $value1$);
|
||||
});
|
||||
#end[Bitwise]
|
||||
}
|
||||
|
||||
|
||||
@ -407,6 +491,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
|
||||
checkUOE(() -> {
|
||||
$type$ r = ($type$) vh.getAndSet($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ r = ($type$) vh.getAndSetAcquire($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ r = ($type$) vh.getAndSetRelease($value1$);
|
||||
});
|
||||
#end[CAS]
|
||||
|
||||
#if[!AtomicAdd]
|
||||
@ -414,10 +506,56 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
|
||||
$type$ o = ($type$) vh.getAndAdd($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddAcquire($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddRelease($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.addAndGet($value1$);
|
||||
});
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[!Bitwise]
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOr($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrAcquire($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrRelease($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAnd($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndAcquire($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndRelease($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXor($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorAcquire($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorRelease($value1$);
|
||||
});
|
||||
#end[Bitwise]
|
||||
}
|
||||
|
||||
|
||||
@ -553,24 +691,148 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndSet(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndSet $type$");
|
||||
$type$ x = ($type$) vh.get(recv);
|
||||
assertEquals(x, $value2$, "getAndSet $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndSetAcquire(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndSetAcquire $type$");
|
||||
$type$ x = ($type$) vh.get(recv);
|
||||
assertEquals(x, $value2$, "getAndSetAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndSetRelease(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndSetRelease $type$");
|
||||
$type$ x = ($type$) vh.get(recv);
|
||||
assertEquals(x, $value2$, "getAndSetRelease $type$ value");
|
||||
}
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
vh.set(recv, $value1$);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndAdd(recv, $value3$);
|
||||
assertEquals(o, $value1$, "getAndAdd $type$");
|
||||
$type$ c = ($type$) vh.addAndGet(recv, $value3$);
|
||||
assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndAddAcquire(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndAddAcquire $type$");
|
||||
$type$ x = ($type$) vh.get(recv);
|
||||
assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndAddRelease(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndAddRelease$type$");
|
||||
$type$ x = ($type$) vh.get(recv);
|
||||
assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value");
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[Bitwise]
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseOr(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseOr $type$");
|
||||
$type$ x = ($type$) vh.get(recv);
|
||||
assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrAcquire(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$");
|
||||
$type$ x = ($type$) vh.get(recv);
|
||||
assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrRelease(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$");
|
||||
$type$ x = ($type$) vh.get(recv);
|
||||
assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseAnd(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseAnd $type$");
|
||||
$type$ x = ($type$) vh.get(recv);
|
||||
assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndAcquire(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$");
|
||||
$type$ x = ($type$) vh.get(recv);
|
||||
assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndRelease(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$");
|
||||
$type$ x = ($type$) vh.get(recv);
|
||||
assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseXor(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseXor $type$");
|
||||
$type$ x = ($type$) vh.get(recv);
|
||||
assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorAcquire(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$");
|
||||
$type$ x = ($type$) vh.get(recv);
|
||||
assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorRelease(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$");
|
||||
$type$ x = ($type$) vh.get(recv);
|
||||
assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value");
|
||||
}
|
||||
#end[Bitwise]
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestAccess$Type$ recv, VarHandle vh) {
|
||||
@ -610,6 +872,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
|
||||
checkUOE(() -> {
|
||||
$type$ r = ($type$) vh.getAndSet(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ r = ($type$) vh.getAndSetAcquire(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ r = ($type$) vh.getAndSetRelease(recv, $value1$);
|
||||
});
|
||||
#end[CAS]
|
||||
|
||||
#if[!AtomicAdd]
|
||||
@ -617,10 +887,56 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
|
||||
$type$ o = ($type$) vh.getAndAdd(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddAcquire(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddRelease(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.addAndGet(recv, $value1$);
|
||||
});
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[!Bitwise]
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOr(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrAcquire(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrRelease(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAnd(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndAcquire(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndRelease(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXor(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorAcquire(recv, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorRelease(recv, $value1$);
|
||||
});
|
||||
#end[Bitwise]
|
||||
}
|
||||
|
||||
|
||||
@ -756,24 +1072,148 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set($value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndSet($value2$);
|
||||
assertEquals(o, $value1$, "getAndSet $type$");
|
||||
$type$ x = ($type$) vh.get();
|
||||
assertEquals(x, $value2$, "getAndSet $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set($value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndSetAcquire($value2$);
|
||||
assertEquals(o, $value1$, "getAndSetAcquire $type$");
|
||||
$type$ x = ($type$) vh.get();
|
||||
assertEquals(x, $value2$, "getAndSetAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set($value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndSetRelease($value2$);
|
||||
assertEquals(o, $value1$, "getAndSetRelease $type$");
|
||||
$type$ x = ($type$) vh.get();
|
||||
assertEquals(x, $value2$, "getAndSetRelease $type$ value");
|
||||
}
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
vh.set($value1$);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set($value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndAdd( $value3$);
|
||||
assertEquals(o, $value1$, "getAndAdd $type$");
|
||||
$type$ c = ($type$) vh.addAndGet($value3$);
|
||||
assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set($value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndAddAcquire($value2$);
|
||||
assertEquals(o, $value1$, "getAndAddAcquire $type$");
|
||||
$type$ x = ($type$) vh.get();
|
||||
assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set($value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndAddRelease($value2$);
|
||||
assertEquals(o, $value1$, "getAndAddRelease$type$");
|
||||
$type$ x = ($type$) vh.get();
|
||||
assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value");
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[Bitwise]
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set($value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseOr($value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseOr $type$");
|
||||
$type$ x = ($type$) vh.get();
|
||||
assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set($value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrAcquire($value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$");
|
||||
$type$ x = ($type$) vh.get();
|
||||
assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set($value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrRelease($value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$");
|
||||
$type$ x = ($type$) vh.get();
|
||||
assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set($value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseAnd($value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseAnd $type$");
|
||||
$type$ x = ($type$) vh.get();
|
||||
assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set($value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndAcquire($value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$");
|
||||
$type$ x = ($type$) vh.get();
|
||||
assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set($value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndRelease($value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$");
|
||||
$type$ x = ($type$) vh.get();
|
||||
assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set($value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseXor($value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseXor $type$");
|
||||
$type$ x = ($type$) vh.get();
|
||||
assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set($value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorAcquire($value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$");
|
||||
$type$ x = ($type$) vh.get();
|
||||
assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set($value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorRelease($value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$");
|
||||
$type$ x = ($type$) vh.get();
|
||||
assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value");
|
||||
}
|
||||
#end[Bitwise]
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(VarHandle vh) {
|
||||
@ -813,6 +1253,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
|
||||
checkUOE(() -> {
|
||||
$type$ r = ($type$) vh.getAndSet($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ r = ($type$) vh.getAndSetAcquire($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ r = ($type$) vh.getAndSetRelease($value1$);
|
||||
});
|
||||
#end[CAS]
|
||||
|
||||
#if[!AtomicAdd]
|
||||
@ -820,10 +1268,56 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
|
||||
$type$ o = ($type$) vh.getAndAdd($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddAcquire($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddRelease($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.addAndGet($value1$);
|
||||
});
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[!Bitwise]
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOr($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrAcquire($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrRelease($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAnd($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndAcquire($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndRelease($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXor($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorAcquire($value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorRelease($value1$);
|
||||
});
|
||||
#end[Bitwise]
|
||||
}
|
||||
|
||||
|
||||
@ -962,24 +1456,148 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndSet(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndSet $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, $value2$, "getAndSet $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndSetAcquire(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndSetAcquire $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, $value2$, "getAndSetAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndSetRelease(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndSetRelease $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, $value2$, "getAndSetRelease $type$ value");
|
||||
}
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
vh.set(array, i, $value1$);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndAdd(array, i, $value3$);
|
||||
assertEquals(o, $value1$, "getAndAdd $type$");
|
||||
$type$ c = ($type$) vh.addAndGet(array, i, $value3$);
|
||||
assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndAddAcquire(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndAddAcquire $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndAddRelease(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndAddRelease$type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value");
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[Bitwise]
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseOr(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseOr $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrRelease(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseAnd(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseAnd $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndRelease(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseXor(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseXor $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorRelease(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value");
|
||||
}
|
||||
#end[Bitwise]
|
||||
}
|
||||
}
|
||||
|
||||
@ -1023,6 +1641,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
|
||||
checkUOE(() -> {
|
||||
$type$ r = ($type$) vh.getAndSet(array, i, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ r = ($type$) vh.getAndSetAcquire(array, i, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ r = ($type$) vh.getAndSetRelease(array, i, $value1$);
|
||||
});
|
||||
#end[CAS]
|
||||
|
||||
#if[!AtomicAdd]
|
||||
@ -1030,10 +1656,56 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
|
||||
$type$ o = ($type$) vh.getAndAdd(array, i, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddAcquire(array, i, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddRelease(array, i, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.addAndGet(array, i, $value1$);
|
||||
});
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[!Bitwise]
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOr(array, i, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, i, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrRelease(array, i, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAnd(array, i, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, i, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndRelease(array, i, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXor(array, i, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, i, $value1$);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorRelease(array, i, $value1$);
|
||||
});
|
||||
#end[Bitwise]
|
||||
}
|
||||
|
||||
static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable {
|
||||
@ -1110,17 +1782,71 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSet(array, ci, $value1$);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSetAcquire(array, ci, $value1$);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSetRelease(array, ci, $value1$);
|
||||
});
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAdd(array, ci, $value3$);
|
||||
$type$ o = ($type$) vh.getAndAdd(array, ci, $value1$);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.addAndGet(array, ci, $value3$);
|
||||
$type$ o = ($type$) vh.getAndAddAcquire(array, ci, $value1$);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddRelease(array, ci, $value1$);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.addAndGet(array, ci, $value1$);
|
||||
});
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[Bitwise]
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOr(array, ci, $value1$);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, $value1$);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, $value1$);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, $value1$);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, $value1$);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, $value1$);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXor(array, ci, $value1$);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, $value1$);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, $value1$);
|
||||
});
|
||||
#end[Bitwise]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,6 +98,8 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE));
|
||||
#else[CAS]
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE));
|
||||
@ -108,15 +110,43 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE));
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
#else[AtomicAdd]
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[Bitwise]
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
|
||||
#else[Bitwise]
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
|
||||
#end[Bitwise]
|
||||
}
|
||||
|
||||
@Test(dataProvider = "typesProvider")
|
||||
@ -237,6 +267,14 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
#end[CAS]
|
||||
|
||||
#if[!AtomicAdd]
|
||||
@ -244,10 +282,56 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
|
||||
$type$ o = ($type$) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[!Bitwise]
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
#end[Bitwise]
|
||||
}
|
||||
|
||||
static void testArrayUnsupported(ByteBufferSource bs, VarHandleSource vhs) {
|
||||
@ -312,6 +396,14 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
|
||||
$type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
#else[CAS]
|
||||
checkUOE(() -> {
|
||||
boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
|
||||
@ -348,6 +440,14 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
@ -355,6 +455,14 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
|
||||
$type$ o = ($type$) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
$type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
@ -363,10 +471,92 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
|
||||
$type$ o = ($type$) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[Bitwise]
|
||||
checkROBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkROBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
#else[Bitwise]
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
#end[Bitwise]
|
||||
}
|
||||
else {
|
||||
#if[!CAS]
|
||||
@ -405,16 +595,69 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
#end[CAS]
|
||||
#if[!AtomicAdd]
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
#end[AtomicAdd]
|
||||
#if[!Bitwise]
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkUOE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
#end[Bitwise]
|
||||
}
|
||||
}
|
||||
|
||||
@ -495,6 +738,14 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
@ -502,11 +753,57 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
|
||||
$type$ o = ($type$) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[Bitwise]
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
#end[Bitwise]
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -591,6 +888,14 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
@ -598,10 +903,56 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
|
||||
$type$ o = ($type$) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[Bitwise]
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkIOOBE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
#end[Bitwise]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -678,6 +1029,14 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
@ -685,11 +1044,56 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
|
||||
$type$ o = ($type$) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[Bitwise]
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
#end[Bitwise]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -768,6 +1172,14 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||
});
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
@ -775,10 +1187,56 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
|
||||
$type$ o = ($type$) vh.getAndAdd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1);
|
||||
});
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[Bitwise]
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
|
||||
});
|
||||
|
||||
checkISE(() -> {
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
|
||||
});
|
||||
#end[Bitwise]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -924,24 +1382,148 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndSet(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSet $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSet $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndSetAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSetAcquire $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSetAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndSetRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSetRelease $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSetRelease $type$ value");
|
||||
}
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndAdd(array, i, VALUE_3);
|
||||
assertEquals(o, VALUE_1, "getAndAdd $type$");
|
||||
$type$ c = ($type$) vh.addAndGet(array, i, VALUE_3);
|
||||
assertEquals(c, VALUE_1 + VALUE_3 + VALUE_3, "getAndAdd $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndAddAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndAddAcquire $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndAddRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndAddRelease $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease $type$ value");
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[Bitwise]
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseOr(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseOr $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseOrRelease $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease $type$ value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseAnd(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseAnd $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseAndRelease $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease $type$ value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseXor(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseXor $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseXorRelease $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease $type$ value");
|
||||
}
|
||||
#end[Bitwise]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1086,24 +1668,148 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndSet(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSet $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSet $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndSetAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSetAcquire $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSetAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndSetRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndSetRelease $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_2, "getAndSetRelease $type$ value");
|
||||
}
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndAdd(array, i, VALUE_3);
|
||||
assertEquals(o, VALUE_1, "getAndAdd $type$");
|
||||
$type$ c = ($type$) vh.addAndGet(array, i, VALUE_3);
|
||||
assertEquals(c, VALUE_1 + VALUE_3 + VALUE_3, "getAndAdd $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndAddAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndAddAcquire $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndAddRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndAddRelease $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease $type$ value");
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[Bitwise]
|
||||
// get and bitwise or
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseOr(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseOr $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseOrRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseOrRelease $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease $type$ value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseAnd(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseAnd $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseAndRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseAndRelease $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease $type$ value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseXor(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseXor $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
vh.set(array, i, VALUE_1);
|
||||
|
||||
$type$ o = ($type$) vh.getAndBitwiseXorRelease(array, i, VALUE_2);
|
||||
assertEquals(o, VALUE_1, "getAndBitwiseXorRelease $type$");
|
||||
$type$ x = ($type$) vh.get(array, i);
|
||||
assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease $type$ value");
|
||||
}
|
||||
#end[Bitwise]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,16 +258,120 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, $value3$);
|
||||
assertEquals(o, $value1$, "getAndAdd $type$");
|
||||
$type$ c = ($type$) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, $value3$);
|
||||
assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndAddAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndAddRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value");
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[Bitwise]
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseOr $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseAnd $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseXor $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value");
|
||||
}
|
||||
#end[Bitwise]
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccess$Type$ recv, Handles hs) throws Throwable {
|
||||
@ -298,6 +402,14 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[!Bitwise]
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
|
||||
checkUOE(am, () -> {
|
||||
$type$ r = ($type$) hs.get(am).invokeExact(recv, $value1$);
|
||||
});
|
||||
}
|
||||
#end[Bitwise]
|
||||
}
|
||||
|
||||
|
||||
@ -433,24 +545,150 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET).invokeExact( $value2$);
|
||||
hs.get(TestAccessMode.SET).invokeExact($value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET).invokeExact($value2$);
|
||||
assertEquals(o, $value1$, "getAndSet $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, $value2$, "getAndSet $type$ value");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact($value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact($value2$);
|
||||
assertEquals(o, $value1$, "getAndSetAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, $value2$, "getAndSetAcquire $type$ value");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact($value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact($value2$);
|
||||
assertEquals(o, $value1$, "getAndSetRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, $value2$, "getAndSetRelease $type$ value");
|
||||
}
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
hs.get(TestAccessMode.SET).invokeExact($value1$);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( $value3$);
|
||||
hs.get(TestAccessMode.SET).invokeExact($value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact($value3$);
|
||||
assertEquals(o, $value1$, "getAndAdd $type$");
|
||||
$type$ c = ($type$) hs.get(TestAccessMode.ADD_AND_GET).invokeExact($value3$);
|
||||
assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact($value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact($value2$);
|
||||
assertEquals(o, $value1$, "getAndAddAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact($value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact($value2$);
|
||||
assertEquals(o, $value1$, "getAndAddRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value");
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[Bitwise]
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact($value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact($value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseOr $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact($value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact($value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact($value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact($value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact($value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact($value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseAnd $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact($value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact($value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact($value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact($value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact($value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact($value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseXor $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact($value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact($value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact($value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact($value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value");
|
||||
}
|
||||
#end[Bitwise]
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
|
||||
@ -481,6 +719,14 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[!Bitwise]
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
|
||||
checkUOE(am, () -> {
|
||||
$type$ r = ($type$) hs.get(am).invokeExact($value1$);
|
||||
});
|
||||
}
|
||||
#end[Bitwise]
|
||||
}
|
||||
|
||||
|
||||
@ -619,24 +865,148 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndSet $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, $value2$, "getAndSet $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndSetAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, $value2$, "getAndSetAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndSetRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, $value2$, "getAndSetRelease $type$ value");
|
||||
}
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, $value3$);
|
||||
assertEquals(o, $value1$, "getAndAdd $type$");
|
||||
$type$ c = ($type$) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, $value3$);
|
||||
assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndAddAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndAddRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value");
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[Bitwise]
|
||||
// get and bitwise or
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseOr $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value");
|
||||
}
|
||||
|
||||
// get and bitwise and
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseAnd $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value");
|
||||
}
|
||||
|
||||
// get and bitwise xor
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseXor $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
|
||||
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, $value2$);
|
||||
assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value");
|
||||
}
|
||||
#end[Bitwise]
|
||||
}
|
||||
}
|
||||
|
||||
@ -671,6 +1041,14 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[!Bitwise]
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
|
||||
checkUOE(am, () -> {
|
||||
$type$ o = ($type$) hs.get(am).invokeExact(array, i, $value1$);
|
||||
});
|
||||
}
|
||||
#end[Bitwise]
|
||||
}
|
||||
|
||||
static void testArrayIndexOutOfBounds(Handles hs) throws Throwable {
|
||||
@ -718,6 +1096,14 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
|
||||
#if[Bitwise]
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
|
||||
checkIOOBE(am, () -> {
|
||||
$type$ o = ($type$) hs.get(am).invokeExact(array, ci, $value3$);
|
||||
});
|
||||
}
|
||||
#end[Bitwise]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -22,6 +22,12 @@ do
|
||||
;;
|
||||
esac
|
||||
|
||||
case $type in
|
||||
boolean|byte|short|char|int|long)
|
||||
args="$args -KBitwise"
|
||||
;;
|
||||
esac
|
||||
|
||||
wrong_primitive_type=boolean
|
||||
|
||||
case $type in
|
||||
@ -109,6 +115,12 @@ do
|
||||
;;
|
||||
esac
|
||||
|
||||
case $type in
|
||||
int|long)
|
||||
args="$args -KBitwise"
|
||||
;;
|
||||
esac
|
||||
|
||||
# The value of `value3` is chosen such that when added to `value1` or `value2`
|
||||
# it will result in carrying of bits over to the next byte, thereby detecting
|
||||
# possible errors in endianness conversion e.g. if say for atomic addition the
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user