8161444: VarHandles should provide access bitwise atomics
8162107: Add acquire/release variants for getAndSet and getAndAdd
Reviewed-by: shade, redestad
--- a/jdk/make/gensrc/GensrcVarHandles.gmk Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/make/gensrc/GensrcVarHandles.gmk Thu Sep 01 10:16:57 2016 -0700
@@ -44,6 +44,10 @@
$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 @@
$1_ARGS += -KCAS
$1_ARGS += -KAtomicAdd
+ $1_ARGS += -KBitwise
endif
ifeq ($$($1_Type), Long)
@@ -113,6 +118,7 @@
$1_ARGS += -KCAS
$1_ARGS += -KAtomicAdd
+ $1_ARGS += -KBitwise
endif
ifeq ($$($1_Type), Float)
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Thu Sep 01 10:16:57 2016 -0700
@@ -1207,11 +1207,16 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
* <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 @@
* 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 @@
* <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
--- a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java Thu Sep 01 10:16:57 2016 -0700
@@ -141,14 +141,32 @@
* {@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 @@
* 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 @@
@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
@@ -1025,6 +1108,72 @@
/**
* 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
* current (updated) value, as accessed with the memory semantics of
* {@link #getVolatile}.
@@ -1056,6 +1205,344 @@
@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),
@@ -1234,15 +1721,93 @@
/**
* 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;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template Thu Sep 01 10:16:57 2016 -0700
@@ -193,6 +193,20 @@
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]
@@ -204,12 +218,91 @@
}
@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)),
handle.fieldOffset,
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 @@
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]
@@ -385,12 +492,91 @@
}
@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,
handle.fieldOffset,
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 @@
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
{#if[Object]?handle.componentType.cast(value):value});
}
+
+ @ForceInline
+ 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) {
-#if[Object]
- Object[] array = (Object[]) handle.arrayType.cast(oarray);
-#else[Object]
$type$[] array = ($type$[]) oarray;
-#end[Object]
return UNSAFE.getAndAdd$Type$(array,
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
value);
}
@ForceInline
+ 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) {
-#if[Object]
- Object[] array = (Object[]) handle.arrayType.cast(oarray);
-#else[Object]
$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);
}
--- a/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template Thu Sep 01 10:16:57 2016 -0700
@@ -267,6 +267,26 @@
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]
@@ -284,6 +304,32 @@
}
@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;
long offset = address(ba, index(ba, index));
@@ -300,6 +346,161 @@
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 @@
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]
@@ -527,6 +748,32 @@
}
@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;
Object base = UNSAFE.getObject(bb, BYTE_BUFFER_HB);
@@ -544,6 +791,165 @@
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);
}
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java Thu Sep 01 10:16:57 2016 -0700
@@ -2278,6 +2278,24 @@
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 @@
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 @@
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;
@@ -2317,11 +2371,39 @@
}
@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;
float v;
@@ -2337,6 +2419,36 @@
}
@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;
double v;
@@ -2351,6 +2463,36 @@
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 @@
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 @@
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 @@
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;
@@ -2421,10 +2617,38 @@
}
@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;
@@ -2435,22 +2659,558 @@
}
@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".
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java Thu Sep 01 10:16:57 2016 -0700
@@ -132,7 +132,8 @@
COMPARE_AND_SET,
COMPARE_AND_EXCHANGE,
GET_AND_SET,
- GET_AND_ADD;
+ GET_AND_ADD,
+ GET_AND_BITWISE;
}
enum TestAccessMode {
@@ -153,8 +154,22 @@
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;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java Thu Sep 01 10:16:57 2016 -0700
@@ -108,9 +108,23 @@
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));
}
@@ -266,8 +280,17 @@
});
checkUOE(() -> {
+ boolean o = (boolean) vh.getAndAddAcquire(recv, true);
+ });
+
+ checkUOE(() -> {
+ boolean o = (boolean) vh.getAndAddRelease(recv, true);
+ });
+
+ checkUOE(() -> {
boolean o = (boolean) vh.addAndGet(recv, true);
});
+
}
@@ -321,8 +344,17 @@
});
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 @@
// 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) {
@@ -472,8 +608,17 @@
});
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 @@
// 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) {
@@ -623,8 +872,17 @@
});
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 @@
// 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");
+ }
}
}
@@ -781,8 +1143,17 @@
});
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 @@
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);
+ });
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java Thu Sep 01 10:16:57 2016 -0700
@@ -108,9 +108,23 @@
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 @@
});
+
}
@@ -309,6 +324,7 @@
});
+
}
@@ -443,25 +459,148 @@
// 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 @@
// 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 @@
// 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 @@
int i = 0;
+
}
static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable {
@@ -852,11 +1237,63 @@
});
checkIOOBE(() -> {
- byte o = (byte) vh.getAndAdd(array, ci, (byte)0x45);
+ byte o = (byte) vh.getAndSetAcquire(array, ci, (byte)0x01);
+ });
+
+ checkIOOBE(() -> {
+ 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.addAndGet(array, ci, (byte)0x45);
+ 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);
});
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java Thu Sep 01 10:16:57 2016 -0700
@@ -108,9 +108,23 @@
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 @@
});
+
}
@@ -309,6 +324,7 @@
});
+
}
@@ -443,25 +459,148 @@
// 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 @@
// 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 @@
// 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 @@
int i = 0;
+
}
static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable {
@@ -852,11 +1237,63 @@
});
checkIOOBE(() -> {
- char o = (char) vh.getAndAdd(array, ci, '\u89AB');
+ char o = (char) vh.getAndSetAcquire(array, ci, '\u0123');
+ });
+
+ checkIOOBE(() -> {
+ 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.addAndGet(array, ci, '\u89AB');
+ 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');
});
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java Thu Sep 01 10:16:57 2016 -0700
@@ -108,9 +108,23 @@
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 @@
});
+
+ 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 @@
});
+
+ 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 @@
// 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 @@
// 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 @@
// 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 @@
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 @@
});
checkIOOBE(() -> {
- double o = (double) vh.getAndAdd(array, ci, 3.0d);
+ double o = (double) vh.getAndSetAcquire(array, ci, 1.0d);
+ });
+
+ checkIOOBE(() -> {
+ double o = (double) vh.getAndSetRelease(array, ci, 1.0d);
+ });
+
+ checkIOOBE(() -> {
+ double o = (double) vh.getAndAdd(array, ci, 1.0d);
});
checkIOOBE(() -> {
- double o = (double) vh.addAndGet(array, ci, 3.0d);
+ 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);
+ });
+
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java Thu Sep 01 10:16:57 2016 -0700
@@ -108,9 +108,23 @@
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 @@
});
+
+ 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 @@
});
+
+ 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 @@
// 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 @@
// 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 @@
// 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 @@
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 @@
});
checkIOOBE(() -> {
- float o = (float) vh.getAndAdd(array, ci, 3.0f);
+ float o = (float) vh.getAndSetAcquire(array, ci, 1.0f);
+ });
+
+ checkIOOBE(() -> {
+ float o = (float) vh.getAndSetRelease(array, ci, 1.0f);
+ });
+
+ checkIOOBE(() -> {
+ float o = (float) vh.getAndAdd(array, ci, 1.0f);
});
checkIOOBE(() -> {
- float o = (float) vh.addAndGet(array, ci, 3.0f);
+ 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);
+ });
+
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java Thu Sep 01 10:16:57 2016 -0700
@@ -108,9 +108,23 @@
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 @@
});
+
}
@@ -309,6 +324,7 @@
});
+
}
@@ -443,25 +459,148 @@
// 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 @@
// 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 @@
// 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 @@
int i = 0;
+
}
static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable {
@@ -852,11 +1237,63 @@
});
checkIOOBE(() -> {
- int o = (int) vh.getAndAdd(array, ci, 0xCAFEBABE);
+ int o = (int) vh.getAndSetAcquire(array, ci, 0x01234567);
+ });
+
+ checkIOOBE(() -> {
+ 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.addAndGet(array, ci, 0xCAFEBABE);
+ 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);
});
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java Thu Sep 01 10:16:57 2016 -0700
@@ -108,9 +108,23 @@
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 @@
});
+
}
@@ -309,6 +324,7 @@
});
+
}
@@ -443,25 +459,148 @@
// 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 @@
// 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 @@
// 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 @@
int i = 0;
+
}
static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable {
@@ -852,11 +1237,63 @@
});
checkIOOBE(() -> {
- long o = (long) vh.getAndAdd(array, ci, 0xDEADBEEFDEADBEEFL);
+ long o = (long) vh.getAndSetAcquire(array, ci, 0x0123456789ABCDEFL);
+ });
+
+ checkIOOBE(() -> {
+ 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.addAndGet(array, ci, 0xDEADBEEFDEADBEEFL);
+ 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);
});
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java Thu Sep 01 10:16:57 2016 -0700
@@ -108,9 +108,23 @@
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 @@
});
+
}
@@ -309,6 +324,7 @@
});
+
}
@@ -443,25 +459,148 @@
// 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 @@
// 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 @@
// 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 @@
int i = 0;
+
}
static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable {
@@ -852,11 +1237,63 @@
});
checkIOOBE(() -> {
- short o = (short) vh.getAndAdd(array, ci, (short)0x89AB);
+ short o = (short) vh.getAndSetAcquire(array, ci, (short)0x0123);
+ });
+
+ checkIOOBE(() -> {
+ 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.addAndGet(array, ci, (short)0x89AB);
+ 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);
});
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java Thu Sep 01 10:16:57 2016 -0700
@@ -108,9 +108,23 @@
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));
}
@@ -266,8 +280,52 @@
});
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");
+ });
}
@@ -321,8 +379,52 @@
});
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 @@
// 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) {
@@ -472,8 +595,52 @@
});
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 @@
// 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) {
@@ -623,8 +811,52 @@
});
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 @@
// 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");
+ }
+
+
}
}
@@ -781,8 +1034,52 @@
});
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 @@
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");
+ });
+
+
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java Thu Sep 01 10:16:57 2016 -0700
@@ -97,9 +97,23 @@
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")
@@ -221,12 +235,64 @@
});
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) {
@@ -290,12 +356,64 @@
});
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 @@
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 @@
});
+
}
}
@@ -434,6 +604,7 @@
});
+
}
}
}
@@ -518,6 +689,7 @@
});
+
}
}
}
@@ -564,6 +736,7 @@
assertEquals(x, VALUE_2, "setOpaque char value");
}
+
}
}
}
@@ -609,6 +782,7 @@
assertEquals(x, VALUE_2, "setOpaque char value");
}
+
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java Thu Sep 01 10:16:57 2016 -0700
@@ -97,9 +97,23 @@
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")
@@ -190,8 +204,52 @@
});
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,14 +313,66 @@
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(() -> {
@@ -270,8 +380,51 @@
});
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
// 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");
+ }
+
+
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java Thu Sep 01 10:16:57 2016 -0700
@@ -97,9 +97,23 @@
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")
@@ -190,8 +204,52 @@
});
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,14 +313,66 @@
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(() -> {
@@ -270,8 +380,51 @@
});
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
// 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");
+ }
+
+
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java Thu Sep 01 10:16:57 2016 -0700
@@ -97,9 +97,23 @@
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 @@
int ci = 1;
+
}
static void testArrayUnsupported(ByteBufferSource bs, VarHandleSource vhs) {
@@ -248,14 +263,66 @@
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 {
}
@@ -339,13 +406,65 @@
});
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);
+ });
+
}
}
@@ -431,12 +550,64 @@
});
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);
+ });
}
}
}
@@ -514,13 +685,64 @@
});
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);
+ });
}
}
}
@@ -600,12 +822,64 @@
});
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 @@
// 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 @@
// 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");
+ }
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java Thu Sep 01 10:16:57 2016 -0700
@@ -97,9 +97,23 @@
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 @@
int ci = 1;
+
}
static void testArrayUnsupported(ByteBufferSource bs, VarHandleSource vhs) {
@@ -248,14 +263,66 @@
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 {
}
@@ -339,13 +406,65 @@
});
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);
+ });
+
}
}
@@ -431,12 +550,64 @@
});
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);
+ });
}
}
}
@@ -514,13 +685,64 @@
});
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);
+ });
}
}
}
@@ -600,12 +822,64 @@
});
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 @@
// 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 @@
// 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");
+ }
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java Thu Sep 01 10:16:57 2016 -0700
@@ -97,9 +97,23 @@
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")
@@ -221,12 +235,64 @@
});
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) {
@@ -290,12 +356,64 @@
});
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 @@
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 @@
});
+
}
}
@@ -434,6 +604,7 @@
});
+
}
}
}
@@ -518,6 +689,7 @@
});
+
}
}
}
@@ -564,6 +736,7 @@
assertEquals(x, VALUE_2, "setOpaque short value");
}
+
}
}
}
@@ -609,6 +782,7 @@
assertEquals(x, VALUE_2, "setOpaque short value");
}
+
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java Thu Sep 01 10:16:57 2016 -0700
@@ -255,6 +255,90 @@
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 @@
boolean r = (boolean) hs.get(am).invokeExact(recv, true);
});
}
+
}
@@ -398,12 +483,118 @@
// 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 @@
boolean r = (boolean) hs.get(am).invokeExact(true);
});
}
+
}
@@ -550,12 +742,116 @@
// 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 @@
boolean o = (boolean) hs.get(am).invokeExact(array, i, true);
});
}
+
}
static void testArrayIndexOutOfBounds(Handles hs) throws Throwable {
@@ -607,6 +904,12 @@
});
}
+
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ checkIOOBE(am, () -> {
+ boolean o = (boolean) hs.get(am).invokeExact(array, ci, false);
+ });
+ }
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java Thu Sep 01 10:16:57 2016 -0700
@@ -255,19 +255,122 @@
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 @@
// 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 @@
// 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 @@
final int i = 0;
+
}
static void testArrayIndexOutOfBounds(Handles hs) throws Throwable {
@@ -624,6 +975,12 @@
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);
+ });
+ }
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java Thu Sep 01 10:16:57 2016 -0700
@@ -255,19 +255,122 @@
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 @@
// 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 @@
// 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 @@
final int i = 0;
+
}
static void testArrayIndexOutOfBounds(Handles hs) throws Throwable {
@@ -624,6 +975,12 @@
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');
+ });
+ }
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java Thu Sep 01 10:16:57 2016 -0700
@@ -255,19 +255,44 @@
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 @@
// 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 @@
// 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 @@
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 @@
double o = (double) hs.get(am).invokeExact(array, ci, 3.0d);
});
}
+
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java Thu Sep 01 10:16:57 2016 -0700
@@ -255,19 +255,44 @@
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 @@
// 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 @@
// 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 @@
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 @@
float o = (float) hs.get(am).invokeExact(array, ci, 3.0f);
});
}
+
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java Thu Sep 01 10:16:57 2016 -0700
@@ -255,19 +255,122 @@
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 @@
// 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 @@
// 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 @@
final int i = 0;
+
}
static void testArrayIndexOutOfBounds(Handles hs) throws Throwable {
@@ -624,6 +975,12 @@
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);
+ });
+ }
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java Thu Sep 01 10:16:57 2016 -0700
@@ -255,19 +255,122 @@
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 @@
// 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 @@
// 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 @@
final int i = 0;
+
}
static void testArrayIndexOutOfBounds(Handles hs) throws Throwable {
@@ -624,6 +975,12 @@
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);
+ });
+ }
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java Thu Sep 01 10:16:57 2016 -0700
@@ -255,19 +255,122 @@
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 @@
// 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 @@
// 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 @@
final int i = 0;
+
}
static void testArrayIndexOutOfBounds(Handles hs) throws Throwable {
@@ -624,6 +975,12 @@
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);
+ });
+ }
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java Thu Sep 01 10:16:57 2016 -0700
@@ -255,6 +255,7 @@
assertEquals(x, "bar", "getAndSet String value");
}
+
}
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessString recv, Handles hs) throws Throwable {
@@ -264,6 +265,12 @@
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 @@
// 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 @@
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 @@
// 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 @@
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 @@
});
}
+
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java Thu Sep 01 10:16:57 2016 -0700
@@ -582,6 +582,333 @@
boolean x = (boolean) vh.getAndSet(recv, true, Void.class);
});
+ // GetAndSetAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ boolean x = (boolean) vh.getAndSetAcquire(null, true);
+ });
+ checkCCE(() -> { // receiver reference class
+ boolean x = (boolean) vh.getAndSetAcquire(Void.class, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndSetAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ boolean x = (boolean) vh.getAndSetAcquire(0, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire(recv, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndSetAcquire(recv, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndSetAcquire(recv, true, Void.class);
+ });
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ boolean x = (boolean) vh.getAndSetRelease(null, true);
+ });
+ checkCCE(() -> { // receiver reference class
+ boolean x = (boolean) vh.getAndSetRelease(Void.class, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndSetRelease(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ boolean x = (boolean) vh.getAndSetRelease(0, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease(recv, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndSetRelease(recv, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndSetRelease(recv, true, Void.class);
+ });
+
+
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ boolean x = (boolean) vh.getAndBitwiseOr(null, true);
+ });
+ checkCCE(() -> { // receiver reference class
+ boolean x = (boolean) vh.getAndBitwiseOr(Void.class, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseOr(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr(0, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(recv, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseOr(recv, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseOr(recv, true, Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(null, true);
+ });
+ checkCCE(() -> { // receiver reference class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(Void.class, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(0, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire(recv, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseOrAcquire(recv, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, true, Void.class);
+ });
+
+
+ // GetAndBitwiseOrRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ boolean x = (boolean) vh.getAndBitwiseOrRelease(null, true);
+ });
+ checkCCE(() -> { // receiver reference class
+ boolean x = (boolean) vh.getAndBitwiseOr(Void.class, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseOr(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr(0, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(recv, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseOr(recv, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseOr(recv, true, Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ boolean x = (boolean) vh.getAndBitwiseAnd(null, true);
+ });
+ checkCCE(() -> { // receiver reference class
+ boolean x = (boolean) vh.getAndBitwiseAnd(Void.class, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseAnd(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd(0, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(recv, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseAnd(recv, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseAnd(recv, true, Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(null, true);
+ });
+ checkCCE(() -> { // receiver reference class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(Void.class, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(0, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire(recv, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseAndAcquire(recv, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, true, Void.class);
+ });
+
+
+ // GetAndBitwiseAndRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ boolean x = (boolean) vh.getAndBitwiseAndRelease(null, true);
+ });
+ checkCCE(() -> { // receiver reference class
+ boolean x = (boolean) vh.getAndBitwiseAnd(Void.class, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseAnd(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd(0, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(recv, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseAnd(recv, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseAnd(recv, true, Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ boolean x = (boolean) vh.getAndBitwiseXor(null, true);
+ });
+ checkCCE(() -> { // receiver reference class
+ boolean x = (boolean) vh.getAndBitwiseXor(Void.class, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseXor(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor(0, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(recv, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseXor(recv, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseXor(recv, true, Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(null, true);
+ });
+ checkCCE(() -> { // receiver reference class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(Void.class, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(0, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire(recv, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseXorAcquire(recv, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, true, Void.class);
+ });
+
+
+ // GetAndBitwiseXorRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ boolean x = (boolean) vh.getAndBitwiseXorRelease(null, true);
+ });
+ checkCCE(() -> { // receiver reference class
+ boolean x = (boolean) vh.getAndBitwiseXor(Void.class, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseXor(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor(0, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(recv, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseXor(recv, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseXor(recv, true, Void.class);
+ });
}
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeBoolean recv, Handles hs) throws Throwable {
@@ -759,6 +1086,43 @@
});
}
+
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ checkNPE(() -> { // null receiver
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeBoolean.class, boolean.class)).
+ invokeExact((VarHandleTestMethodTypeBoolean) null, true);
+ });
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, Class.class, boolean.class)).
+ invokeExact(Void.class, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeBoolean.class, Class.class)).
+ invokeExact(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class, boolean.class)).
+ invokeExact(0, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeBoolean.class, boolean.class)).
+ invokeExact(recv, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeBoolean.class, boolean.class)).
+ invokeExact(recv, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) hs.get(am, methodType(boolean.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeBoolean.class, boolean.class)).
+ invokeExact(recv, true, Void.class);
+ });
+ }
}
@@ -1049,6 +1413,236 @@
boolean x = (boolean) vh.getAndSet(true, Void.class);
});
+
+ // GetAndSetAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndSetAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire(true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndSetAcquire(true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndSetAcquire(true, Void.class);
+ });
+
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndSetRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease(true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndSetRelease(true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndSetRelease(true, Void.class);
+ });
+
+
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseOr(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseOr(true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseOr(true, Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire(true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseOrAcquire(true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(true, Void.class);
+ });
+
+
+ // GetAndBitwiseOrReleaseRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseOrRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrRelease(true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseOrRelease(true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseOrRelease();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseOrRelease(true, Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseAnd(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseAnd(true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseAnd(true, Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire(true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseAndAcquire(true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(true, Void.class);
+ });
+
+
+ // GetAndBitwiseAndReleaseRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseAndRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndRelease(true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseAndRelease(true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseAndRelease();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseAndRelease(true, Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseXor(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseXor(true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseXor(true, Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire(true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseXorAcquire(true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(true, Void.class);
+ });
+
+
+ // GetAndBitwiseXorReleaseRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseXorRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorRelease(true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseXorRelease(true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseXorRelease();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseXorRelease(true, Void.class);
+ });
}
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
@@ -1163,6 +1757,32 @@
});
}
+
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, Class.class)).
+ invokeExact(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, boolean.class)).
+ invokeExact(true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) hs.get(am, methodType(int.class, boolean.class)).
+ invokeExact(true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) hs.get(am, methodType(boolean.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean.class, Class.class)).
+ invokeExact(true, Void.class);
+ });
+ }
}
@@ -1679,6 +2299,368 @@
boolean x = (boolean) vh.getAndSet(array, 0, true, Void.class);
});
+
+ // GetAndSetAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ boolean x = (boolean) vh.getAndSetAcquire(null, 0, true);
+ });
+ checkCCE(() -> { // array reference class
+ boolean x = (boolean) vh.getAndSetAcquire(Void.class, 0, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndSetAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // reciarrayever primitive class
+ boolean x = (boolean) vh.getAndSetAcquire(0, 0, true);
+ });
+ checkWMTE(() -> { // index reference class
+ boolean x = (boolean) vh.getAndSetAcquire(array, Void.class, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire(array, 0, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndSetAcquire(array, 0, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndSetAcquire(array, 0, true, Void.class);
+ });
+
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ boolean x = (boolean) vh.getAndSetRelease(null, 0, true);
+ });
+ checkCCE(() -> { // array reference class
+ boolean x = (boolean) vh.getAndSetRelease(Void.class, 0, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndSetRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // reciarrayever primitive class
+ boolean x = (boolean) vh.getAndSetRelease(0, 0, true);
+ });
+ checkWMTE(() -> { // index reference class
+ boolean x = (boolean) vh.getAndSetRelease(array, Void.class, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease(array, 0, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndSetRelease(array, 0, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndSetRelease(array, 0, true, Void.class);
+ });
+
+
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ boolean x = (boolean) vh.getAndBitwiseOr(null, 0, true);
+ });
+ checkCCE(() -> { // array reference class
+ boolean x = (boolean) vh.getAndBitwiseOr(Void.class, 0, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseOr(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr(0, 0, true);
+ });
+ checkWMTE(() -> { // index reference class
+ boolean x = (boolean) vh.getAndBitwiseOr(array, Void.class, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(array, 0, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseOr(array, 0, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseOr(array, 0, true, Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(null, 0, true);
+ });
+ checkCCE(() -> { // array reference class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(Void.class, 0, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(0, 0, true);
+ });
+ checkWMTE(() -> { // index reference class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, Void.class, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseOrAcquire(array, 0, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, true, Void.class);
+ });
+
+
+ // GetAndBitwiseOrRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ boolean x = (boolean) vh.getAndBitwiseOrRelease(null, 0, true);
+ });
+ checkCCE(() -> { // array reference class
+ boolean x = (boolean) vh.getAndBitwiseOrRelease(Void.class, 0, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrRelease(0, 0, true);
+ });
+ checkWMTE(() -> { // index reference class
+ boolean x = (boolean) vh.getAndBitwiseOrRelease(array, Void.class, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseOrRelease(array, 0, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseOrRelease();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, true, Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ boolean x = (boolean) vh.getAndBitwiseAnd(null, 0, true);
+ });
+ checkCCE(() -> { // array reference class
+ boolean x = (boolean) vh.getAndBitwiseAnd(Void.class, 0, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd(0, 0, true);
+ });
+ checkWMTE(() -> { // index reference class
+ boolean x = (boolean) vh.getAndBitwiseAnd(array, Void.class, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(array, 0, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseAnd(array, 0, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, true, Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(null, 0, true);
+ });
+ checkCCE(() -> { // array reference class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(Void.class, 0, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(0, 0, true);
+ });
+ checkWMTE(() -> { // index reference class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, Void.class, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseAndAcquire(array, 0, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, true, Void.class);
+ });
+
+
+ // GetAndBitwiseAndRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ boolean x = (boolean) vh.getAndBitwiseAndRelease(null, 0, true);
+ });
+ checkCCE(() -> { // array reference class
+ boolean x = (boolean) vh.getAndBitwiseAndRelease(Void.class, 0, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndRelease(0, 0, true);
+ });
+ checkWMTE(() -> { // index reference class
+ boolean x = (boolean) vh.getAndBitwiseAndRelease(array, Void.class, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseAndRelease(array, 0, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseAndRelease();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, true, Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ boolean x = (boolean) vh.getAndBitwiseXor(null, 0, true);
+ });
+ checkCCE(() -> { // array reference class
+ boolean x = (boolean) vh.getAndBitwiseXor(Void.class, 0, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseXor(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor(0, 0, true);
+ });
+ checkWMTE(() -> { // index reference class
+ boolean x = (boolean) vh.getAndBitwiseXor(array, Void.class, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(array, 0, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseXor(array, 0, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseXor(array, 0, true, Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(null, 0, true);
+ });
+ checkCCE(() -> { // array reference class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(Void.class, 0, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(0, 0, true);
+ });
+ checkWMTE(() -> { // index reference class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, Void.class, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseXorAcquire(array, 0, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, true, Void.class);
+ });
+
+
+ // GetAndBitwiseXorRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ boolean x = (boolean) vh.getAndBitwiseXorRelease(null, 0, true);
+ });
+ checkCCE(() -> { // array reference class
+ boolean x = (boolean) vh.getAndBitwiseXorRelease(Void.class, 0, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorRelease(0, 0, true);
+ });
+ checkWMTE(() -> { // index reference class
+ boolean x = (boolean) vh.getAndBitwiseXorRelease(array, Void.class, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) vh.getAndBitwiseXorRelease(array, 0, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) vh.getAndBitwiseXorRelease();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, true, Void.class);
+ });
}
static void testArrayWrongMethodType(Handles hs) throws Throwable {
@@ -1880,6 +2862,48 @@
});
}
+
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, int.class, boolean.class)).
+ invokeExact((boolean[]) null, 0, true);
+ });
+ hs.checkWMTEOrCCE(() -> { // array reference class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, boolean.class)).
+ invokeExact(Void.class, 0, true);
+ });
+ checkWMTE(() -> { // value reference class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, int.class, Class.class)).
+ invokeExact(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, boolean.class)).
+ invokeExact(0, 0, true);
+ });
+ checkWMTE(() -> { // index reference class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, Class.class, boolean.class)).
+ invokeExact(array, Void.class, true);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, boolean[].class, int.class, boolean.class)).
+ invokeExact(array, 0, true);
+ });
+ checkWMTE(() -> { // primitive class
+ int x = (int) hs.get(am, methodType(int.class, boolean[].class, int.class, boolean.class)).
+ invokeExact(array, 0, true);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ boolean x = (boolean) hs.get(am, methodType(boolean.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, int.class, boolean.class, Class.class)).
+ invokeExact(array, 0, true, Void.class);
+ });
+ }
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java Thu Sep 01 10:16:57 2016 -0700
@@ -582,6 +582,64 @@
byte x = (byte) vh.getAndSet(recv, (byte)0x01, Void.class);
});
+ // GetAndSetAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ byte x = (byte) vh.getAndSetAcquire(null, (byte)0x01);
+ });
+ checkCCE(() -> { // receiver reference class
+ byte x = (byte) vh.getAndSetAcquire(Void.class, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndSetAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ byte x = (byte) vh.getAndSetAcquire(0, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire(recv, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetAcquire(recv, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndSetAcquire(recv, (byte)0x01, Void.class);
+ });
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ byte x = (byte) vh.getAndSetRelease(null, (byte)0x01);
+ });
+ checkCCE(() -> { // receiver reference class
+ byte x = (byte) vh.getAndSetRelease(Void.class, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndSetRelease(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ byte x = (byte) vh.getAndSetRelease(0, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease(recv, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetRelease(recv, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndSetRelease(recv, (byte)0x01, Void.class);
+ });
+
// GetAndAdd
// Incorrect argument types
checkNPE(() -> { // null receiver
@@ -611,6 +669,63 @@
byte x = (byte) vh.getAndAdd(recv, (byte)0x01, Void.class);
});
+ // GetAndAddAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ byte x = (byte) vh.getAndAddAcquire(null, (byte)0x01);
+ });
+ checkCCE(() -> { // receiver reference class
+ byte x = (byte) vh.getAndAddAcquire(Void.class, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndAddAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ byte x = (byte) vh.getAndAddAcquire(0, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddAcquire(recv, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddAcquire(recv, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndAddAcquire();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndAddAcquire(recv, (byte)0x01, Void.class);
+ });
+
+ // GetAndAddRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ byte x = (byte) vh.getAndAddRelease(null, (byte)0x01);
+ });
+ checkCCE(() -> { // receiver reference class
+ byte x = (byte) vh.getAndAddRelease(Void.class, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndAddRelease(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ byte x = (byte) vh.getAndAddRelease(0, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddRelease(recv, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddRelease(recv, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndAddRelease();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndAddRelease(recv, (byte)0x01, Void.class);
+ });
// AddAndGet
// Incorrect argument types
@@ -640,6 +755,275 @@
checkWMTE(() -> { // >
byte x = (byte) vh.addAndGet(recv, (byte)0x01, Void.class);
});
+
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ byte x = (byte) vh.getAndBitwiseOr(null, (byte)0x01);
+ });
+ checkCCE(() -> { // receiver reference class
+ byte x = (byte) vh.getAndBitwiseOr(Void.class, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseOr(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ byte x = (byte) vh.getAndBitwiseOr(0, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(recv, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr(recv, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseOr(recv, (byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ byte x = (byte) vh.getAndBitwiseOrAcquire(null, (byte)0x01);
+ });
+ checkCCE(() -> { // receiver reference class
+ byte x = (byte) vh.getAndBitwiseOrAcquire(Void.class, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseOrAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ byte x = (byte) vh.getAndBitwiseOrAcquire(0, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire(recv, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseOrAcquire(recv, (byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseOrRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ byte x = (byte) vh.getAndBitwiseOrRelease(null, (byte)0x01);
+ });
+ checkCCE(() -> { // receiver reference class
+ byte x = (byte) vh.getAndBitwiseOr(Void.class, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseOr(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ byte x = (byte) vh.getAndBitwiseOr(0, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(recv, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr(recv, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseOr(recv, (byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ byte x = (byte) vh.getAndBitwiseAnd(null, (byte)0x01);
+ });
+ checkCCE(() -> { // receiver reference class
+ byte x = (byte) vh.getAndBitwiseAnd(Void.class, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseAnd(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ byte x = (byte) vh.getAndBitwiseAnd(0, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(recv, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd(recv, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseAnd(recv, (byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ byte x = (byte) vh.getAndBitwiseAndAcquire(null, (byte)0x01);
+ });
+ checkCCE(() -> { // receiver reference class
+ byte x = (byte) vh.getAndBitwiseAndAcquire(Void.class, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseAndAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ byte x = (byte) vh.getAndBitwiseAndAcquire(0, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire(recv, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseAndAcquire(recv, (byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseAndRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ byte x = (byte) vh.getAndBitwiseAndRelease(null, (byte)0x01);
+ });
+ checkCCE(() -> { // receiver reference class
+ byte x = (byte) vh.getAndBitwiseAnd(Void.class, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseAnd(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ byte x = (byte) vh.getAndBitwiseAnd(0, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(recv, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd(recv, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseAnd(recv, (byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ byte x = (byte) vh.getAndBitwiseXor(null, (byte)0x01);
+ });
+ checkCCE(() -> { // receiver reference class
+ byte x = (byte) vh.getAndBitwiseXor(Void.class, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseXor(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ byte x = (byte) vh.getAndBitwiseXor(0, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(recv, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor(recv, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseXor(recv, (byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ byte x = (byte) vh.getAndBitwiseXorAcquire(null, (byte)0x01);
+ });
+ checkCCE(() -> { // receiver reference class
+ byte x = (byte) vh.getAndBitwiseXorAcquire(Void.class, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseXorAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ byte x = (byte) vh.getAndBitwiseXorAcquire(0, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire(recv, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseXorAcquire(recv, (byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseXorRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ byte x = (byte) vh.getAndBitwiseXorRelease(null, (byte)0x01);
+ });
+ checkCCE(() -> { // receiver reference class
+ byte x = (byte) vh.getAndBitwiseXor(Void.class, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseXor(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ byte x = (byte) vh.getAndBitwiseXor(0, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(recv, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor(recv, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseXor(recv, (byte)0x01, Void.class);
+ });
}
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeByte recv, Handles hs) throws Throwable {
@@ -853,6 +1237,43 @@
invokeExact(recv, (byte)0x01, Void.class);
});
}
+
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ checkNPE(() -> { // null receiver
+ byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, byte.class)).
+ invokeExact((VarHandleTestMethodTypeByte) null, (byte)0x01);
+ });
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
+ byte x = (byte) hs.get(am, methodType(byte.class, Class.class, byte.class)).
+ invokeExact(Void.class, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, Class.class)).
+ invokeExact(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ byte x = (byte) hs.get(am, methodType(byte.class, int.class, byte.class)).
+ invokeExact(0, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeByte.class, byte.class)).
+ invokeExact(recv, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class, byte.class)).
+ invokeExact(recv, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) hs.get(am, methodType(byte.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, byte.class)).
+ invokeExact(recv, (byte)0x01, Void.class);
+ });
+ }
}
@@ -1143,6 +1564,48 @@
byte x = (byte) vh.getAndSet((byte)0x01, Void.class);
});
+
+ // GetAndSetAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndSetAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire((byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetAcquire((byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndSetAcquire((byte)0x01, Void.class);
+ });
+
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndSetRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease((byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetRelease((byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndSetRelease((byte)0x01, Void.class);
+ });
+
// GetAndAdd
// Incorrect argument types
checkWMTE(() -> { // value reference class
@@ -1164,6 +1627,48 @@
});
+ // GetAndAddAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndAddAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddAcquire((byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddAcquire((byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndAddAcquire();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndAddAcquire((byte)0x01, Void.class);
+ });
+
+
+ // GetAndAddRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndAddRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddRelease((byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddRelease((byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndAddRelease();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndAddRelease((byte)0x01, Void.class);
+ });
+
+
// AddAndGet
// Incorrect argument types
checkWMTE(() -> { // value reference class
@@ -1183,6 +1688,194 @@
checkWMTE(() -> { // >
byte x = (byte) vh.addAndGet((byte)0x01, Void.class);
});
+
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseOr(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr((byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr((byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseOr((byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseOrAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire((byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire((byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseOrAcquire((byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseOrReleaseRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseOrRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrRelease((byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrRelease((byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseOrRelease();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseOrRelease((byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseAnd(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd((byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd((byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseAnd((byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseAndAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire((byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire((byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseAndAcquire((byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseAndReleaseRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseAndRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndRelease((byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndRelease((byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseAndRelease();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseAndRelease((byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseXor(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor((byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor((byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseXor((byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseXorAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire((byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire((byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseXorAcquire((byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseXorReleaseRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseXorRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorRelease((byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorRelease((byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseXorRelease();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseXorRelease((byte)0x01, Void.class);
+ });
}
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
@@ -1322,6 +2015,32 @@
invokeExact((byte)0x01, Void.class);
});
}
+
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) hs.get(am, methodType(byte.class, Class.class)).
+ invokeExact(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, byte.class)).
+ invokeExact((byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, byte.class)).
+ invokeExact((byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) hs.get(am, methodType(byte.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) hs.get(am, methodType(byte.class, byte.class, Class.class)).
+ invokeExact((byte)0x01, Void.class);
+ });
+ }
}
@@ -1838,6 +2557,72 @@
byte x = (byte) vh.getAndSet(array, 0, (byte)0x01, Void.class);
});
+
+ // GetAndSetAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ byte x = (byte) vh.getAndSetAcquire(null, 0, (byte)0x01);
+ });
+ checkCCE(() -> { // array reference class
+ byte x = (byte) vh.getAndSetAcquire(Void.class, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndSetAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // reciarrayever primitive class
+ byte x = (byte) vh.getAndSetAcquire(0, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // index reference class
+ byte x = (byte) vh.getAndSetAcquire(array, Void.class, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire(array, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetAcquire(array, 0, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndSetAcquire(array, 0, (byte)0x01, Void.class);
+ });
+
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ byte x = (byte) vh.getAndSetRelease(null, 0, (byte)0x01);
+ });
+ checkCCE(() -> { // array reference class
+ byte x = (byte) vh.getAndSetRelease(Void.class, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndSetRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // reciarrayever primitive class
+ byte x = (byte) vh.getAndSetRelease(0, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // index reference class
+ byte x = (byte) vh.getAndSetRelease(array, Void.class, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease(array, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetRelease(array, 0, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndSetRelease(array, 0, (byte)0x01, Void.class);
+ });
+
// GetAndAdd
// Incorrect argument types
checkNPE(() -> { // null array
@@ -1871,6 +2656,72 @@
});
+ // GetAndAddAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ byte x = (byte) vh.getAndAddAcquire(null, 0, (byte)0x01);
+ });
+ checkCCE(() -> { // array reference class
+ byte x = (byte) vh.getAndAddAcquire(Void.class, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndAddAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ byte x = (byte) vh.getAndAddAcquire(0, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // index reference class
+ byte x = (byte) vh.getAndAddAcquire(array, Void.class, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddAcquire(array, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddAcquire(array, 0, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndAddAcquire();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndAddAcquire(array, 0, (byte)0x01, Void.class);
+ });
+
+
+ // GetAndAddRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ byte x = (byte) vh.getAndAddRelease(null, 0, (byte)0x01);
+ });
+ checkCCE(() -> { // array reference class
+ byte x = (byte) vh.getAndAddRelease(Void.class, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndAddRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ byte x = (byte) vh.getAndAddRelease(0, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // index reference class
+ byte x = (byte) vh.getAndAddRelease(array, Void.class, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddRelease(array, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddRelease(array, 0, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndAddRelease();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndAddRelease(array, 0, (byte)0x01, Void.class);
+ });
+
+
// AddAndGet
// Incorrect argument types
checkNPE(() -> { // null array
@@ -1902,6 +2753,302 @@
checkWMTE(() -> { // >
byte x = (byte) vh.addAndGet(array, 0, (byte)0x01, Void.class);
});
+
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ byte x = (byte) vh.getAndBitwiseOr(null, 0, (byte)0x01);
+ });
+ checkCCE(() -> { // array reference class
+ byte x = (byte) vh.getAndBitwiseOr(Void.class, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseOr(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ byte x = (byte) vh.getAndBitwiseOr(0, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // index reference class
+ byte x = (byte) vh.getAndBitwiseOr(array, Void.class, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(array, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr(array, 0, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseOr(array, 0, (byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ byte x = (byte) vh.getAndBitwiseOrAcquire(null, 0, (byte)0x01);
+ });
+ checkCCE(() -> { // array reference class
+ byte x = (byte) vh.getAndBitwiseOrAcquire(Void.class, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseOrAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ byte x = (byte) vh.getAndBitwiseOrAcquire(0, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // index reference class
+ byte x = (byte) vh.getAndBitwiseOrAcquire(array, Void.class, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseOrAcquire(array, 0, (byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseOrRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ byte x = (byte) vh.getAndBitwiseOrRelease(null, 0, (byte)0x01);
+ });
+ checkCCE(() -> { // array reference class
+ byte x = (byte) vh.getAndBitwiseOrRelease(Void.class, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseOrRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ byte x = (byte) vh.getAndBitwiseOrRelease(0, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // index reference class
+ byte x = (byte) vh.getAndBitwiseOrRelease(array, Void.class, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseOrRelease();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseOrRelease(array, 0, (byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ byte x = (byte) vh.getAndBitwiseAnd(null, 0, (byte)0x01);
+ });
+ checkCCE(() -> { // array reference class
+ byte x = (byte) vh.getAndBitwiseAnd(Void.class, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseAnd(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ byte x = (byte) vh.getAndBitwiseAnd(0, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // index reference class
+ byte x = (byte) vh.getAndBitwiseAnd(array, Void.class, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(array, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseAnd(array, 0, (byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ byte x = (byte) vh.getAndBitwiseAndAcquire(null, 0, (byte)0x01);
+ });
+ checkCCE(() -> { // array reference class
+ byte x = (byte) vh.getAndBitwiseAndAcquire(Void.class, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseAndAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ byte x = (byte) vh.getAndBitwiseAndAcquire(0, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // index reference class
+ byte x = (byte) vh.getAndBitwiseAndAcquire(array, Void.class, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseAndAcquire(array, 0, (byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseAndRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ byte x = (byte) vh.getAndBitwiseAndRelease(null, 0, (byte)0x01);
+ });
+ checkCCE(() -> { // array reference class
+ byte x = (byte) vh.getAndBitwiseAndRelease(Void.class, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseAndRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ byte x = (byte) vh.getAndBitwiseAndRelease(0, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // index reference class
+ byte x = (byte) vh.getAndBitwiseAndRelease(array, Void.class, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseAndRelease();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseAndRelease(array, 0, (byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ byte x = (byte) vh.getAndBitwiseXor(null, 0, (byte)0x01);
+ });
+ checkCCE(() -> { // array reference class
+ byte x = (byte) vh.getAndBitwiseXor(Void.class, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseXor(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ byte x = (byte) vh.getAndBitwiseXor(0, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // index reference class
+ byte x = (byte) vh.getAndBitwiseXor(array, Void.class, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(array, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor(array, 0, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseXor(array, 0, (byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ byte x = (byte) vh.getAndBitwiseXorAcquire(null, 0, (byte)0x01);
+ });
+ checkCCE(() -> { // array reference class
+ byte x = (byte) vh.getAndBitwiseXorAcquire(Void.class, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseXorAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ byte x = (byte) vh.getAndBitwiseXorAcquire(0, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // index reference class
+ byte x = (byte) vh.getAndBitwiseXorAcquire(array, Void.class, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseXorAcquire(array, 0, (byte)0x01, Void.class);
+ });
+
+
+ // GetAndBitwiseXorRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ byte x = (byte) vh.getAndBitwiseXorRelease(null, 0, (byte)0x01);
+ });
+ checkCCE(() -> { // array reference class
+ byte x = (byte) vh.getAndBitwiseXorRelease(Void.class, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) vh.getAndBitwiseXorRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ byte x = (byte) vh.getAndBitwiseXorRelease(0, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // index reference class
+ byte x = (byte) vh.getAndBitwiseXorRelease(array, Void.class, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) vh.getAndBitwiseXorRelease();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) vh.getAndBitwiseXorRelease(array, 0, (byte)0x01, Void.class);
+ });
}
static void testArrayWrongMethodType(Handles hs) throws Throwable {
@@ -2144,6 +3291,48 @@
invokeExact(array, 0, (byte)0x01, Void.class);
});
}
+
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, byte.class)).
+ invokeExact((byte[]) null, 0, (byte)0x01);
+ });
+ hs.checkWMTEOrCCE(() -> { // array reference class
+ byte x = (byte) hs.get(am, methodType(byte.class, Class.class, int.class, byte.class)).
+ invokeExact(Void.class, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // value reference class
+ byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, Class.class)).
+ invokeExact(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ byte x = (byte) hs.get(am, methodType(byte.class, int.class, int.class, byte.class)).
+ invokeExact(0, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // index reference class
+ byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, Class.class, byte.class)).
+ invokeExact(array, Void.class, (byte)0x01);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, byte[].class, int.class, byte.class)).
+ invokeExact(array, 0, (byte)0x01);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class, byte.class)).
+ invokeExact(array, 0, (byte)0x01);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ byte x = (byte) hs.get(am, methodType(byte.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, byte.class, Class.class)).
+ invokeExact(array, 0, (byte)0x01, Void.class);
+ });
+ }
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java Thu Sep 01 10:16:57 2016 -0700
@@ -582,6 +582,64 @@
char x = (char) vh.getAndSet(recv, '\u0123', Void.class);
});
+ // GetAndSetAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ char x = (char) vh.getAndSetAcquire(null, '\u0123');
+ });
+ checkCCE(() -> { // receiver reference class
+ char x = (char) vh.getAndSetAcquire(Void.class, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndSetAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ char x = (char) vh.getAndSetAcquire(0, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire(recv, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetAcquire(recv, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndSetAcquire(recv, '\u0123', Void.class);
+ });
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ char x = (char) vh.getAndSetRelease(null, '\u0123');
+ });
+ checkCCE(() -> { // receiver reference class
+ char x = (char) vh.getAndSetRelease(Void.class, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndSetRelease(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ char x = (char) vh.getAndSetRelease(0, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease(recv, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetRelease(recv, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndSetRelease(recv, '\u0123', Void.class);
+ });
+
// GetAndAdd
// Incorrect argument types
checkNPE(() -> { // null receiver
@@ -611,6 +669,63 @@
char x = (char) vh.getAndAdd(recv, '\u0123', Void.class);
});
+ // GetAndAddAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ char x = (char) vh.getAndAddAcquire(null, '\u0123');
+ });
+ checkCCE(() -> { // receiver reference class
+ char x = (char) vh.getAndAddAcquire(Void.class, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndAddAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ char x = (char) vh.getAndAddAcquire(0, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddAcquire(recv, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddAcquire(recv, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndAddAcquire();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndAddAcquire(recv, '\u0123', Void.class);
+ });
+
+ // GetAndAddRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ char x = (char) vh.getAndAddRelease(null, '\u0123');
+ });
+ checkCCE(() -> { // receiver reference class
+ char x = (char) vh.getAndAddRelease(Void.class, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndAddRelease(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ char x = (char) vh.getAndAddRelease(0, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddRelease(recv, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddRelease(recv, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndAddRelease();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndAddRelease(recv, '\u0123', Void.class);
+ });
// AddAndGet
// Incorrect argument types
@@ -640,6 +755,275 @@
checkWMTE(() -> { // >
char x = (char) vh.addAndGet(recv, '\u0123', Void.class);
});
+
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ char x = (char) vh.getAndBitwiseOr(null, '\u0123');
+ });
+ checkCCE(() -> { // receiver reference class
+ char x = (char) vh.getAndBitwiseOr(Void.class, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseOr(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ char x = (char) vh.getAndBitwiseOr(0, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(recv, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr(recv, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseOr(recv, '\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ char x = (char) vh.getAndBitwiseOrAcquire(null, '\u0123');
+ });
+ checkCCE(() -> { // receiver reference class
+ char x = (char) vh.getAndBitwiseOrAcquire(Void.class, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseOrAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ char x = (char) vh.getAndBitwiseOrAcquire(0, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire(recv, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseOrAcquire(recv, '\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseOrRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ char x = (char) vh.getAndBitwiseOrRelease(null, '\u0123');
+ });
+ checkCCE(() -> { // receiver reference class
+ char x = (char) vh.getAndBitwiseOr(Void.class, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseOr(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ char x = (char) vh.getAndBitwiseOr(0, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(recv, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr(recv, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseOr(recv, '\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ char x = (char) vh.getAndBitwiseAnd(null, '\u0123');
+ });
+ checkCCE(() -> { // receiver reference class
+ char x = (char) vh.getAndBitwiseAnd(Void.class, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseAnd(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ char x = (char) vh.getAndBitwiseAnd(0, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(recv, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd(recv, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseAnd(recv, '\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ char x = (char) vh.getAndBitwiseAndAcquire(null, '\u0123');
+ });
+ checkCCE(() -> { // receiver reference class
+ char x = (char) vh.getAndBitwiseAndAcquire(Void.class, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseAndAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ char x = (char) vh.getAndBitwiseAndAcquire(0, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire(recv, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseAndAcquire(recv, '\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseAndRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ char x = (char) vh.getAndBitwiseAndRelease(null, '\u0123');
+ });
+ checkCCE(() -> { // receiver reference class
+ char x = (char) vh.getAndBitwiseAnd(Void.class, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseAnd(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ char x = (char) vh.getAndBitwiseAnd(0, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(recv, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd(recv, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseAnd(recv, '\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ char x = (char) vh.getAndBitwiseXor(null, '\u0123');
+ });
+ checkCCE(() -> { // receiver reference class
+ char x = (char) vh.getAndBitwiseXor(Void.class, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseXor(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ char x = (char) vh.getAndBitwiseXor(0, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(recv, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor(recv, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseXor(recv, '\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ char x = (char) vh.getAndBitwiseXorAcquire(null, '\u0123');
+ });
+ checkCCE(() -> { // receiver reference class
+ char x = (char) vh.getAndBitwiseXorAcquire(Void.class, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseXorAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ char x = (char) vh.getAndBitwiseXorAcquire(0, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire(recv, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseXorAcquire(recv, '\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseXorRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ char x = (char) vh.getAndBitwiseXorRelease(null, '\u0123');
+ });
+ checkCCE(() -> { // receiver reference class
+ char x = (char) vh.getAndBitwiseXor(Void.class, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseXor(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ char x = (char) vh.getAndBitwiseXor(0, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(recv, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor(recv, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseXor(recv, '\u0123', Void.class);
+ });
}
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeChar recv, Handles hs) throws Throwable {
@@ -853,6 +1237,43 @@
invokeExact(recv, '\u0123', Void.class);
});
}
+
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ checkNPE(() -> { // null receiver
+ char x = (char) hs.get(am, methodType(char.class, VarHandleTestMethodTypeChar.class, char.class)).
+ invokeExact((VarHandleTestMethodTypeChar) null, '\u0123');
+ });
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
+ char x = (char) hs.get(am, methodType(char.class, Class.class, char.class)).
+ invokeExact(Void.class, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) hs.get(am, methodType(char.class, VarHandleTestMethodTypeChar.class, Class.class)).
+ invokeExact(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ char x = (char) hs.get(am, methodType(char.class, int.class, char.class)).
+ invokeExact(0, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeChar.class, char.class)).
+ invokeExact(recv, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeChar.class, char.class)).
+ invokeExact(recv, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) hs.get(am, methodType(char.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) hs.get(am, methodType(char.class, VarHandleTestMethodTypeChar.class, char.class)).
+ invokeExact(recv, '\u0123', Void.class);
+ });
+ }
}
@@ -1143,6 +1564,48 @@
char x = (char) vh.getAndSet('\u0123', Void.class);
});
+
+ // GetAndSetAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndSetAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire('\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetAcquire('\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndSetAcquire('\u0123', Void.class);
+ });
+
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndSetRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease('\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetRelease('\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndSetRelease('\u0123', Void.class);
+ });
+
// GetAndAdd
// Incorrect argument types
checkWMTE(() -> { // value reference class
@@ -1164,6 +1627,48 @@
});
+ // GetAndAddAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndAddAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddAcquire('\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddAcquire('\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndAddAcquire();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndAddAcquire('\u0123', Void.class);
+ });
+
+
+ // GetAndAddRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndAddRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddRelease('\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddRelease('\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndAddRelease();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndAddRelease('\u0123', Void.class);
+ });
+
+
// AddAndGet
// Incorrect argument types
checkWMTE(() -> { // value reference class
@@ -1183,6 +1688,194 @@
checkWMTE(() -> { // >
char x = (char) vh.addAndGet('\u0123', Void.class);
});
+
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseOr(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr('\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr('\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseOr('\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseOrAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire('\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire('\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseOrAcquire('\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseOrReleaseRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseOrRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrRelease('\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrRelease('\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseOrRelease();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseOrRelease('\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseAnd(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd('\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd('\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseAnd('\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseAndAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire('\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire('\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseAndAcquire('\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseAndReleaseRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseAndRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndRelease('\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndRelease('\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseAndRelease();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseAndRelease('\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseXor(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor('\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor('\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseXor('\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseXorAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire('\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire('\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseXorAcquire('\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseXorReleaseRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseXorRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorRelease('\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorRelease('\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseXorRelease();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseXorRelease('\u0123', Void.class);
+ });
}
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
@@ -1322,6 +2015,32 @@
invokeExact('\u0123', Void.class);
});
}
+
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ char x = (char) hs.get(am, methodType(char.class, Class.class)).
+ invokeExact(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, char.class)).
+ invokeExact('\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, char.class)).
+ invokeExact('\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) hs.get(am, methodType(char.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) hs.get(am, methodType(char.class, char.class, Class.class)).
+ invokeExact('\u0123', Void.class);
+ });
+ }
}
@@ -1838,6 +2557,72 @@
char x = (char) vh.getAndSet(array, 0, '\u0123', Void.class);
});
+
+ // GetAndSetAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ char x = (char) vh.getAndSetAcquire(null, 0, '\u0123');
+ });
+ checkCCE(() -> { // array reference class
+ char x = (char) vh.getAndSetAcquire(Void.class, 0, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndSetAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // reciarrayever primitive class
+ char x = (char) vh.getAndSetAcquire(0, 0, '\u0123');
+ });
+ checkWMTE(() -> { // index reference class
+ char x = (char) vh.getAndSetAcquire(array, Void.class, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire(array, 0, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetAcquire(array, 0, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndSetAcquire(array, 0, '\u0123', Void.class);
+ });
+
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ char x = (char) vh.getAndSetRelease(null, 0, '\u0123');
+ });
+ checkCCE(() -> { // array reference class
+ char x = (char) vh.getAndSetRelease(Void.class, 0, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndSetRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // reciarrayever primitive class
+ char x = (char) vh.getAndSetRelease(0, 0, '\u0123');
+ });
+ checkWMTE(() -> { // index reference class
+ char x = (char) vh.getAndSetRelease(array, Void.class, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease(array, 0, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetRelease(array, 0, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndSetRelease(array, 0, '\u0123', Void.class);
+ });
+
// GetAndAdd
// Incorrect argument types
checkNPE(() -> { // null array
@@ -1871,6 +2656,72 @@
});
+ // GetAndAddAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ char x = (char) vh.getAndAddAcquire(null, 0, '\u0123');
+ });
+ checkCCE(() -> { // array reference class
+ char x = (char) vh.getAndAddAcquire(Void.class, 0, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndAddAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ char x = (char) vh.getAndAddAcquire(0, 0, '\u0123');
+ });
+ checkWMTE(() -> { // index reference class
+ char x = (char) vh.getAndAddAcquire(array, Void.class, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddAcquire(array, 0, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddAcquire(array, 0, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndAddAcquire();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndAddAcquire(array, 0, '\u0123', Void.class);
+ });
+
+
+ // GetAndAddRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ char x = (char) vh.getAndAddRelease(null, 0, '\u0123');
+ });
+ checkCCE(() -> { // array reference class
+ char x = (char) vh.getAndAddRelease(Void.class, 0, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndAddRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ char x = (char) vh.getAndAddRelease(0, 0, '\u0123');
+ });
+ checkWMTE(() -> { // index reference class
+ char x = (char) vh.getAndAddRelease(array, Void.class, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddRelease(array, 0, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddRelease(array, 0, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndAddRelease();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndAddRelease(array, 0, '\u0123', Void.class);
+ });
+
+
// AddAndGet
// Incorrect argument types
checkNPE(() -> { // null array
@@ -1902,6 +2753,302 @@
checkWMTE(() -> { // >
char x = (char) vh.addAndGet(array, 0, '\u0123', Void.class);
});
+
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ char x = (char) vh.getAndBitwiseOr(null, 0, '\u0123');
+ });
+ checkCCE(() -> { // array reference class
+ char x = (char) vh.getAndBitwiseOr(Void.class, 0, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseOr(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ char x = (char) vh.getAndBitwiseOr(0, 0, '\u0123');
+ });
+ checkWMTE(() -> { // index reference class
+ char x = (char) vh.getAndBitwiseOr(array, Void.class, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(array, 0, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr(array, 0, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseOr(array, 0, '\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ char x = (char) vh.getAndBitwiseOrAcquire(null, 0, '\u0123');
+ });
+ checkCCE(() -> { // array reference class
+ char x = (char) vh.getAndBitwiseOrAcquire(Void.class, 0, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseOrAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ char x = (char) vh.getAndBitwiseOrAcquire(0, 0, '\u0123');
+ });
+ checkWMTE(() -> { // index reference class
+ char x = (char) vh.getAndBitwiseOrAcquire(array, Void.class, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseOrAcquire(array, 0, '\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseOrRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ char x = (char) vh.getAndBitwiseOrRelease(null, 0, '\u0123');
+ });
+ checkCCE(() -> { // array reference class
+ char x = (char) vh.getAndBitwiseOrRelease(Void.class, 0, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseOrRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ char x = (char) vh.getAndBitwiseOrRelease(0, 0, '\u0123');
+ });
+ checkWMTE(() -> { // index reference class
+ char x = (char) vh.getAndBitwiseOrRelease(array, Void.class, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseOrRelease();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseOrRelease(array, 0, '\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ char x = (char) vh.getAndBitwiseAnd(null, 0, '\u0123');
+ });
+ checkCCE(() -> { // array reference class
+ char x = (char) vh.getAndBitwiseAnd(Void.class, 0, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseAnd(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ char x = (char) vh.getAndBitwiseAnd(0, 0, '\u0123');
+ });
+ checkWMTE(() -> { // index reference class
+ char x = (char) vh.getAndBitwiseAnd(array, Void.class, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(array, 0, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseAnd(array, 0, '\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ char x = (char) vh.getAndBitwiseAndAcquire(null, 0, '\u0123');
+ });
+ checkCCE(() -> { // array reference class
+ char x = (char) vh.getAndBitwiseAndAcquire(Void.class, 0, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseAndAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ char x = (char) vh.getAndBitwiseAndAcquire(0, 0, '\u0123');
+ });
+ checkWMTE(() -> { // index reference class
+ char x = (char) vh.getAndBitwiseAndAcquire(array, Void.class, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseAndAcquire(array, 0, '\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseAndRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ char x = (char) vh.getAndBitwiseAndRelease(null, 0, '\u0123');
+ });
+ checkCCE(() -> { // array reference class
+ char x = (char) vh.getAndBitwiseAndRelease(Void.class, 0, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseAndRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ char x = (char) vh.getAndBitwiseAndRelease(0, 0, '\u0123');
+ });
+ checkWMTE(() -> { // index reference class
+ char x = (char) vh.getAndBitwiseAndRelease(array, Void.class, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseAndRelease();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseAndRelease(array, 0, '\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ char x = (char) vh.getAndBitwiseXor(null, 0, '\u0123');
+ });
+ checkCCE(() -> { // array reference class
+ char x = (char) vh.getAndBitwiseXor(Void.class, 0, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseXor(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ char x = (char) vh.getAndBitwiseXor(0, 0, '\u0123');
+ });
+ checkWMTE(() -> { // index reference class
+ char x = (char) vh.getAndBitwiseXor(array, Void.class, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(array, 0, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor(array, 0, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseXor(array, 0, '\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ char x = (char) vh.getAndBitwiseXorAcquire(null, 0, '\u0123');
+ });
+ checkCCE(() -> { // array reference class
+ char x = (char) vh.getAndBitwiseXorAcquire(Void.class, 0, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseXorAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ char x = (char) vh.getAndBitwiseXorAcquire(0, 0, '\u0123');
+ });
+ checkWMTE(() -> { // index reference class
+ char x = (char) vh.getAndBitwiseXorAcquire(array, Void.class, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseXorAcquire(array, 0, '\u0123', Void.class);
+ });
+
+
+ // GetAndBitwiseXorRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ char x = (char) vh.getAndBitwiseXorRelease(null, 0, '\u0123');
+ });
+ checkCCE(() -> { // array reference class
+ char x = (char) vh.getAndBitwiseXorRelease(Void.class, 0, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) vh.getAndBitwiseXorRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ char x = (char) vh.getAndBitwiseXorRelease(0, 0, '\u0123');
+ });
+ checkWMTE(() -> { // index reference class
+ char x = (char) vh.getAndBitwiseXorRelease(array, Void.class, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) vh.getAndBitwiseXorRelease();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) vh.getAndBitwiseXorRelease(array, 0, '\u0123', Void.class);
+ });
}
static void testArrayWrongMethodType(Handles hs) throws Throwable {
@@ -2144,6 +3291,48 @@
invokeExact(array, 0, '\u0123', Void.class);
});
}
+
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ char x = (char) hs.get(am, methodType(char.class, char[].class, int.class, char.class)).
+ invokeExact((char[]) null, 0, '\u0123');
+ });
+ hs.checkWMTEOrCCE(() -> { // array reference class
+ char x = (char) hs.get(am, methodType(char.class, Class.class, int.class, char.class)).
+ invokeExact(Void.class, 0, '\u0123');
+ });
+ checkWMTE(() -> { // value reference class
+ char x = (char) hs.get(am, methodType(char.class, char[].class, int.class, Class.class)).
+ invokeExact(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ char x = (char) hs.get(am, methodType(char.class, int.class, int.class, char.class)).
+ invokeExact(0, 0, '\u0123');
+ });
+ checkWMTE(() -> { // index reference class
+ char x = (char) hs.get(am, methodType(char.class, char[].class, Class.class, char.class)).
+ invokeExact(array, Void.class, '\u0123');
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, char[].class, int.class, char.class)).
+ invokeExact(array, 0, '\u0123');
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, char[].class, int.class, char.class)).
+ invokeExact(array, 0, '\u0123');
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ char x = (char) hs.get(am, methodType(char.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ char x = (char) hs.get(am, methodType(char.class, char[].class, int.class, char.class, Class.class)).
+ invokeExact(array, 0, '\u0123', Void.class);
+ });
+ }
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java Thu Sep 01 10:16:57 2016 -0700
@@ -582,6 +582,64 @@
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 @@
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 @@
checkWMTE(() -> { // >
double x = (double) vh.addAndGet(recv, 1.0d, Void.class);
});
+
}
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeDouble recv, Handles hs) throws Throwable {
@@ -853,6 +969,7 @@
invokeExact(recv, 1.0d, Void.class);
});
}
+
}
@@ -1143,6 +1260,48 @@
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 @@
});
+ // 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 @@
checkWMTE(() -> { // >
double x = (double) vh.addAndGet(1.0d, Void.class);
});
+
}
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
@@ -1322,6 +1524,7 @@
invokeExact(1.0d, Void.class);
});
}
+
}
@@ -1838,6 +2041,72 @@
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 @@
});
+ // 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 @@
checkWMTE(() -> { // >
double x = (double) vh.addAndGet(array, 0, 1.0d, Void.class);
});
+
}
static void testArrayWrongMethodType(Handles hs) throws Throwable {
@@ -2144,6 +2480,7 @@
invokeExact(array, 0, 1.0d, Void.class);
});
}
+
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java Thu Sep 01 10:16:57 2016 -0700
@@ -582,6 +582,64 @@
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 @@
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 @@
checkWMTE(() -> { // >
float x = (float) vh.addAndGet(recv, 1.0f, Void.class);
});
+
}
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeFloat recv, Handles hs) throws Throwable {
@@ -853,6 +969,7 @@
invokeExact(recv, 1.0f, Void.class);
});
}
+
}
@@ -1143,6 +1260,48 @@
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 @@
});
+ // 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 @@
checkWMTE(() -> { // >
float x = (float) vh.addAndGet(1.0f, Void.class);
});
+
}
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
@@ -1322,6 +1524,7 @@
invokeExact(1.0f, Void.class);
});
}
+
}
@@ -1838,6 +2041,72 @@
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 @@
});
+ // 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 @@
checkWMTE(() -> { // >
float x = (float) vh.addAndGet(array, 0, 1.0f, Void.class);
});
+
}
static void testArrayWrongMethodType(Handles hs) throws Throwable {
@@ -2144,6 +2480,7 @@
invokeExact(array, 0, 1.0f, Void.class);
});
}
+
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java Thu Sep 01 10:16:57 2016 -0700
@@ -582,6 +582,64 @@
int x = (int) vh.getAndSet(recv, 0x01234567, Void.class);
});
+ // GetAndSetAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ int x = (int) vh.getAndSetAcquire(null, 0x01234567);
+ });
+ checkCCE(() -> { // receiver reference class
+ int x = (int) vh.getAndSetAcquire(Void.class, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndSetAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ int x = (int) vh.getAndSetAcquire(0, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire(recv, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetAcquire(recv, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndSetAcquire(recv, 0x01234567, Void.class);
+ });
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ int x = (int) vh.getAndSetRelease(null, 0x01234567);
+ });
+ checkCCE(() -> { // receiver reference class
+ int x = (int) vh.getAndSetRelease(Void.class, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndSetRelease(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ int x = (int) vh.getAndSetRelease(0, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease(recv, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetRelease(recv, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndSetRelease(recv, 0x01234567, Void.class);
+ });
+
// GetAndAdd
// Incorrect argument types
checkNPE(() -> { // null receiver
@@ -611,6 +669,63 @@
int x = (int) vh.getAndAdd(recv, 0x01234567, Void.class);
});
+ // GetAndAddAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ int x = (int) vh.getAndAddAcquire(null, 0x01234567);
+ });
+ checkCCE(() -> { // receiver reference class
+ int x = (int) vh.getAndAddAcquire(Void.class, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndAddAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ int x = (int) vh.getAndAddAcquire(0, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddAcquire(recv, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddAcquire(recv, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndAddAcquire();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndAddAcquire(recv, 0x01234567, Void.class);
+ });
+
+ // GetAndAddRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ int x = (int) vh.getAndAddRelease(null, 0x01234567);
+ });
+ checkCCE(() -> { // receiver reference class
+ int x = (int) vh.getAndAddRelease(Void.class, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndAddRelease(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ int x = (int) vh.getAndAddRelease(0, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddRelease(recv, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddRelease(recv, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndAddRelease();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndAddRelease(recv, 0x01234567, Void.class);
+ });
// AddAndGet
// Incorrect argument types
@@ -640,6 +755,275 @@
checkWMTE(() -> { // >
int x = (int) vh.addAndGet(recv, 0x01234567, Void.class);
});
+
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ int x = (int) vh.getAndBitwiseOr(null, 0x01234567);
+ });
+ checkCCE(() -> { // receiver reference class
+ int x = (int) vh.getAndBitwiseOr(Void.class, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseOr(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ int x = (int) vh.getAndBitwiseOr(0, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(recv, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr(recv, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseOr(recv, 0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ int x = (int) vh.getAndBitwiseOrAcquire(null, 0x01234567);
+ });
+ checkCCE(() -> { // receiver reference class
+ int x = (int) vh.getAndBitwiseOrAcquire(Void.class, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseOrAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ int x = (int) vh.getAndBitwiseOrAcquire(0, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire(recv, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseOrAcquire(recv, 0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseOrRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ int x = (int) vh.getAndBitwiseOrRelease(null, 0x01234567);
+ });
+ checkCCE(() -> { // receiver reference class
+ int x = (int) vh.getAndBitwiseOr(Void.class, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseOr(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ int x = (int) vh.getAndBitwiseOr(0, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(recv, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr(recv, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseOr(recv, 0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ int x = (int) vh.getAndBitwiseAnd(null, 0x01234567);
+ });
+ checkCCE(() -> { // receiver reference class
+ int x = (int) vh.getAndBitwiseAnd(Void.class, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseAnd(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ int x = (int) vh.getAndBitwiseAnd(0, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(recv, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd(recv, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseAnd(recv, 0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ int x = (int) vh.getAndBitwiseAndAcquire(null, 0x01234567);
+ });
+ checkCCE(() -> { // receiver reference class
+ int x = (int) vh.getAndBitwiseAndAcquire(Void.class, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseAndAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ int x = (int) vh.getAndBitwiseAndAcquire(0, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire(recv, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseAndAcquire(recv, 0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseAndRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ int x = (int) vh.getAndBitwiseAndRelease(null, 0x01234567);
+ });
+ checkCCE(() -> { // receiver reference class
+ int x = (int) vh.getAndBitwiseAnd(Void.class, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseAnd(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ int x = (int) vh.getAndBitwiseAnd(0, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(recv, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd(recv, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseAnd(recv, 0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ int x = (int) vh.getAndBitwiseXor(null, 0x01234567);
+ });
+ checkCCE(() -> { // receiver reference class
+ int x = (int) vh.getAndBitwiseXor(Void.class, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseXor(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ int x = (int) vh.getAndBitwiseXor(0, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(recv, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor(recv, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseXor(recv, 0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ int x = (int) vh.getAndBitwiseXorAcquire(null, 0x01234567);
+ });
+ checkCCE(() -> { // receiver reference class
+ int x = (int) vh.getAndBitwiseXorAcquire(Void.class, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseXorAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ int x = (int) vh.getAndBitwiseXorAcquire(0, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire(recv, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseXorAcquire(recv, 0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseXorRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ int x = (int) vh.getAndBitwiseXorRelease(null, 0x01234567);
+ });
+ checkCCE(() -> { // receiver reference class
+ int x = (int) vh.getAndBitwiseXor(Void.class, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseXor(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ int x = (int) vh.getAndBitwiseXor(0, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(recv, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor(recv, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseXor(recv, 0x01234567, Void.class);
+ });
}
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeInt recv, Handles hs) throws Throwable {
@@ -853,6 +1237,43 @@
invokeExact(recv, 0x01234567, Void.class);
});
}
+
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ checkNPE(() -> { // null receiver
+ int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class)).
+ invokeExact((VarHandleTestMethodTypeInt) null, 0x01234567);
+ });
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
+ int x = (int) hs.get(am, methodType(int.class, Class.class, int.class)).
+ invokeExact(Void.class, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, Class.class)).
+ invokeExact(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ int x = (int) hs.get(am, methodType(int.class, int.class, int.class)).
+ invokeExact(0, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeInt.class, int.class)).
+ invokeExact(recv, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, int.class)).
+ invokeExact(recv, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) hs.get(am, methodType(int.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class)).
+ invokeExact(recv, 0x01234567, Void.class);
+ });
+ }
}
@@ -1143,6 +1564,48 @@
int x = (int) vh.getAndSet(0x01234567, Void.class);
});
+
+ // GetAndSetAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndSetAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire(0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetAcquire(0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndSetAcquire(0x01234567, Void.class);
+ });
+
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndSetRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease(0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetRelease(0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndSetRelease(0x01234567, Void.class);
+ });
+
// GetAndAdd
// Incorrect argument types
checkWMTE(() -> { // value reference class
@@ -1164,6 +1627,48 @@
});
+ // GetAndAddAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndAddAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddAcquire(0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddAcquire(0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndAddAcquire();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndAddAcquire(0x01234567, Void.class);
+ });
+
+
+ // GetAndAddRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndAddRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddRelease(0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddRelease(0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndAddRelease();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndAddRelease(0x01234567, Void.class);
+ });
+
+
// AddAndGet
// Incorrect argument types
checkWMTE(() -> { // value reference class
@@ -1183,6 +1688,194 @@
checkWMTE(() -> { // >
int x = (int) vh.addAndGet(0x01234567, Void.class);
});
+
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseOr(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr(0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseOr(0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseOrAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire(0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseOrAcquire(0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseOrReleaseRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseOrRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrRelease(0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrRelease(0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseOrRelease();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseOrRelease(0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseAnd(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd(0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseAnd(0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseAndAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire(0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseAndAcquire(0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseAndReleaseRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseAndRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndRelease(0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndRelease(0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseAndRelease();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseAndRelease(0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseXor(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor(0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseXor(0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseXorAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire(0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseXorAcquire(0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseXorReleaseRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseXorRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorRelease(0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorRelease(0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseXorRelease();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseXorRelease(0x01234567, Void.class);
+ });
}
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
@@ -1322,6 +2015,32 @@
invokeExact(0x01234567, Void.class);
});
}
+
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ int x = (int) hs.get(am, methodType(int.class, Class.class)).
+ invokeExact(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, int.class)).
+ invokeExact(0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class)).
+ invokeExact(0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) hs.get(am, methodType(int.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) hs.get(am, methodType(int.class, int.class, Class.class)).
+ invokeExact(0x01234567, Void.class);
+ });
+ }
}
@@ -1838,6 +2557,72 @@
int x = (int) vh.getAndSet(array, 0, 0x01234567, Void.class);
});
+
+ // GetAndSetAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ int x = (int) vh.getAndSetAcquire(null, 0, 0x01234567);
+ });
+ checkCCE(() -> { // array reference class
+ int x = (int) vh.getAndSetAcquire(Void.class, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndSetAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // reciarrayever primitive class
+ int x = (int) vh.getAndSetAcquire(0, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // index reference class
+ int x = (int) vh.getAndSetAcquire(array, Void.class, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire(array, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetAcquire(array, 0, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndSetAcquire(array, 0, 0x01234567, Void.class);
+ });
+
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ int x = (int) vh.getAndSetRelease(null, 0, 0x01234567);
+ });
+ checkCCE(() -> { // array reference class
+ int x = (int) vh.getAndSetRelease(Void.class, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndSetRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // reciarrayever primitive class
+ int x = (int) vh.getAndSetRelease(0, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // index reference class
+ int x = (int) vh.getAndSetRelease(array, Void.class, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease(array, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetRelease(array, 0, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndSetRelease(array, 0, 0x01234567, Void.class);
+ });
+
// GetAndAdd
// Incorrect argument types
checkNPE(() -> { // null array
@@ -1871,6 +2656,72 @@
});
+ // GetAndAddAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ int x = (int) vh.getAndAddAcquire(null, 0, 0x01234567);
+ });
+ checkCCE(() -> { // array reference class
+ int x = (int) vh.getAndAddAcquire(Void.class, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndAddAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ int x = (int) vh.getAndAddAcquire(0, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // index reference class
+ int x = (int) vh.getAndAddAcquire(array, Void.class, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddAcquire(array, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddAcquire(array, 0, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndAddAcquire();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndAddAcquire(array, 0, 0x01234567, Void.class);
+ });
+
+
+ // GetAndAddRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ int x = (int) vh.getAndAddRelease(null, 0, 0x01234567);
+ });
+ checkCCE(() -> { // array reference class
+ int x = (int) vh.getAndAddRelease(Void.class, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndAddRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ int x = (int) vh.getAndAddRelease(0, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // index reference class
+ int x = (int) vh.getAndAddRelease(array, Void.class, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddRelease(array, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddRelease(array, 0, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndAddRelease();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndAddRelease(array, 0, 0x01234567, Void.class);
+ });
+
+
// AddAndGet
// Incorrect argument types
checkNPE(() -> { // null array
@@ -1902,6 +2753,302 @@
checkWMTE(() -> { // >
int x = (int) vh.addAndGet(array, 0, 0x01234567, Void.class);
});
+
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ int x = (int) vh.getAndBitwiseOr(null, 0, 0x01234567);
+ });
+ checkCCE(() -> { // array reference class
+ int x = (int) vh.getAndBitwiseOr(Void.class, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseOr(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ int x = (int) vh.getAndBitwiseOr(0, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // index reference class
+ int x = (int) vh.getAndBitwiseOr(array, Void.class, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(array, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr(array, 0, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseOr(array, 0, 0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ int x = (int) vh.getAndBitwiseOrAcquire(null, 0, 0x01234567);
+ });
+ checkCCE(() -> { // array reference class
+ int x = (int) vh.getAndBitwiseOrAcquire(Void.class, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseOrAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ int x = (int) vh.getAndBitwiseOrAcquire(0, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // index reference class
+ int x = (int) vh.getAndBitwiseOrAcquire(array, Void.class, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseOrAcquire(array, 0, 0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseOrRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ int x = (int) vh.getAndBitwiseOrRelease(null, 0, 0x01234567);
+ });
+ checkCCE(() -> { // array reference class
+ int x = (int) vh.getAndBitwiseOrRelease(Void.class, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseOrRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ int x = (int) vh.getAndBitwiseOrRelease(0, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // index reference class
+ int x = (int) vh.getAndBitwiseOrRelease(array, Void.class, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseOrRelease();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseOrRelease(array, 0, 0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ int x = (int) vh.getAndBitwiseAnd(null, 0, 0x01234567);
+ });
+ checkCCE(() -> { // array reference class
+ int x = (int) vh.getAndBitwiseAnd(Void.class, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseAnd(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ int x = (int) vh.getAndBitwiseAnd(0, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // index reference class
+ int x = (int) vh.getAndBitwiseAnd(array, Void.class, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(array, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseAnd(array, 0, 0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ int x = (int) vh.getAndBitwiseAndAcquire(null, 0, 0x01234567);
+ });
+ checkCCE(() -> { // array reference class
+ int x = (int) vh.getAndBitwiseAndAcquire(Void.class, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseAndAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ int x = (int) vh.getAndBitwiseAndAcquire(0, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // index reference class
+ int x = (int) vh.getAndBitwiseAndAcquire(array, Void.class, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseAndAcquire(array, 0, 0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseAndRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ int x = (int) vh.getAndBitwiseAndRelease(null, 0, 0x01234567);
+ });
+ checkCCE(() -> { // array reference class
+ int x = (int) vh.getAndBitwiseAndRelease(Void.class, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseAndRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ int x = (int) vh.getAndBitwiseAndRelease(0, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // index reference class
+ int x = (int) vh.getAndBitwiseAndRelease(array, Void.class, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseAndRelease();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseAndRelease(array, 0, 0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ int x = (int) vh.getAndBitwiseXor(null, 0, 0x01234567);
+ });
+ checkCCE(() -> { // array reference class
+ int x = (int) vh.getAndBitwiseXor(Void.class, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseXor(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ int x = (int) vh.getAndBitwiseXor(0, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // index reference class
+ int x = (int) vh.getAndBitwiseXor(array, Void.class, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(array, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor(array, 0, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseXor(array, 0, 0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ int x = (int) vh.getAndBitwiseXorAcquire(null, 0, 0x01234567);
+ });
+ checkCCE(() -> { // array reference class
+ int x = (int) vh.getAndBitwiseXorAcquire(Void.class, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseXorAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ int x = (int) vh.getAndBitwiseXorAcquire(0, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // index reference class
+ int x = (int) vh.getAndBitwiseXorAcquire(array, Void.class, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseXorAcquire(array, 0, 0x01234567, Void.class);
+ });
+
+
+ // GetAndBitwiseXorRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ int x = (int) vh.getAndBitwiseXorRelease(null, 0, 0x01234567);
+ });
+ checkCCE(() -> { // array reference class
+ int x = (int) vh.getAndBitwiseXorRelease(Void.class, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) vh.getAndBitwiseXorRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ int x = (int) vh.getAndBitwiseXorRelease(0, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // index reference class
+ int x = (int) vh.getAndBitwiseXorRelease(array, Void.class, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) vh.getAndBitwiseXorRelease();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) vh.getAndBitwiseXorRelease(array, 0, 0x01234567, Void.class);
+ });
}
static void testArrayWrongMethodType(Handles hs) throws Throwable {
@@ -2144,6 +3291,48 @@
invokeExact(array, 0, 0x01234567, Void.class);
});
}
+
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class)).
+ invokeExact((int[]) null, 0, 0x01234567);
+ });
+ hs.checkWMTEOrCCE(() -> { // array reference class
+ int x = (int) hs.get(am, methodType(int.class, Class.class, int.class, int.class)).
+ invokeExact(Void.class, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // value reference class
+ int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, Class.class)).
+ invokeExact(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ int x = (int) hs.get(am, methodType(int.class, int.class, int.class, int.class)).
+ invokeExact(0, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // index reference class
+ int x = (int) hs.get(am, methodType(int.class, int[].class, Class.class, int.class)).
+ invokeExact(array, Void.class, 0x01234567);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, int[].class, int.class, int.class)).
+ invokeExact(array, 0, 0x01234567);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class)).
+ invokeExact(array, 0, 0x01234567);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ int x = (int) hs.get(am, methodType(int.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class, Class.class)).
+ invokeExact(array, 0, 0x01234567, Void.class);
+ });
+ }
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java Thu Sep 01 10:16:57 2016 -0700
@@ -582,6 +582,64 @@
long x = (long) vh.getAndSet(recv, 0x0123456789ABCDEFL, Void.class);
});
+ // GetAndSetAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ long x = (long) vh.getAndSetAcquire(null, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // receiver reference class
+ long x = (long) vh.getAndSetAcquire(Void.class, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndSetAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ long x = (long) vh.getAndSetAcquire(0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire(recv, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetAcquire(recv, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndSetAcquire(recv, 0x0123456789ABCDEFL, Void.class);
+ });
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ long x = (long) vh.getAndSetRelease(null, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // receiver reference class
+ long x = (long) vh.getAndSetRelease(Void.class, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndSetRelease(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ long x = (long) vh.getAndSetRelease(0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease(recv, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetRelease(recv, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndSetRelease(recv, 0x0123456789ABCDEFL, Void.class);
+ });
+
// GetAndAdd
// Incorrect argument types
checkNPE(() -> { // null receiver
@@ -611,6 +669,63 @@
long x = (long) vh.getAndAdd(recv, 0x0123456789ABCDEFL, Void.class);
});
+ // GetAndAddAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ long x = (long) vh.getAndAddAcquire(null, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // receiver reference class
+ long x = (long) vh.getAndAddAcquire(Void.class, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndAddAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ long x = (long) vh.getAndAddAcquire(0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddAcquire(recv, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddAcquire(recv, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndAddAcquire();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndAddAcquire(recv, 0x0123456789ABCDEFL, Void.class);
+ });
+
+ // GetAndAddRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ long x = (long) vh.getAndAddRelease(null, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // receiver reference class
+ long x = (long) vh.getAndAddRelease(Void.class, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndAddRelease(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ long x = (long) vh.getAndAddRelease(0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddRelease(recv, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddRelease(recv, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndAddRelease();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndAddRelease(recv, 0x0123456789ABCDEFL, Void.class);
+ });
// AddAndGet
// Incorrect argument types
@@ -640,6 +755,275 @@
checkWMTE(() -> { // >
long x = (long) vh.addAndGet(recv, 0x0123456789ABCDEFL, Void.class);
});
+
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ long x = (long) vh.getAndBitwiseOr(null, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // receiver reference class
+ long x = (long) vh.getAndBitwiseOr(Void.class, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseOr(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ long x = (long) vh.getAndBitwiseOr(0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(recv, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr(recv, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseOr(recv, 0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ long x = (long) vh.getAndBitwiseOrAcquire(null, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // receiver reference class
+ long x = (long) vh.getAndBitwiseOrAcquire(Void.class, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseOrAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ long x = (long) vh.getAndBitwiseOrAcquire(0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire(recv, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseOrAcquire(recv, 0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseOrRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ long x = (long) vh.getAndBitwiseOrRelease(null, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // receiver reference class
+ long x = (long) vh.getAndBitwiseOr(Void.class, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseOr(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ long x = (long) vh.getAndBitwiseOr(0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(recv, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr(recv, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseOr(recv, 0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ long x = (long) vh.getAndBitwiseAnd(null, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // receiver reference class
+ long x = (long) vh.getAndBitwiseAnd(Void.class, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseAnd(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ long x = (long) vh.getAndBitwiseAnd(0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(recv, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd(recv, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseAnd(recv, 0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ long x = (long) vh.getAndBitwiseAndAcquire(null, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // receiver reference class
+ long x = (long) vh.getAndBitwiseAndAcquire(Void.class, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseAndAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ long x = (long) vh.getAndBitwiseAndAcquire(0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire(recv, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseAndAcquire(recv, 0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseAndRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ long x = (long) vh.getAndBitwiseAndRelease(null, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // receiver reference class
+ long x = (long) vh.getAndBitwiseAnd(Void.class, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseAnd(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ long x = (long) vh.getAndBitwiseAnd(0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(recv, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd(recv, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseAnd(recv, 0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ long x = (long) vh.getAndBitwiseXor(null, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // receiver reference class
+ long x = (long) vh.getAndBitwiseXor(Void.class, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseXor(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ long x = (long) vh.getAndBitwiseXor(0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(recv, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor(recv, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseXor(recv, 0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ long x = (long) vh.getAndBitwiseXorAcquire(null, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // receiver reference class
+ long x = (long) vh.getAndBitwiseXorAcquire(Void.class, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseXorAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ long x = (long) vh.getAndBitwiseXorAcquire(0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire(recv, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseXorAcquire(recv, 0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseXorRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ long x = (long) vh.getAndBitwiseXorRelease(null, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // receiver reference class
+ long x = (long) vh.getAndBitwiseXor(Void.class, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseXor(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ long x = (long) vh.getAndBitwiseXor(0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(recv, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor(recv, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseXor(recv, 0x0123456789ABCDEFL, Void.class);
+ });
}
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeLong recv, Handles hs) throws Throwable {
@@ -853,6 +1237,43 @@
invokeExact(recv, 0x0123456789ABCDEFL, Void.class);
});
}
+
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ checkNPE(() -> { // null receiver
+ long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class)).
+ invokeExact((VarHandleTestMethodTypeLong) null, 0x0123456789ABCDEFL);
+ });
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
+ long x = (long) hs.get(am, methodType(long.class, Class.class, long.class)).
+ invokeExact(Void.class, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, Class.class)).
+ invokeExact(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ long x = (long) hs.get(am, methodType(long.class, int.class, long.class)).
+ invokeExact(0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeLong.class, long.class)).
+ invokeExact(recv, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, long.class)).
+ invokeExact(recv, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) hs.get(am, methodType(long.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class)).
+ invokeExact(recv, 0x0123456789ABCDEFL, Void.class);
+ });
+ }
}
@@ -1143,6 +1564,48 @@
long x = (long) vh.getAndSet(0x0123456789ABCDEFL, Void.class);
});
+
+ // GetAndSetAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndSetAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire(0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetAcquire(0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndSetAcquire(0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndSetRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease(0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetRelease(0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndSetRelease(0x0123456789ABCDEFL, Void.class);
+ });
+
// GetAndAdd
// Incorrect argument types
checkWMTE(() -> { // value reference class
@@ -1164,6 +1627,48 @@
});
+ // GetAndAddAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndAddAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddAcquire(0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddAcquire(0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndAddAcquire();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndAddAcquire(0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndAddRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndAddRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddRelease(0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddRelease(0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndAddRelease();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndAddRelease(0x0123456789ABCDEFL, Void.class);
+ });
+
+
// AddAndGet
// Incorrect argument types
checkWMTE(() -> { // value reference class
@@ -1183,6 +1688,194 @@
checkWMTE(() -> { // >
long x = (long) vh.addAndGet(0x0123456789ABCDEFL, Void.class);
});
+
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseOr(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr(0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseOr(0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseOrAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire(0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseOrAcquire(0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseOrReleaseRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseOrRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrRelease(0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrRelease(0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseOrRelease();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseOrRelease(0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseAnd(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd(0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseAnd(0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseAndAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire(0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseAndAcquire(0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseAndReleaseRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseAndRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndRelease(0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndRelease(0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseAndRelease();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseAndRelease(0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseXor(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor(0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseXor(0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseXorAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire(0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseXorAcquire(0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseXorReleaseRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseXorRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorRelease(0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorRelease(0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseXorRelease();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseXorRelease(0x0123456789ABCDEFL, Void.class);
+ });
}
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
@@ -1322,6 +2015,32 @@
invokeExact(0x0123456789ABCDEFL, Void.class);
});
}
+
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ long x = (long) hs.get(am, methodType(long.class, Class.class)).
+ invokeExact(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, long.class)).
+ invokeExact(0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, long.class)).
+ invokeExact(0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) hs.get(am, methodType(long.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) hs.get(am, methodType(long.class, long.class, Class.class)).
+ invokeExact(0x0123456789ABCDEFL, Void.class);
+ });
+ }
}
@@ -1838,6 +2557,72 @@
long x = (long) vh.getAndSet(array, 0, 0x0123456789ABCDEFL, Void.class);
});
+
+ // GetAndSetAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ long x = (long) vh.getAndSetAcquire(null, 0, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // array reference class
+ long x = (long) vh.getAndSetAcquire(Void.class, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndSetAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // reciarrayever primitive class
+ long x = (long) vh.getAndSetAcquire(0, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // index reference class
+ long x = (long) vh.getAndSetAcquire(array, Void.class, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire(array, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetAcquire(array, 0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndSetAcquire(array, 0, 0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ long x = (long) vh.getAndSetRelease(null, 0, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // array reference class
+ long x = (long) vh.getAndSetRelease(Void.class, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndSetRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // reciarrayever primitive class
+ long x = (long) vh.getAndSetRelease(0, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // index reference class
+ long x = (long) vh.getAndSetRelease(array, Void.class, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease(array, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetRelease(array, 0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndSetRelease(array, 0, 0x0123456789ABCDEFL, Void.class);
+ });
+
// GetAndAdd
// Incorrect argument types
checkNPE(() -> { // null array
@@ -1871,6 +2656,72 @@
});
+ // GetAndAddAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ long x = (long) vh.getAndAddAcquire(null, 0, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // array reference class
+ long x = (long) vh.getAndAddAcquire(Void.class, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndAddAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ long x = (long) vh.getAndAddAcquire(0, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // index reference class
+ long x = (long) vh.getAndAddAcquire(array, Void.class, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddAcquire(array, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddAcquire(array, 0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndAddAcquire();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndAddAcquire(array, 0, 0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndAddRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ long x = (long) vh.getAndAddRelease(null, 0, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // array reference class
+ long x = (long) vh.getAndAddRelease(Void.class, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndAddRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ long x = (long) vh.getAndAddRelease(0, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // index reference class
+ long x = (long) vh.getAndAddRelease(array, Void.class, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddRelease(array, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddRelease(array, 0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndAddRelease();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndAddRelease(array, 0, 0x0123456789ABCDEFL, Void.class);
+ });
+
+
// AddAndGet
// Incorrect argument types
checkNPE(() -> { // null array
@@ -1902,6 +2753,302 @@
checkWMTE(() -> { // >
long x = (long) vh.addAndGet(array, 0, 0x0123456789ABCDEFL, Void.class);
});
+
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ long x = (long) vh.getAndBitwiseOr(null, 0, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // array reference class
+ long x = (long) vh.getAndBitwiseOr(Void.class, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseOr(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ long x = (long) vh.getAndBitwiseOr(0, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // index reference class
+ long x = (long) vh.getAndBitwiseOr(array, Void.class, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(array, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr(array, 0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseOr(array, 0, 0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ long x = (long) vh.getAndBitwiseOrAcquire(null, 0, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // array reference class
+ long x = (long) vh.getAndBitwiseOrAcquire(Void.class, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseOrAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ long x = (long) vh.getAndBitwiseOrAcquire(0, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // index reference class
+ long x = (long) vh.getAndBitwiseOrAcquire(array, Void.class, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseOrAcquire(array, 0, 0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseOrRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ long x = (long) vh.getAndBitwiseOrRelease(null, 0, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // array reference class
+ long x = (long) vh.getAndBitwiseOrRelease(Void.class, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseOrRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ long x = (long) vh.getAndBitwiseOrRelease(0, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // index reference class
+ long x = (long) vh.getAndBitwiseOrRelease(array, Void.class, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseOrRelease();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseOrRelease(array, 0, 0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ long x = (long) vh.getAndBitwiseAnd(null, 0, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // array reference class
+ long x = (long) vh.getAndBitwiseAnd(Void.class, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseAnd(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ long x = (long) vh.getAndBitwiseAnd(0, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // index reference class
+ long x = (long) vh.getAndBitwiseAnd(array, Void.class, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(array, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseAnd(array, 0, 0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ long x = (long) vh.getAndBitwiseAndAcquire(null, 0, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // array reference class
+ long x = (long) vh.getAndBitwiseAndAcquire(Void.class, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseAndAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ long x = (long) vh.getAndBitwiseAndAcquire(0, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // index reference class
+ long x = (long) vh.getAndBitwiseAndAcquire(array, Void.class, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseAndAcquire(array, 0, 0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseAndRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ long x = (long) vh.getAndBitwiseAndRelease(null, 0, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // array reference class
+ long x = (long) vh.getAndBitwiseAndRelease(Void.class, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseAndRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ long x = (long) vh.getAndBitwiseAndRelease(0, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // index reference class
+ long x = (long) vh.getAndBitwiseAndRelease(array, Void.class, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseAndRelease();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseAndRelease(array, 0, 0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ long x = (long) vh.getAndBitwiseXor(null, 0, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // array reference class
+ long x = (long) vh.getAndBitwiseXor(Void.class, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseXor(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ long x = (long) vh.getAndBitwiseXor(0, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // index reference class
+ long x = (long) vh.getAndBitwiseXor(array, Void.class, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(array, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor(array, 0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseXor(array, 0, 0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ long x = (long) vh.getAndBitwiseXorAcquire(null, 0, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // array reference class
+ long x = (long) vh.getAndBitwiseXorAcquire(Void.class, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseXorAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ long x = (long) vh.getAndBitwiseXorAcquire(0, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // index reference class
+ long x = (long) vh.getAndBitwiseXorAcquire(array, Void.class, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseXorAcquire(array, 0, 0x0123456789ABCDEFL, Void.class);
+ });
+
+
+ // GetAndBitwiseXorRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ long x = (long) vh.getAndBitwiseXorRelease(null, 0, 0x0123456789ABCDEFL);
+ });
+ checkCCE(() -> { // array reference class
+ long x = (long) vh.getAndBitwiseXorRelease(Void.class, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) vh.getAndBitwiseXorRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ long x = (long) vh.getAndBitwiseXorRelease(0, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // index reference class
+ long x = (long) vh.getAndBitwiseXorRelease(array, Void.class, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) vh.getAndBitwiseXorRelease();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) vh.getAndBitwiseXorRelease(array, 0, 0x0123456789ABCDEFL, Void.class);
+ });
}
static void testArrayWrongMethodType(Handles hs) throws Throwable {
@@ -2144,6 +3291,48 @@
invokeExact(array, 0, 0x0123456789ABCDEFL, Void.class);
});
}
+
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class)).
+ invokeExact((long[]) null, 0, 0x0123456789ABCDEFL);
+ });
+ hs.checkWMTEOrCCE(() -> { // array reference class
+ long x = (long) hs.get(am, methodType(long.class, Class.class, int.class, long.class)).
+ invokeExact(Void.class, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // value reference class
+ long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, Class.class)).
+ invokeExact(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ long x = (long) hs.get(am, methodType(long.class, int.class, int.class, long.class)).
+ invokeExact(0, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // index reference class
+ long x = (long) hs.get(am, methodType(long.class, long[].class, Class.class, long.class)).
+ invokeExact(array, Void.class, 0x0123456789ABCDEFL);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, long[].class, int.class, long.class)).
+ invokeExact(array, 0, 0x0123456789ABCDEFL);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class)).
+ invokeExact(array, 0, 0x0123456789ABCDEFL);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ long x = (long) hs.get(am, methodType(long.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class, Class.class)).
+ invokeExact(array, 0, 0x0123456789ABCDEFL, Void.class);
+ });
+ }
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java Thu Sep 01 10:16:57 2016 -0700
@@ -582,6 +582,64 @@
short x = (short) vh.getAndSet(recv, (short)0x0123, Void.class);
});
+ // GetAndSetAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ short x = (short) vh.getAndSetAcquire(null, (short)0x0123);
+ });
+ checkCCE(() -> { // receiver reference class
+ short x = (short) vh.getAndSetAcquire(Void.class, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndSetAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ short x = (short) vh.getAndSetAcquire(0, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire(recv, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetAcquire(recv, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndSetAcquire(recv, (short)0x0123, Void.class);
+ });
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ short x = (short) vh.getAndSetRelease(null, (short)0x0123);
+ });
+ checkCCE(() -> { // receiver reference class
+ short x = (short) vh.getAndSetRelease(Void.class, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndSetRelease(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ short x = (short) vh.getAndSetRelease(0, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease(recv, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetRelease(recv, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndSetRelease(recv, (short)0x0123, Void.class);
+ });
+
// GetAndAdd
// Incorrect argument types
checkNPE(() -> { // null receiver
@@ -611,6 +669,63 @@
short x = (short) vh.getAndAdd(recv, (short)0x0123, Void.class);
});
+ // GetAndAddAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ short x = (short) vh.getAndAddAcquire(null, (short)0x0123);
+ });
+ checkCCE(() -> { // receiver reference class
+ short x = (short) vh.getAndAddAcquire(Void.class, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndAddAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ short x = (short) vh.getAndAddAcquire(0, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddAcquire(recv, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddAcquire(recv, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndAddAcquire();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndAddAcquire(recv, (short)0x0123, Void.class);
+ });
+
+ // GetAndAddRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ short x = (short) vh.getAndAddRelease(null, (short)0x0123);
+ });
+ checkCCE(() -> { // receiver reference class
+ short x = (short) vh.getAndAddRelease(Void.class, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndAddRelease(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ short x = (short) vh.getAndAddRelease(0, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddRelease(recv, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddRelease(recv, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndAddRelease();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndAddRelease(recv, (short)0x0123, Void.class);
+ });
// AddAndGet
// Incorrect argument types
@@ -640,6 +755,275 @@
checkWMTE(() -> { // >
short x = (short) vh.addAndGet(recv, (short)0x0123, Void.class);
});
+
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ short x = (short) vh.getAndBitwiseOr(null, (short)0x0123);
+ });
+ checkCCE(() -> { // receiver reference class
+ short x = (short) vh.getAndBitwiseOr(Void.class, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseOr(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ short x = (short) vh.getAndBitwiseOr(0, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(recv, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr(recv, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseOr(recv, (short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ short x = (short) vh.getAndBitwiseOrAcquire(null, (short)0x0123);
+ });
+ checkCCE(() -> { // receiver reference class
+ short x = (short) vh.getAndBitwiseOrAcquire(Void.class, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseOrAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ short x = (short) vh.getAndBitwiseOrAcquire(0, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire(recv, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseOrAcquire(recv, (short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseOrRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ short x = (short) vh.getAndBitwiseOrRelease(null, (short)0x0123);
+ });
+ checkCCE(() -> { // receiver reference class
+ short x = (short) vh.getAndBitwiseOr(Void.class, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseOr(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ short x = (short) vh.getAndBitwiseOr(0, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(recv, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr(recv, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseOr(recv, (short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ short x = (short) vh.getAndBitwiseAnd(null, (short)0x0123);
+ });
+ checkCCE(() -> { // receiver reference class
+ short x = (short) vh.getAndBitwiseAnd(Void.class, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseAnd(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ short x = (short) vh.getAndBitwiseAnd(0, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(recv, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd(recv, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseAnd(recv, (short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ short x = (short) vh.getAndBitwiseAndAcquire(null, (short)0x0123);
+ });
+ checkCCE(() -> { // receiver reference class
+ short x = (short) vh.getAndBitwiseAndAcquire(Void.class, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseAndAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ short x = (short) vh.getAndBitwiseAndAcquire(0, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire(recv, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseAndAcquire(recv, (short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseAndRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ short x = (short) vh.getAndBitwiseAndRelease(null, (short)0x0123);
+ });
+ checkCCE(() -> { // receiver reference class
+ short x = (short) vh.getAndBitwiseAnd(Void.class, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseAnd(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ short x = (short) vh.getAndBitwiseAnd(0, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(recv, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd(recv, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseAnd(recv, (short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ short x = (short) vh.getAndBitwiseXor(null, (short)0x0123);
+ });
+ checkCCE(() -> { // receiver reference class
+ short x = (short) vh.getAndBitwiseXor(Void.class, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseXor(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ short x = (short) vh.getAndBitwiseXor(0, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(recv, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor(recv, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseXor(recv, (short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ short x = (short) vh.getAndBitwiseXorAcquire(null, (short)0x0123);
+ });
+ checkCCE(() -> { // receiver reference class
+ short x = (short) vh.getAndBitwiseXorAcquire(Void.class, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseXorAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ short x = (short) vh.getAndBitwiseXorAcquire(0, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire(recv, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseXorAcquire(recv, (short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseXorRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ short x = (short) vh.getAndBitwiseXorRelease(null, (short)0x0123);
+ });
+ checkCCE(() -> { // receiver reference class
+ short x = (short) vh.getAndBitwiseXor(Void.class, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseXor(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ short x = (short) vh.getAndBitwiseXor(0, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(recv, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor(recv, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseXor(recv, (short)0x0123, Void.class);
+ });
}
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeShort recv, Handles hs) throws Throwable {
@@ -853,6 +1237,43 @@
invokeExact(recv, (short)0x0123, Void.class);
});
}
+
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ checkNPE(() -> { // null receiver
+ short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, short.class)).
+ invokeExact((VarHandleTestMethodTypeShort) null, (short)0x0123);
+ });
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
+ short x = (short) hs.get(am, methodType(short.class, Class.class, short.class)).
+ invokeExact(Void.class, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, Class.class)).
+ invokeExact(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ short x = (short) hs.get(am, methodType(short.class, int.class, short.class)).
+ invokeExact(0, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeShort.class, short.class)).
+ invokeExact(recv, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeShort.class, short.class)).
+ invokeExact(recv, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) hs.get(am, methodType(short.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, short.class)).
+ invokeExact(recv, (short)0x0123, Void.class);
+ });
+ }
}
@@ -1143,6 +1564,48 @@
short x = (short) vh.getAndSet((short)0x0123, Void.class);
});
+
+ // GetAndSetAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndSetAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire((short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetAcquire((short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndSetAcquire((short)0x0123, Void.class);
+ });
+
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndSetRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease((short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetRelease((short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndSetRelease((short)0x0123, Void.class);
+ });
+
// GetAndAdd
// Incorrect argument types
checkWMTE(() -> { // value reference class
@@ -1164,6 +1627,48 @@
});
+ // GetAndAddAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndAddAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddAcquire((short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddAcquire((short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndAddAcquire();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndAddAcquire((short)0x0123, Void.class);
+ });
+
+
+ // GetAndAddRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndAddRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddRelease((short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddRelease((short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndAddRelease();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndAddRelease((short)0x0123, Void.class);
+ });
+
+
// AddAndGet
// Incorrect argument types
checkWMTE(() -> { // value reference class
@@ -1183,6 +1688,194 @@
checkWMTE(() -> { // >
short x = (short) vh.addAndGet((short)0x0123, Void.class);
});
+
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseOr(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr((short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr((short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseOr((short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseOrAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire((short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire((short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseOrAcquire((short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseOrReleaseRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseOrRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrRelease((short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrRelease((short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseOrRelease();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseOrRelease((short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseAnd(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd((short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd((short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseAnd((short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseAndAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire((short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire((short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseAndAcquire((short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseAndReleaseRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseAndRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndRelease((short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndRelease((short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseAndRelease();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseAndRelease((short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseXor(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor((short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor((short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseXor((short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseXorAcquire(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire((short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire((short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseXorAcquire((short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseXorReleaseRelease
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseXorRelease(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorRelease((short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorRelease((short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseXorRelease();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseXorRelease((short)0x0123, Void.class);
+ });
}
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
@@ -1322,6 +2015,32 @@
invokeExact((short)0x0123, Void.class);
});
}
+
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ // Incorrect argument types
+ checkWMTE(() -> { // value reference class
+ short x = (short) hs.get(am, methodType(short.class, Class.class)).
+ invokeExact(Void.class);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, short.class)).
+ invokeExact((short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, short.class)).
+ invokeExact((short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) hs.get(am, methodType(short.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) hs.get(am, methodType(short.class, short.class, Class.class)).
+ invokeExact((short)0x0123, Void.class);
+ });
+ }
}
@@ -1838,6 +2557,72 @@
short x = (short) vh.getAndSet(array, 0, (short)0x0123, Void.class);
});
+
+ // GetAndSetAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ short x = (short) vh.getAndSetAcquire(null, 0, (short)0x0123);
+ });
+ checkCCE(() -> { // array reference class
+ short x = (short) vh.getAndSetAcquire(Void.class, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndSetAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // reciarrayever primitive class
+ short x = (short) vh.getAndSetAcquire(0, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // index reference class
+ short x = (short) vh.getAndSetAcquire(array, Void.class, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire(array, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetAcquire(array, 0, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndSetAcquire(array, 0, (short)0x0123, Void.class);
+ });
+
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ short x = (short) vh.getAndSetRelease(null, 0, (short)0x0123);
+ });
+ checkCCE(() -> { // array reference class
+ short x = (short) vh.getAndSetRelease(Void.class, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndSetRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // reciarrayever primitive class
+ short x = (short) vh.getAndSetRelease(0, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // index reference class
+ short x = (short) vh.getAndSetRelease(array, Void.class, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease(array, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndSetRelease(array, 0, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndSetRelease(array, 0, (short)0x0123, Void.class);
+ });
+
// GetAndAdd
// Incorrect argument types
checkNPE(() -> { // null array
@@ -1871,6 +2656,72 @@
});
+ // GetAndAddAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ short x = (short) vh.getAndAddAcquire(null, 0, (short)0x0123);
+ });
+ checkCCE(() -> { // array reference class
+ short x = (short) vh.getAndAddAcquire(Void.class, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndAddAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ short x = (short) vh.getAndAddAcquire(0, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // index reference class
+ short x = (short) vh.getAndAddAcquire(array, Void.class, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddAcquire(array, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddAcquire(array, 0, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndAddAcquire();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndAddAcquire(array, 0, (short)0x0123, Void.class);
+ });
+
+
+ // GetAndAddRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ short x = (short) vh.getAndAddRelease(null, 0, (short)0x0123);
+ });
+ checkCCE(() -> { // array reference class
+ short x = (short) vh.getAndAddRelease(Void.class, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndAddRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ short x = (short) vh.getAndAddRelease(0, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // index reference class
+ short x = (short) vh.getAndAddRelease(array, Void.class, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndAddRelease(array, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndAddRelease(array, 0, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndAddRelease();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndAddRelease(array, 0, (short)0x0123, Void.class);
+ });
+
+
// AddAndGet
// Incorrect argument types
checkNPE(() -> { // null array
@@ -1902,6 +2753,302 @@
checkWMTE(() -> { // >
short x = (short) vh.addAndGet(array, 0, (short)0x0123, Void.class);
});
+
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ short x = (short) vh.getAndBitwiseOr(null, 0, (short)0x0123);
+ });
+ checkCCE(() -> { // array reference class
+ short x = (short) vh.getAndBitwiseOr(Void.class, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseOr(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ short x = (short) vh.getAndBitwiseOr(0, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // index reference class
+ short x = (short) vh.getAndBitwiseOr(array, Void.class, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(array, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOr(array, 0, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseOr(array, 0, (short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ short x = (short) vh.getAndBitwiseOrAcquire(null, 0, (short)0x0123);
+ });
+ checkCCE(() -> { // array reference class
+ short x = (short) vh.getAndBitwiseOrAcquire(Void.class, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseOrAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ short x = (short) vh.getAndBitwiseOrAcquire(0, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // index reference class
+ short x = (short) vh.getAndBitwiseOrAcquire(array, Void.class, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseOrAcquire(array, 0, (short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseOrRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ short x = (short) vh.getAndBitwiseOrRelease(null, 0, (short)0x0123);
+ });
+ checkCCE(() -> { // array reference class
+ short x = (short) vh.getAndBitwiseOrRelease(Void.class, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseOrRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ short x = (short) vh.getAndBitwiseOrRelease(0, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // index reference class
+ short x = (short) vh.getAndBitwiseOrRelease(array, Void.class, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseOrRelease();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseOrRelease(array, 0, (short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ short x = (short) vh.getAndBitwiseAnd(null, 0, (short)0x0123);
+ });
+ checkCCE(() -> { // array reference class
+ short x = (short) vh.getAndBitwiseAnd(Void.class, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseAnd(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ short x = (short) vh.getAndBitwiseAnd(0, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // index reference class
+ short x = (short) vh.getAndBitwiseAnd(array, Void.class, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(array, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseAnd(array, 0, (short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ short x = (short) vh.getAndBitwiseAndAcquire(null, 0, (short)0x0123);
+ });
+ checkCCE(() -> { // array reference class
+ short x = (short) vh.getAndBitwiseAndAcquire(Void.class, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseAndAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ short x = (short) vh.getAndBitwiseAndAcquire(0, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // index reference class
+ short x = (short) vh.getAndBitwiseAndAcquire(array, Void.class, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseAndAcquire(array, 0, (short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseAndRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ short x = (short) vh.getAndBitwiseAndRelease(null, 0, (short)0x0123);
+ });
+ checkCCE(() -> { // array reference class
+ short x = (short) vh.getAndBitwiseAndRelease(Void.class, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseAndRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ short x = (short) vh.getAndBitwiseAndRelease(0, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // index reference class
+ short x = (short) vh.getAndBitwiseAndRelease(array, Void.class, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseAndRelease();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseAndRelease(array, 0, (short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ short x = (short) vh.getAndBitwiseXor(null, 0, (short)0x0123);
+ });
+ checkCCE(() -> { // array reference class
+ short x = (short) vh.getAndBitwiseXor(Void.class, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseXor(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ short x = (short) vh.getAndBitwiseXor(0, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // index reference class
+ short x = (short) vh.getAndBitwiseXor(array, Void.class, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(array, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXor(array, 0, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseXor(array, 0, (short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ short x = (short) vh.getAndBitwiseXorAcquire(null, 0, (short)0x0123);
+ });
+ checkCCE(() -> { // array reference class
+ short x = (short) vh.getAndBitwiseXorAcquire(Void.class, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseXorAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ short x = (short) vh.getAndBitwiseXorAcquire(0, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // index reference class
+ short x = (short) vh.getAndBitwiseXorAcquire(array, Void.class, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseXorAcquire(array, 0, (short)0x0123, Void.class);
+ });
+
+
+ // GetAndBitwiseXorRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ short x = (short) vh.getAndBitwiseXorRelease(null, 0, (short)0x0123);
+ });
+ checkCCE(() -> { // array reference class
+ short x = (short) vh.getAndBitwiseXorRelease(Void.class, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) vh.getAndBitwiseXorRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ short x = (short) vh.getAndBitwiseXorRelease(0, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // index reference class
+ short x = (short) vh.getAndBitwiseXorRelease(array, Void.class, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) vh.getAndBitwiseXorRelease();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) vh.getAndBitwiseXorRelease(array, 0, (short)0x0123, Void.class);
+ });
}
static void testArrayWrongMethodType(Handles hs) throws Throwable {
@@ -2144,6 +3291,48 @@
invokeExact(array, 0, (short)0x0123, Void.class);
});
}
+
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, short.class)).
+ invokeExact((short[]) null, 0, (short)0x0123);
+ });
+ hs.checkWMTEOrCCE(() -> { // array reference class
+ short x = (short) hs.get(am, methodType(short.class, Class.class, int.class, short.class)).
+ invokeExact(Void.class, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // value reference class
+ short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, Class.class)).
+ invokeExact(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ short x = (short) hs.get(am, methodType(short.class, int.class, int.class, short.class)).
+ invokeExact(0, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // index reference class
+ short x = (short) hs.get(am, methodType(short.class, short[].class, Class.class, short.class)).
+ invokeExact(array, Void.class, (short)0x0123);
+ });
+ // Incorrect return type
+ checkWMTE(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, short[].class, int.class, short.class)).
+ invokeExact(array, 0, (short)0x0123);
+ });
+ checkWMTE(() -> { // primitive class
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, short[].class, int.class, short.class)).
+ invokeExact(array, 0, (short)0x0123);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ short x = (short) hs.get(am, methodType(short.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, short.class, Class.class)).
+ invokeExact(array, 0, (short)0x0123, Void.class);
+ });
+ }
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java Thu Sep 01 10:16:57 2016 -0700
@@ -582,6 +582,65 @@
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 @@
});
}
+
}
@@ -1049,6 +1109,49 @@
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 @@
});
}
+
}
@@ -1679,6 +1783,73 @@
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 @@
});
}
+
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template Thu Sep 01 10:16:57 2016 -0700
@@ -109,6 +109,8 @@
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 @@
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 @@
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]
@@ -321,9 +359,55 @@
});
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 @@
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]
@@ -415,9 +507,55 @@
});
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 @@
// 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 @@
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]
@@ -618,9 +888,55 @@
});
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 @@
// 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 @@
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]
@@ -821,9 +1269,55 @@
});
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 @@
// 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 @@
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]
@@ -1031,9 +1657,55 @@
});
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 @@
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.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.addAndGet(array, ci, $value3$);
+ $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$);
});
-#end[AtomicAdd]
+
+ 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]
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template Thu Sep 01 10:16:57 2016 -0700
@@ -98,6 +98,8 @@
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 @@
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 @@
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]
@@ -245,9 +283,55 @@
});
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 @@
$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 @@
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]
@@ -356,6 +456,14 @@
});
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);
});
#else[AtomicAdd]
@@ -364,9 +472,91 @@
});
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,6 +595,14 @@
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(() -> {
@@ -412,9 +610,54 @@
});
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 @@
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]
@@ -503,10 +754,56 @@
});
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 @@
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]
@@ -599,9 +904,55 @@
});
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 @@
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]
@@ -686,10 +1045,55 @@
});
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 @@
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]
@@ -776,9 +1188,55 @@
});
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 @@
// 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 @@
// 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]
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template Thu Sep 01 10:16:57 2016 -0700
@@ -258,16 +258,120 @@
#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 @@
});
}
#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 @@
// 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 @@
});
}
#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 @@
// 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 @@
});
}
#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 @@
});
}
#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]
}
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template Thu Sep 01 10:16:57 2016 -0700
@@ -582,6 +582,64 @@
checkWMTE(() -> { // >
$type$ x = ($type$) vh.getAndSet(recv, $value1$, Void.class);
});
+
+ // GetAndSetAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ $type$ x = ($type$) vh.getAndSetAcquire(null, $value1$);
+ });
+ checkCCE(() -> { // receiver reference class
+ $type$ x = ($type$) vh.getAndSetAcquire(Void.class, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndSetAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ $type$ x = ($type$) vh.getAndSetAcquire(0, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire(recv, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetAcquire(recv, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndSetAcquire(recv, $value1$, Void.class);
+ });
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ $type$ x = ($type$) vh.getAndSetRelease(null, $value1$);
+ });
+ checkCCE(() -> { // receiver reference class
+ $type$ x = ($type$) vh.getAndSetRelease(Void.class, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndSetRelease(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ $type$ x = ($type$) vh.getAndSetRelease(0, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease(recv, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetRelease(recv, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndSetRelease(recv, $value1$, Void.class);
+ });
#end[CAS]
#if[AtomicAdd]
@@ -614,6 +672,63 @@
$type$ x = ($type$) vh.getAndAdd(recv, $value1$, Void.class);
});
+ // GetAndAddAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ $type$ x = ($type$) vh.getAndAddAcquire(null, $value1$);
+ });
+ checkCCE(() -> { // receiver reference class
+ $type$ x = ($type$) vh.getAndAddAcquire(Void.class, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndAddAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ $type$ x = ($type$) vh.getAndAddAcquire(0, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndAddAcquire(recv, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddAcquire(recv, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndAddAcquire();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndAddAcquire(recv, $value1$, Void.class);
+ });
+
+ // GetAndAddRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ $type$ x = ($type$) vh.getAndAddRelease(null, $value1$);
+ });
+ checkCCE(() -> { // receiver reference class
+ $type$ x = ($type$) vh.getAndAddRelease(Void.class, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndAddRelease(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ $type$ x = ($type$) vh.getAndAddRelease(0, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndAddRelease(recv, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddRelease(recv, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndAddRelease();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndAddRelease(recv, $value1$, Void.class);
+ });
// AddAndGet
// Incorrect argument types
@@ -644,6 +759,277 @@
$type$ x = ($type$) vh.addAndGet(recv, $value1$, Void.class);
});
#end[AtomicAdd]
+
+#if[Bitwise]
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ $type$ x = ($type$) vh.getAndBitwiseOr(null, $value1$);
+ });
+ checkCCE(() -> { // receiver reference class
+ $type$ x = ($type$) vh.getAndBitwiseOr(Void.class, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseOr(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ $type$ x = ($type$) vh.getAndBitwiseOr(0, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(recv, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOr(recv, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseOr(recv, $value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ $type$ x = ($type$) vh.getAndBitwiseOrAcquire(null, $value1$);
+ });
+ checkCCE(() -> { // receiver reference class
+ $type$ x = ($type$) vh.getAndBitwiseOrAcquire(Void.class, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseOrAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ $type$ x = ($type$) vh.getAndBitwiseOrAcquire(0, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire(recv, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOrAcquire(recv, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseOrAcquire(recv, $value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseOrRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ $type$ x = ($type$) vh.getAndBitwiseOrRelease(null, $value1$);
+ });
+ checkCCE(() -> { // receiver reference class
+ $type$ x = ($type$) vh.getAndBitwiseOr(Void.class, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseOr(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ $type$ x = ($type$) vh.getAndBitwiseOr(0, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(recv, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOr(recv, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseOr(recv, $value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ $type$ x = ($type$) vh.getAndBitwiseAnd(null, $value1$);
+ });
+ checkCCE(() -> { // receiver reference class
+ $type$ x = ($type$) vh.getAndBitwiseAnd(Void.class, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseAnd(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ $type$ x = ($type$) vh.getAndBitwiseAnd(0, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(recv, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAnd(recv, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseAnd(recv, $value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ $type$ x = ($type$) vh.getAndBitwiseAndAcquire(null, $value1$);
+ });
+ checkCCE(() -> { // receiver reference class
+ $type$ x = ($type$) vh.getAndBitwiseAndAcquire(Void.class, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseAndAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ $type$ x = ($type$) vh.getAndBitwiseAndAcquire(0, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire(recv, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAndAcquire(recv, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseAndAcquire(recv, $value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseAndRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ $type$ x = ($type$) vh.getAndBitwiseAndRelease(null, $value1$);
+ });
+ checkCCE(() -> { // receiver reference class
+ $type$ x = ($type$) vh.getAndBitwiseAnd(Void.class, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseAnd(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ $type$ x = ($type$) vh.getAndBitwiseAnd(0, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(recv, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAnd(recv, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseAnd(recv, $value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ $type$ x = ($type$) vh.getAndBitwiseXor(null, $value1$);
+ });
+ checkCCE(() -> { // receiver reference class
+ $type$ x = ($type$) vh.getAndBitwiseXor(Void.class, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseXor(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ $type$ x = ($type$) vh.getAndBitwiseXor(0, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(recv, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXor(recv, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseXor(recv, $value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ $type$ x = ($type$) vh.getAndBitwiseXorAcquire(null, $value1$);
+ });
+ checkCCE(() -> { // receiver reference class
+ $type$ x = ($type$) vh.getAndBitwiseXorAcquire(Void.class, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseXorAcquire(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ $type$ x = ($type$) vh.getAndBitwiseXorAcquire(0, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire(recv, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXorAcquire(recv, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseXorAcquire(recv, $value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseXorRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null receiver
+ $type$ x = ($type$) vh.getAndBitwiseXorRelease(null, $value1$);
+ });
+ checkCCE(() -> { // receiver reference class
+ $type$ x = ($type$) vh.getAndBitwiseXor(Void.class, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseXor(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ $type$ x = ($type$) vh.getAndBitwiseXor(0, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(recv, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXor(recv, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseXor(recv, $value1$, Void.class);
+ });
+#end[Bitwise]
}
static void testInstanceFieldWrongMethodType(VarHandleTestMethodType$Type$ recv, Handles hs) throws Throwable {
@@ -861,6 +1247,45 @@
});
}
#end[AtomicAdd]
+
+#if[Bitwise]
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ checkNPE(() -> { // null receiver
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
+ invokeExact((VarHandleTestMethodType$Type$) null, $value1$);
+ });
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)).
+ invokeExact(Void.class, $value1$);
+ });
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class)).
+ invokeExact(recv, Void.class);
+ });
+ checkWMTE(() -> { // reciever primitive class
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, $type$.class)).
+ invokeExact(0, $value1$);
+ });
+ // Incorrect return type
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class, $type$.class)).
+ invokeExact(recv, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
+ invokeExact(recv, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) hs.get(am, methodType($type$.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
+ invokeExact(recv, $value1$, Void.class);
+ });
+ }
+#end[Bitwise]
}
@@ -1151,6 +1576,48 @@
checkWMTE(() -> { // >
$type$ x = ($type$) vh.getAndSet($value1$, Void.class);
});
+
+
+ // GetAndSetAcquire
+ // Incorrect argument types
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndSetAcquire(Void.class);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire($value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetAcquire($value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndSetAcquire($value1$, Void.class);
+ });
+
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndSetRelease(Void.class);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease($value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetRelease($value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndSetRelease($value1$, Void.class);
+ });
#end[CAS]
#if[AtomicAdd]
@@ -1175,6 +1642,48 @@
});
+ // GetAndAddAcquire
+ // Incorrect argument types
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndAddAcquire(Void.class);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndAddAcquire($value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddAcquire($value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndAddAcquire();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndAddAcquire($value1$, Void.class);
+ });
+
+
+ // GetAndAddRelease
+ // Incorrect argument types
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndAddRelease(Void.class);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndAddRelease($value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddRelease($value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndAddRelease();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndAddRelease($value1$, Void.class);
+ });
+
+
// AddAndGet
// Incorrect argument types
check{#if[String]?CCE:WMTE}(() -> { // value reference class
@@ -1195,6 +1704,196 @@
$type$ x = ($type$) vh.addAndGet($value1$, Void.class);
});
#end[AtomicAdd]
+
+#if[Bitwise]
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseOr(Void.class);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr($value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOr($value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseOr($value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseOrAcquire(Void.class);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire($value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOrAcquire($value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseOrAcquire($value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseOrReleaseRelease
+ // Incorrect argument types
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseOrRelease(Void.class);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrRelease($value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOrRelease($value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseOrRelease();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseOrRelease($value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseAnd(Void.class);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd($value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAnd($value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseAnd($value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseAndAcquire(Void.class);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire($value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAndAcquire($value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseAndAcquire($value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseAndReleaseRelease
+ // Incorrect argument types
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseAndRelease(Void.class);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndRelease($value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAndRelease($value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseAndRelease();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseAndRelease($value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseXor(Void.class);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor($value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXor($value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseXor($value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseXorAcquire(Void.class);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire($value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXorAcquire($value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseXorAcquire($value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseXorReleaseRelease
+ // Incorrect argument types
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseXorRelease(Void.class);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorRelease($value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXorRelease($value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseXorRelease();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseXorRelease($value1$, Void.class);
+ });
+#end[Bitwise]
}
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
@@ -1338,6 +2037,34 @@
});
}
#end[AtomicAdd]
+
+#if[Bitwise]
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ // Incorrect argument types
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)).
+ invokeExact(Void.class);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, $type$.class)).
+ invokeExact($value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$.class)).
+ invokeExact($value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) hs.get(am, methodType($type$.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, Class.class)).
+ invokeExact($value1$, Void.class);
+ });
+ }
+#end[Bitwise]
}
@@ -1854,6 +2581,72 @@
checkWMTE(() -> { // >
$type$ x = ($type$) vh.getAndSet(array, 0, $value1$, Void.class);
});
+
+
+ // GetAndSetAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ $type$ x = ($type$) vh.getAndSetAcquire(null, 0, $value1$);
+ });
+ checkCCE(() -> { // array reference class
+ $type$ x = ($type$) vh.getAndSetAcquire(Void.class, 0, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndSetAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // reciarrayever primitive class
+ $type$ x = ($type$) vh.getAndSetAcquire(0, 0, $value1$);
+ });
+ checkWMTE(() -> { // index reference class
+ $type$ x = ($type$) vh.getAndSetAcquire(array, Void.class, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndSetAcquire(array, 0, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetAcquire(array, 0, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndSetAcquire();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndSetAcquire(array, 0, $value1$, Void.class);
+ });
+
+
+ // GetAndSetRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ $type$ x = ($type$) vh.getAndSetRelease(null, 0, $value1$);
+ });
+ checkCCE(() -> { // array reference class
+ $type$ x = ($type$) vh.getAndSetRelease(Void.class, 0, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndSetRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // reciarrayever primitive class
+ $type$ x = ($type$) vh.getAndSetRelease(0, 0, $value1$);
+ });
+ checkWMTE(() -> { // index reference class
+ $type$ x = ($type$) vh.getAndSetRelease(array, Void.class, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndSetRelease(array, 0, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetRelease(array, 0, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndSetRelease();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndSetRelease(array, 0, $value1$, Void.class);
+ });
#end[CAS]
#if[AtomicAdd]
@@ -1890,6 +2683,72 @@
});
+ // GetAndAddAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ $type$ x = ($type$) vh.getAndAddAcquire(null, 0, $value1$);
+ });
+ checkCCE(() -> { // array reference class
+ $type$ x = ($type$) vh.getAndAddAcquire(Void.class, 0, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndAddAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ $type$ x = ($type$) vh.getAndAddAcquire(0, 0, $value1$);
+ });
+ checkWMTE(() -> { // index reference class
+ $type$ x = ($type$) vh.getAndAddAcquire(array, Void.class, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndAddAcquire(array, 0, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddAcquire(array, 0, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndAddAcquire();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndAddAcquire(array, 0, $value1$, Void.class);
+ });
+
+
+ // GetAndAddRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ $type$ x = ($type$) vh.getAndAddRelease(null, 0, $value1$);
+ });
+ checkCCE(() -> { // array reference class
+ $type$ x = ($type$) vh.getAndAddRelease(Void.class, 0, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndAddRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ $type$ x = ($type$) vh.getAndAddRelease(0, 0, $value1$);
+ });
+ checkWMTE(() -> { // index reference class
+ $type$ x = ($type$) vh.getAndAddRelease(array, Void.class, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndAddRelease(array, 0, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddRelease(array, 0, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndAddRelease();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndAddRelease(array, 0, $value1$, Void.class);
+ });
+
+
// AddAndGet
// Incorrect argument types
checkNPE(() -> { // null array
@@ -1922,6 +2781,304 @@
$type$ x = ($type$) vh.addAndGet(array, 0, $value1$, Void.class);
});
#end[AtomicAdd]
+
+#if[Bitwise]
+ // GetAndBitwiseOr
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ $type$ x = ($type$) vh.getAndBitwiseOr(null, 0, $value1$);
+ });
+ checkCCE(() -> { // array reference class
+ $type$ x = ($type$) vh.getAndBitwiseOr(Void.class, 0, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseOr(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ $type$ x = ($type$) vh.getAndBitwiseOr(0, 0, $value1$);
+ });
+ checkWMTE(() -> { // index reference class
+ $type$ x = ($type$) vh.getAndBitwiseOr(array, Void.class, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOr(array, 0, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOr(array, 0, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseOr();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseOr(array, 0, $value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseOrAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ $type$ x = ($type$) vh.getAndBitwiseOrAcquire(null, 0, $value1$);
+ });
+ checkCCE(() -> { // array reference class
+ $type$ x = ($type$) vh.getAndBitwiseOrAcquire(Void.class, 0, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseOrAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ $type$ x = ($type$) vh.getAndBitwiseOrAcquire(0, 0, $value1$);
+ });
+ checkWMTE(() -> { // index reference class
+ $type$ x = ($type$) vh.getAndBitwiseOrAcquire(array, Void.class, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOrAcquire(array, 0, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseOrAcquire();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseOrAcquire(array, 0, $value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseOrRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ $type$ x = ($type$) vh.getAndBitwiseOrRelease(null, 0, $value1$);
+ });
+ checkCCE(() -> { // array reference class
+ $type$ x = ($type$) vh.getAndBitwiseOrRelease(Void.class, 0, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseOrRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ $type$ x = ($type$) vh.getAndBitwiseOrRelease(0, 0, $value1$);
+ });
+ checkWMTE(() -> { // index reference class
+ $type$ x = ($type$) vh.getAndBitwiseOrRelease(array, Void.class, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOrRelease(array, 0, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseOrRelease();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseOrRelease(array, 0, $value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseAnd
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ $type$ x = ($type$) vh.getAndBitwiseAnd(null, 0, $value1$);
+ });
+ checkCCE(() -> { // array reference class
+ $type$ x = ($type$) vh.getAndBitwiseAnd(Void.class, 0, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseAnd(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ $type$ x = ($type$) vh.getAndBitwiseAnd(0, 0, $value1$);
+ });
+ checkWMTE(() -> { // index reference class
+ $type$ x = ($type$) vh.getAndBitwiseAnd(array, Void.class, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAnd(array, 0, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAnd(array, 0, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseAnd();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseAnd(array, 0, $value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseAndAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ $type$ x = ($type$) vh.getAndBitwiseAndAcquire(null, 0, $value1$);
+ });
+ checkCCE(() -> { // array reference class
+ $type$ x = ($type$) vh.getAndBitwiseAndAcquire(Void.class, 0, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseAndAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ $type$ x = ($type$) vh.getAndBitwiseAndAcquire(0, 0, $value1$);
+ });
+ checkWMTE(() -> { // index reference class
+ $type$ x = ($type$) vh.getAndBitwiseAndAcquire(array, Void.class, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAndAcquire(array, 0, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseAndAcquire();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseAndAcquire(array, 0, $value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseAndRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ $type$ x = ($type$) vh.getAndBitwiseAndRelease(null, 0, $value1$);
+ });
+ checkCCE(() -> { // array reference class
+ $type$ x = ($type$) vh.getAndBitwiseAndRelease(Void.class, 0, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseAndRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ $type$ x = ($type$) vh.getAndBitwiseAndRelease(0, 0, $value1$);
+ });
+ checkWMTE(() -> { // index reference class
+ $type$ x = ($type$) vh.getAndBitwiseAndRelease(array, Void.class, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAndRelease(array, 0, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseAndRelease();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseAndRelease(array, 0, $value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseXor
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ $type$ x = ($type$) vh.getAndBitwiseXor(null, 0, $value1$);
+ });
+ checkCCE(() -> { // array reference class
+ $type$ x = ($type$) vh.getAndBitwiseXor(Void.class, 0, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseXor(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ $type$ x = ($type$) vh.getAndBitwiseXor(0, 0, $value1$);
+ });
+ checkWMTE(() -> { // index reference class
+ $type$ x = ($type$) vh.getAndBitwiseXor(array, Void.class, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXor(array, 0, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXor(array, 0, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseXor();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseXor(array, 0, $value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseXorAcquire
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ $type$ x = ($type$) vh.getAndBitwiseXorAcquire(null, 0, $value1$);
+ });
+ checkCCE(() -> { // array reference class
+ $type$ x = ($type$) vh.getAndBitwiseXorAcquire(Void.class, 0, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseXorAcquire(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ $type$ x = ($type$) vh.getAndBitwiseXorAcquire(0, 0, $value1$);
+ });
+ checkWMTE(() -> { // index reference class
+ $type$ x = ($type$) vh.getAndBitwiseXorAcquire(array, Void.class, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXorAcquire(array, 0, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseXorAcquire();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseXorAcquire(array, 0, $value1$, Void.class);
+ });
+
+
+ // GetAndBitwiseXorRelease
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ $type$ x = ($type$) vh.getAndBitwiseXorRelease(null, 0, $value1$);
+ });
+ checkCCE(() -> { // array reference class
+ $type$ x = ($type$) vh.getAndBitwiseXorRelease(Void.class, 0, $value1$);
+ });
+ check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ $type$ x = ($type$) vh.getAndBitwiseXorRelease(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ $type$ x = ($type$) vh.getAndBitwiseXorRelease(0, 0, $value1$);
+ });
+ checkWMTE(() -> { // index reference class
+ $type$ x = ($type$) vh.getAndBitwiseXorRelease(array, Void.class, $value1$);
+ });
+ // Incorrect return type
+ check{#if[String]?CCE:WMTE}(() -> { // reference class
+ Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXorRelease(array, 0, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) vh.getAndBitwiseXorRelease();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) vh.getAndBitwiseXorRelease(array, 0, $value1$, Void.class);
+ });
+#end[Bitwise]
}
static void testArrayWrongMethodType(Handles hs) throws Throwable {
@@ -2168,6 +3325,50 @@
});
}
#end[AtomicAdd]
+
+#if[Bitwise]
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
+ // Incorrect argument types
+ checkNPE(() -> { // null array
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class)).
+ invokeExact(($type$[]) null, 0, $value1$);
+ });
+ hs.checkWMTEOrCCE(() -> { // array reference class
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class, $type$.class)).
+ invokeExact(Void.class, 0, $value1$);
+ });
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class)).
+ invokeExact(array, 0, Void.class);
+ });
+ checkWMTE(() -> { // array primitive class
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class, $type$.class)).
+ invokeExact(0, 0, $value1$);
+ });
+ checkWMTE(() -> { // index reference class
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class, $type$.class)).
+ invokeExact(array, Void.class, $value1$);
+ });
+ // Incorrect return type
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
+ Void r = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class, $type$.class)).
+ invokeExact(array, 0, $value1$);
+ });
+ checkWMTE(() -> { // primitive class
+ $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class, $type$.class)).
+ invokeExact(array, 0, $value1$);
+ });
+ // Incorrect arity
+ checkWMTE(() -> { // 0
+ $type$ x = ($type$) hs.get(am, methodType($type$.class)).
+ invokeExact();
+ });
+ checkWMTE(() -> { // >
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, Class.class)).
+ invokeExact(array, 0, $value1$, Void.class);
+ });
+ }
+#end[Bitwise]
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/generate-vh-tests.sh Thu Sep 01 08:39:27 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/generate-vh-tests.sh Thu Sep 01 10:16:57 2016 -0700
@@ -22,6 +22,12 @@
;;
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 @@
;;
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