当前位置: 首页> 财经> 创投人物 > 东至网站建设_官网cms系统_平台关键词排名优化_百度竞价优化软件

东至网站建设_官网cms系统_平台关键词排名优化_百度竞价优化软件

时间:2025/8/27 13:24:09来源:https://blog.csdn.net/guo20082200/article/details/143977634 浏览次数:0次
东至网站建设_官网cms系统_平台关键词排名优化_百度竞价优化软件

类介绍

VarHandle 是一种动态强类型的对变量的引用,或者对一组参数化定义的变量的引用,包括静态字段、非静态字段、数组元素或离堆数据结构的组件。对这些变量的访问支持多种 访问模式(access modes),包括普通的读/写访问、volatile 读/写访问以及比较并设置(compare-and-set)。

VarHandle 是不可变的,没有可见的状态。用户不能对 VarHandle 进行子类化。

public abstract class VarHandle implements Constable {final VarForm vform;final boolean exact;VarHandle(VarForm vform) {this(vform, false);}VarHandle(VarForm vform, boolean exact) {this.vform = vform;this.exact = exact;}RuntimeException unsupported() {return new UnsupportedOperationException();}boolean isDirect() {return true;}VarHandle asDirect() {return this;}VarHandle target() { return null; }/*** Returns {@code true} if this VarHandle has <a href="#invoke-exact-behavior"><em>invoke-exact behavior</em></a>.** @see #withInvokeExactBehavior()* @see #withInvokeBehavior()* @return {@code true} if this VarHandle has <a href="#invoke-exact-behavior"><em>invoke-exact behavior</em></a>.* @since 16*/public boolean hasInvokeExactBehavior() {return exact;}// Plain accessors/*** Returns the value of a variable, with memory semantics of reading as* if the variable was declared non-{@code volatile}.  Commonly referred to* as plain read access.** <p>The method signature is of the form {@code (CT1 ct1, ..., CTn ctn)T}.** <p>The symbolic type descriptor at the call site of {@code get}* must match the access mode type that is the result of calling* {@code accessModeType(VarHandle.AccessMode.GET)} on this VarHandle.** <p>This access mode is supported by all VarHandle instances and never* throws {@code UnsupportedOperationException}.** @param args the signature-polymorphic parameter list of the form* {@code (CT1 ct1, ..., CTn)}* , statically represented using varargs.* @return the signature-polymorphic result that is the value of the* variable* , statically represented using {@code Object}.* @throws WrongMethodTypeException if the access mode type does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject get(Object... args);/*** Sets the value of a variable to the {@code newValue}, with memory* semantics of setting as if the variable was declared non-{@code volatile}* and non-{@code final}.  Commonly referred to as plain write access.** <p>The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T newValue)void}** <p>The symbolic type descriptor at the call site of {@code set}* must match the access mode type that is the result of calling* {@code accessModeType(VarHandle.AccessMode.SET)} on this VarHandle.** @param args the signature-polymorphic parameter list of the form* {@code (CT1 ct1, ..., CTn ctn, T newValue)}* , statically represented using varargs.* @throws UnsupportedOperationException if the access mode is unsupported* for this VarHandle.* @throws WrongMethodTypeException if the access mode type does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidatevoid set(Object... args);// Volatile accessors/*** Returns the value of a variable, with memory semantics of reading as if* the variable was declared {@code volatile}.** <p>The method signature is of the form {@code (CT1 ct1, ..., CTn ctn)T}.** <p>The symbolic type descriptor at the call site of {@code getVolatile}* must match the access mode type that is the result of calling* {@code accessModeType(VarHandle.AccessMode.GET_VOLATILE)} on this* VarHandle.** @param args the signature-polymorphic parameter list of the form* {@code (CT1 ct1, ..., CTn ctn)}* , statically represented using varargs.* @return the signature-polymorphic result that is the 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 does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject getVolatile(Object... args);/*** Sets the value of a variable to the {@code newValue}, with memory* semantics of setting as if the variable was declared {@code volatile}.** <p>The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T newValue)void}.** <p>The symbolic type descriptor at the call site of {@code setVolatile}* must match the access mode type that is the result of calling* {@code accessModeType(VarHandle.AccessMode.SET_VOLATILE)} on this* VarHandle.** @apiNote* Ignoring the many semantic differences from C and C++, this method has* memory ordering effects compatible with {@code memory_order_seq_cst}.** @param args the signature-polymorphic parameter list of the form* {@code (CT1 ct1, ..., CTn ctn, T newValue)}* , statically represented using varargs.* @throws UnsupportedOperationException if the access mode is unsupported* for this VarHandle.* @throws WrongMethodTypeException if the access mode type does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidatevoid setVolatile(Object... args);/*** Returns the value of a variable, accessed in program order, but with no* assurance of memory ordering effects with respect to other threads.** <p>The method signature is of the form {@code (CT1 ct1, ..., CTn ctn)T}.** <p>The symbolic type descriptor at the call site of {@code getOpaque}* must match the access mode type that is the result of calling* {@code accessModeType(VarHandle.AccessMode.GET_OPAQUE)} on this* VarHandle.** @param args the signature-polymorphic parameter list of the form* {@code (CT1 ct1, ..., CTn ctn)}* , statically represented using varargs.* @return the signature-polymorphic result that is the 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 does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject getOpaque(Object... args);/*** Sets the value of a variable to the {@code newValue}, in program order,* but with no assurance of memory ordering effects with respect to other* threads.** <p>The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T newValue)void}.** <p>The symbolic type descriptor at the call site of {@code setOpaque}* must match the access mode type that is the result of calling* {@code accessModeType(VarHandle.AccessMode.SET_OPAQUE)} on this* VarHandle.** @param args the signature-polymorphic parameter list of the form* {@code (CT1 ct1, ..., CTn ctn, T newValue)}* , statically represented using varargs.* @throws UnsupportedOperationException if the access mode is unsupported* for this VarHandle.* @throws WrongMethodTypeException if the access mode type does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidatevoid setOpaque(Object... args);// Lazy accessors/*** Returns the value of a variable, and ensures that subsequent loads and* stores are not reordered before this access.** <p>The method signature is of the form {@code (CT1 ct1, ..., CTn ctn)T}.** <p>The symbolic type descriptor at the call site of {@code getAcquire}* must match the access mode type that is the result of calling* {@code accessModeType(VarHandle.AccessMode.GET_ACQUIRE)} on this* VarHandle.** @apiNote* Ignoring the many semantic differences from C and C++, this method has* memory ordering effects compatible with {@code memory_order_acquire}* ordering.** @param args the signature-polymorphic parameter list of the form* {@code (CT1 ct1, ..., CTn ctn)}* , statically represented using varargs.* @return the signature-polymorphic result that is the 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 does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject getAcquire(Object... args);/*** Sets the value of a variable to the {@code newValue}, and ensures that* prior loads and stores are not reordered after this access.** <p>The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T newValue)void}.** <p>The symbolic type descriptor at the call site of {@code setRelease}* must match the access mode type that is the result of calling* {@code accessModeType(VarHandle.AccessMode.SET_RELEASE)} on this* VarHandle.** @apiNote* Ignoring the many semantic differences from C and C++, this method has* memory ordering effects compatible with {@code memory_order_release}* ordering.** @param args the signature-polymorphic parameter list of the form* {@code (CT1 ct1, ..., CTn ctn, T newValue)}* , statically represented using varargs.* @throws UnsupportedOperationException if the access mode is unsupported* for this VarHandle.* @throws WrongMethodTypeException if the access mode type does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidatevoid setRelease(Object... args);// Compare and set accessors/*** Atomically sets the value of a variable to the {@code newValue} with the* memory semantics of {@link #setVolatile} if the variable's current value,* referred to as the <em>witness value</em>, {@code ==} the* {@code expectedValue}, as accessed with the memory semantics of* {@link #getVolatile}.** <p>The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)boolean}.** <p>The symbolic type descriptor at the call site of {@code* compareAndSet} must match the access mode type that is the result of* calling {@code accessModeType(VarHandle.AccessMode.COMPARE_AND_SET)} on* this VarHandle.** @param args the signature-polymorphic parameter list of the form* {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)}* , statically represented using varargs.* @return {@code true} if successful, otherwise {@code false} if the* witness value was not the same as the {@code expectedValue}.* @throws UnsupportedOperationException if the access mode is unsupported* for this VarHandle.* @throws WrongMethodTypeException if the access mode type does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #setVolatile(Object...)* @see #getVolatile(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateboolean compareAndSet(Object... args);/*** Atomically sets the value of a variable to the {@code newValue} with the* memory semantics of {@link #setVolatile} if the variable's current value,* referred to as the <em>witness value</em>, {@code ==} the* {@code expectedValue}, as accessed with the memory semantics of* {@link #getVolatile}.** <p>The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)T}.** <p>The symbolic type descriptor at the call site of {@code* compareAndExchange}* must match the access mode type that is the result of calling* {@code accessModeType(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)}* on this VarHandle.** @param args the signature-polymorphic parameter list of the form* {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)}* , statically represented using varargs.* @return the signature-polymorphic result that is the witness value, which* will be the same as the {@code expectedValue} if successful* , 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@IntrinsicCandidateObject compareAndExchange(Object... args);/*** Atomically sets the value of a variable to the {@code newValue} with the* memory semantics of {@link #set} if the variable's current value,* referred to as the <em>witness value</em>, {@code ==} the* {@code expectedValue}, as accessed with the memory semantics of* {@link #getAcquire}.** <p>The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)T}.** <p>The symbolic type descriptor at the call site of {@code* compareAndExchangeAcquire}* must match the access mode type that is the result of calling* {@code accessModeType(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)} on* this VarHandle.** @param args the signature-polymorphic parameter list of the form* {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)}* , statically represented using varargs.* @return the signature-polymorphic result that is the witness value, which* will be the same as the {@code expectedValue} if successful* , statically represented using {@code Object}.* @throws UnsupportedOperationException if the access mode is unsupported* for this VarHandle.* @throws WrongMethodTypeException if the access mode type does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #set(Object...)* @see #getAcquire(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject compareAndExchangeAcquire(Object... args);/*** Atomically sets the value of a variable to the {@code newValue} with the* memory semantics of {@link #setRelease} if the variable's current value,* referred to as the <em>witness value</em>, {@code ==} the* {@code expectedValue}, as accessed with the memory semantics of* {@link #get}.** <p>The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)T}.** <p>The symbolic type descriptor at the call site of {@code* compareAndExchangeRelease}* must match the access mode type that is the result of calling* {@code accessModeType(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)}* on this VarHandle.** @param args the signature-polymorphic parameter list of the form* {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)}* , statically represented using varargs.* @return the signature-polymorphic result that is the witness value, which* will be the same as the {@code expectedValue} if successful* , statically represented using {@code Object}.* @throws UnsupportedOperationException if the access mode is unsupported* for this VarHandle.* @throws WrongMethodTypeException if the access mode type does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #setRelease(Object...)* @see #get(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject compareAndExchangeRelease(Object... args);// Weak (spurious failures allowed)/*** Possibly atomically sets the value of a variable to the {@code newValue}* with the semantics of {@link #set} if the variable's current value,* referred to as the <em>witness value</em>, {@code ==} the* {@code expectedValue}, as accessed with the memory semantics of* {@link #get}.** <p>This operation may fail spuriously (typically, due to memory* contention) even if the witness value does match the expected value.** <p>The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)boolean}.** <p>The symbolic type descriptor at the call site of {@code* weakCompareAndSetPlain} must match the access mode type that is the result of* calling {@code accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)}* on this VarHandle.** @param args the signature-polymorphic parameter list of the form* {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)}* , statically represented using varargs.* @return {@code true} if successful, otherwise {@code false} if the* witness value was not the same as the {@code expectedValue} or if this* operation spuriously failed.* @throws UnsupportedOperationException if the access mode is unsupported* for this VarHandle.* @throws WrongMethodTypeException if the access mode type does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #set(Object...)* @see #get(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateboolean weakCompareAndSetPlain(Object... args);/*** Possibly atomically sets the value of a variable to the {@code newValue}* with the memory semantics of {@link #setVolatile} if the variable's* current value, referred to as the <em>witness value</em>, {@code ==} the* {@code expectedValue}, as accessed with the memory semantics of* {@link #getVolatile}.** <p>This operation may fail spuriously (typically, due to memory* contention) even if the witness value does match the expected value.** <p>The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)boolean}.** <p>The symbolic type descriptor at the call site of {@code* weakCompareAndSet} must match the access mode type that is the* result of calling {@code accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)}* on this VarHandle.** @param args the signature-polymorphic parameter list of the form* {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)}* , statically represented using varargs.* @return {@code true} if successful, otherwise {@code false} if the* witness value was not the same as the {@code expectedValue} or if this* operation spuriously failed.* @throws UnsupportedOperationException if the access mode is unsupported* for this VarHandle.* @throws WrongMethodTypeException if the access mode type does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #setVolatile(Object...)* @see #getVolatile(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateboolean weakCompareAndSet(Object... args);/*** Possibly atomically sets the value of a variable to the {@code newValue}* with the semantics of {@link #set} if the variable's current value,* referred to as the <em>witness value</em>, {@code ==} the* {@code expectedValue}, as accessed with the memory semantics of* {@link #getAcquire}.** <p>This operation may fail spuriously (typically, due to memory* contention) even if the witness value does match the expected value.** <p>The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)boolean}.** <p>The symbolic type descriptor at the call site of {@code* weakCompareAndSetAcquire}* must match the access mode type that is the result of calling* {@code accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)}* on this VarHandle.** @param args the signature-polymorphic parameter list of the form* {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)}* , statically represented using varargs.* @return {@code true} if successful, otherwise {@code false} if the* witness value was not the same as the {@code expectedValue} or if this* operation spuriously failed.* @throws UnsupportedOperationException if the access mode is unsupported* for this VarHandle.* @throws WrongMethodTypeException if the access mode type does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #set(Object...)* @see #getAcquire(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateboolean weakCompareAndSetAcquire(Object... args);/*** Possibly atomically sets the value of a variable to the {@code newValue}* with the semantics of {@link #setRelease} if the variable's current* value, referred to as the <em>witness value</em>, {@code ==} the* {@code expectedValue}, as accessed with the memory semantics of* {@link #get}.** <p>This operation may fail spuriously (typically, due to memory* contention) even if the witness value does match the expected value.** <p>The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)boolean}.** <p>The symbolic type descriptor at the call site of {@code* weakCompareAndSetRelease}* must match the access mode type that is the result of calling* {@code accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)}* on this VarHandle.** @param args the signature-polymorphic parameter list of the form* {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)}* , statically represented using varargs.* @return {@code true} if successful, otherwise {@code false} if the* witness value was not the same as the {@code expectedValue} or if this* operation spuriously failed.* @throws UnsupportedOperationException if the access mode is unsupported* for this VarHandle.* @throws WrongMethodTypeException if the access mode type does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #setRelease(Object...)* @see #get(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateboolean weakCompareAndSetRelease(Object... args);/*** Atomically sets the value of a variable to the {@code newValue} with the* memory semantics of {@link #setVolatile} and returns the variable's* previous value, as accessed with the memory semantics of* {@link #getVolatile}.** <p>The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T newValue)T}.** <p>The symbolic type descriptor at the call site of {@code getAndSet}* must match the access mode type that is the result of calling* {@code accessModeType(VarHandle.AccessMode.GET_AND_SET)} on this* VarHandle.** @param args the signature-polymorphic parameter list of the form* {@code (CT1 ct1, ..., CTn ctn, 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 does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #setVolatile(Object...)* @see #getVolatile(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject 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 (CT1 ct1, ..., CTn ctn, 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 (CT1 ct1, ..., CTn ctn, 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 does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #setVolatile(Object...)* @see #getVolatile(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject 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 (CT1 ct1, ..., CTn ctn, 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 (CT1 ct1, ..., CTn ctn, 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 does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #setVolatile(Object...)* @see #getVolatile(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject getAndSetRelease(Object... args);// Primitive adders// Throw UnsupportedOperationException for refs/*** Atomically adds the {@code value} to the current value of a variable with* the memory semantics of {@link #setVolatile}, and returns the variable's* previous value, as accessed with the memory semantics of* {@link #getVolatile}.** <p>The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T value)T}.** <p>The symbolic type descriptor at the call site of {@code getAndAdd}* must match the access mode type that is the result of calling* {@code accessModeType(VarHandle.AccessMode.GET_AND_ADD)} on this* VarHandle.** @param args the signature-polymorphic parameter list of the form* {@code (CT1 ct1, ..., CTn ctn, 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 does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #setVolatile(Object...)* @see #getVolatile(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject getAndAdd(Object... args);/*** Atomically adds the {@code value} to the current value of a variable with* the memory semantics of {@link #set}, and returns the variable's* previous value, as accessed with the memory semantics of* {@link #getAcquire}.** <p>The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, 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 (CT1 ct1, ..., CTn ctn, 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 does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #setVolatile(Object...)* @see #getVolatile(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject 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 (CT1 ct1, ..., CTn ctn, 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 (CT1 ct1, ..., CTn ctn, 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 does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #setVolatile(Object...)* @see #getVolatile(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject getAndAddRelease(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 (CT1 ct1, ..., CTn ctn, 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 (CT1 ct1, ..., CTn ctn, 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 does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #setVolatile(Object...)* @see #getVolatile(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject 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 (CT1 ct1, ..., CTn ctn, 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 (CT1 ct1, ..., CTn ctn, 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 does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #set(Object...)* @see #getAcquire(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject 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 (CT1 ct1, ..., CTn ctn, 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 (CT1 ct1, ..., CTn ctn, 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 does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #setRelease(Object...)* @see #get(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject 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 (CT1 ct1, ..., CTn ctn, 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 (CT1 ct1, ..., CTn ctn, 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 does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #setVolatile(Object...)* @see #getVolatile(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject 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 (CT1 ct1, ..., CTn ctn, 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 (CT1 ct1, ..., CTn ctn, 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 does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #set(Object...)* @see #getAcquire(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject 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 (CT1 ct1, ..., CTn ctn, 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 (CT1 ct1, ..., CTn ctn, 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 does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #setRelease(Object...)* @see #get(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject 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 (CT1 ct1, ..., CTn ctn, 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 (CT1 ct1, ..., CTn ctn, 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 does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #setVolatile(Object...)* @see #getVolatile(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject 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 (CT1 ct1, ..., CTn ctn, 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 (CT1 ct1, ..., CTn ctn, 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 does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #set(Object...)* @see #getAcquire(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject 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 (CT1 ct1, ..., CTn ctn, 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 (CT1 ct1, ..., CTn ctn, 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 does not* match the caller's symbolic type descriptor.* @throws ClassCastException if the access mode type matches the caller's* symbolic type descriptor, but a reference cast fails.* @see #setRelease(Object...)* @see #get(Object...)*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject getAndBitwiseXorRelease(Object... args);/*** Returns a VarHandle, with access to the same variable(s) as this VarHandle, but whose* invocation behavior of access mode methods is adjusted to* <a href="#invoke-exact-behavior"><em>invoke-exact behavior</em></a>.* <p>* If this VarHandle already has invoke-exact behavior this VarHandle is returned.* <p>* Invoking {@link #hasInvokeExactBehavior()} on the returned var handle* is guaranteed to return {@code true}.** @apiNote* Invoke-exact behavior guarantees that upon invocation of an access mode method* the types and arity of the arguments must match the {@link #accessModeType(AccessMode) access mode type},* otherwise a {@link WrongMethodTypeException} is thrown.** @see #withInvokeBehavior()* @see #hasInvokeExactBehavior()* @return a VarHandle with invoke-exact behavior* @since 16*/public abstract VarHandle withInvokeExactBehavior();/*** Returns a VarHandle, with access to the same variable(s) as this VarHandle, but whose* invocation behavior of access mode methods is adjusted to* <a href="#invoke-behavior"><em>invoke behavior</em></a>.* <p>* If this VarHandle already has invoke behavior this VarHandle is returned.* <p>* Invoking {@link #hasInvokeExactBehavior()} on the returned var handle* is guaranteed to return {@code false}.** @see #withInvokeExactBehavior()* @see #hasInvokeExactBehavior()* @return a VarHandle with invoke behavior* @since 16*/public abstract VarHandle withInvokeBehavior();enum AccessType {GET(Object.class),SET(void.class),COMPARE_AND_SET(boolean.class),COMPARE_AND_EXCHANGE(Object.class),GET_AND_UPDATE(Object.class);static final int COUNT = GET_AND_UPDATE.ordinal() + 1;static {assert (COUNT == values().length);}final Class<?> returnType;final boolean isMonomorphicInReturnType;AccessType(Class<?> returnType) {this.returnType = returnType;isMonomorphicInReturnType = returnType != Object.class;}MethodType accessModeType(Class<?> receiver, Class<?> value,Class<?>... intermediate) {Class<?>[] ps;int i;switch (this) {case GET:ps = allocateParameters(0, receiver, intermediate);fillParameters(ps, receiver, intermediate);return MethodType.methodType(value, ps);case SET:ps = allocateParameters(1, receiver, intermediate);i = fillParameters(ps, receiver, intermediate);ps[i] = value;return MethodType.methodType(void.class, ps);case COMPARE_AND_SET:ps = allocateParameters(2, receiver, intermediate);i = fillParameters(ps, receiver, intermediate);ps[i++] = value;ps[i] = value;return MethodType.methodType(boolean.class, ps);case COMPARE_AND_EXCHANGE:ps = allocateParameters(2, receiver, intermediate);i = fillParameters(ps, receiver, intermediate);ps[i++] = value;ps[i] = value;return MethodType.methodType(value, ps);case GET_AND_UPDATE:ps = allocateParameters(1, receiver, intermediate);i = fillParameters(ps, receiver, intermediate);ps[i] = value;return MethodType.methodType(value, ps);default:throw new InternalError("Unknown AccessType");}}private static Class<?>[] allocateParameters(int values,Class<?> receiver, Class<?>... intermediate) {int size = ((receiver != null) ? 1 : 0) + intermediate.length + values;return new Class<?>[size];}private static int fillParameters(Class<?>[] ps,Class<?> receiver, Class<?>... intermediate) {int i = 0;if (receiver != null)ps[i++] = receiver;for (int j = 0; j < intermediate.length; j++)ps[i++] = intermediate[j];return i;}}/*** The set of access modes that specify how a variable, referenced by a* VarHandle, is accessed.*/public enum AccessMode {/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#get VarHandle.get}*/GET("get", AccessType.GET),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#set VarHandle.set}*/SET("set", AccessType.SET),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#getVolatile VarHandle.getVolatile}*/GET_VOLATILE("getVolatile", AccessType.GET),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#setVolatile VarHandle.setVolatile}*/SET_VOLATILE("setVolatile", AccessType.SET),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#getAcquire VarHandle.getAcquire}*/GET_ACQUIRE("getAcquire", AccessType.GET),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#setRelease VarHandle.setRelease}*/SET_RELEASE("setRelease", AccessType.SET),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#getOpaque VarHandle.getOpaque}*/GET_OPAQUE("getOpaque", AccessType.GET),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#setOpaque VarHandle.setOpaque}*/SET_OPAQUE("setOpaque", AccessType.SET),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#compareAndSet VarHandle.compareAndSet}*/COMPARE_AND_SET("compareAndSet", AccessType.COMPARE_AND_SET),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#compareAndExchange VarHandle.compareAndExchange}*/COMPARE_AND_EXCHANGE("compareAndExchange", AccessType.COMPARE_AND_EXCHANGE),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#compareAndExchangeAcquire VarHandle.compareAndExchangeAcquire}*/COMPARE_AND_EXCHANGE_ACQUIRE("compareAndExchangeAcquire", AccessType.COMPARE_AND_EXCHANGE),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#compareAndExchangeRelease VarHandle.compareAndExchangeRelease}*/COMPARE_AND_EXCHANGE_RELEASE("compareAndExchangeRelease", AccessType.COMPARE_AND_EXCHANGE),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#weakCompareAndSetPlain VarHandle.weakCompareAndSetPlain}*/WEAK_COMPARE_AND_SET_PLAIN("weakCompareAndSetPlain", AccessType.COMPARE_AND_SET),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#weakCompareAndSet VarHandle.weakCompareAndSet}*/WEAK_COMPARE_AND_SET("weakCompareAndSet", AccessType.COMPARE_AND_SET),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#weakCompareAndSetAcquire VarHandle.weakCompareAndSetAcquire}*/WEAK_COMPARE_AND_SET_ACQUIRE("weakCompareAndSetAcquire", AccessType.COMPARE_AND_SET),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#weakCompareAndSetRelease VarHandle.weakCompareAndSetRelease}*/WEAK_COMPARE_AND_SET_RELEASE("weakCompareAndSetRelease", AccessType.COMPARE_AND_SET),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#getAndSet VarHandle.getAndSet}*/GET_AND_SET("getAndSet", AccessType.GET_AND_UPDATE),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#getAndSetAcquire VarHandle.getAndSetAcquire}*/GET_AND_SET_ACQUIRE("getAndSetAcquire", AccessType.GET_AND_UPDATE),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#getAndSetRelease VarHandle.getAndSetRelease}*/GET_AND_SET_RELEASE("getAndSetRelease", AccessType.GET_AND_UPDATE),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#getAndAdd VarHandle.getAndAdd}*/GET_AND_ADD("getAndAdd", AccessType.GET_AND_UPDATE),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#getAndAddAcquire VarHandle.getAndAddAcquire}*/GET_AND_ADD_ACQUIRE("getAndAddAcquire", AccessType.GET_AND_UPDATE),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#getAndAddRelease VarHandle.getAndAddRelease}*/GET_AND_ADD_RELEASE("getAndAddRelease", AccessType.GET_AND_UPDATE),/*** The access mode whose access is specified by the corresponding* method* {@link VarHandle#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 int COUNT = GET_AND_BITWISE_XOR_ACQUIRE.ordinal() + 1;static {assert (COUNT == values().length);}final String methodName;final AccessType at;AccessMode(final String methodName, AccessType at) {this.methodName = methodName;this.at = at;}/*** Returns the {@code VarHandle} signature-polymorphic method name* associated with this {@code AccessMode} value.** @return the signature-polymorphic method name* @see #valueFromMethodName*/public String methodName() {return methodName;}/*** Returns the {@code AccessMode} value associated with the specified* {@code VarHandle} signature-polymorphic method name.** @param methodName the signature-polymorphic method name* @return the {@code AccessMode} value* @throws IllegalArgumentException if there is no {@code AccessMode}*         value associated with method name (indicating the method*         name does not correspond to a {@code VarHandle}*         signature-polymorphic method name).* @see #methodName()*/public static AccessMode valueFromMethodName(String methodName) {return switch (methodName) {case "get" -> GET;case "set" -> SET;case "getVolatile" -> GET_VOLATILE;case "setVolatile" -> SET_VOLATILE;case "getAcquire" -> GET_ACQUIRE;case "setRelease" -> SET_RELEASE;case "getOpaque" -> GET_OPAQUE;case "setOpaque" -> SET_OPAQUE;case "compareAndSet" -> COMPARE_AND_SET;case "compareAndExchange" -> COMPARE_AND_EXCHANGE;case "compareAndExchangeAcquire" -> COMPARE_AND_EXCHANGE_ACQUIRE;case "compareAndExchangeRelease" -> COMPARE_AND_EXCHANGE_RELEASE;case "weakCompareAndSet" -> WEAK_COMPARE_AND_SET;case "weakCompareAndSetPlain" -> WEAK_COMPARE_AND_SET_PLAIN;case "weakCompareAndSetAcquire" -> WEAK_COMPARE_AND_SET_ACQUIRE;case "weakCompareAndSetRelease" -> WEAK_COMPARE_AND_SET_RELEASE;case "getAndSet" -> GET_AND_SET;case "getAndSetAcquire" -> GET_AND_SET_ACQUIRE;case "getAndSetRelease" -> GET_AND_SET_RELEASE;case "getAndAdd" -> GET_AND_ADD;case "getAndAddAcquire" -> GET_AND_ADD_ACQUIRE;case "getAndAddRelease" -> GET_AND_ADD_RELEASE;case "getAndBitwiseOr" -> GET_AND_BITWISE_OR;case "getAndBitwiseOrRelease" -> GET_AND_BITWISE_OR_RELEASE;case "getAndBitwiseOrAcquire" -> GET_AND_BITWISE_OR_ACQUIRE;case "getAndBitwiseAnd" -> GET_AND_BITWISE_AND;case "getAndBitwiseAndRelease" -> GET_AND_BITWISE_AND_RELEASE;case "getAndBitwiseAndAcquire" -> GET_AND_BITWISE_AND_ACQUIRE;case "getAndBitwiseXor" -> GET_AND_BITWISE_XOR;case "getAndBitwiseXorRelease" -> GET_AND_BITWISE_XOR_RELEASE;case "getAndBitwiseXorAcquire" -> GET_AND_BITWISE_XOR_ACQUIRE;default -> throw new IllegalArgumentException("No AccessMode value for method name " + methodName);};}}static final class AccessDescriptor {final MethodType symbolicMethodTypeExact;final MethodType symbolicMethodTypeErased;final MethodType symbolicMethodTypeInvoker;final Class<?> returnType;final int type;final int mode;public AccessDescriptor(MethodType symbolicMethodType, int type, int mode) {this.symbolicMethodTypeExact = symbolicMethodType;this.symbolicMethodTypeErased = symbolicMethodType.erase();this.symbolicMethodTypeInvoker = symbolicMethodType.insertParameterTypes(0, VarHandle.class);this.returnType = symbolicMethodType.returnType();this.type = type;this.mode = mode;}}/*** Returns a compact textual description of this {@linkplain VarHandle},* including the type of variable described, and a description of its coordinates.** @return A compact textual description of this {@linkplain VarHandle}*/@Overridepublic final String toString() {return String.format("VarHandle[varType=%s, coord=%s]",varType().getName(),coordinateTypes());}/*** Returns the variable type of variables referenced by this VarHandle.** @return the variable type of variables referenced by this VarHandle*/public Class<?> varType() {MethodType typeSet = accessModeType(AccessMode.SET);return typeSet.parameterType(typeSet.parameterCount() - 1);}/*** Returns the coordinate types for this VarHandle.** @return the coordinate types for this VarHandle. The returned* list is unmodifiable*/public List<Class<?>> coordinateTypes() {MethodType typeGet = accessModeType(AccessMode.GET);return typeGet.parameterList();}/*** Obtains the access mode type for this VarHandle and a given access mode.** <p>The access mode type's parameter types will consist of a prefix that* is the coordinate types of this VarHandle followed by further* types as defined by the access mode method.* The access mode type's return type is defined by the return type of the* access mode method.** @param accessMode the access mode, corresponding to the* signature-polymorphic method of the same name* @return the access mode type for the given access mode*/public final MethodType accessModeType(AccessMode accessMode) {return accessModeType(accessMode.at.ordinal());}@ForceInlinefinal void checkExactAccessMode(VarHandle.AccessDescriptor ad) {if (exact && accessModeType(ad.type) != ad.symbolicMethodTypeExact) {throwWrongMethodTypeException(ad);}}@DontInlineprivate final void throwWrongMethodTypeException(VarHandle.AccessDescriptor ad) {throw new WrongMethodTypeException("expected " + accessModeType(ad.type) + " but found "+ ad.symbolicMethodTypeExact);}@ForceInlinefinal MethodType accessModeType(int accessTypeOrdinal) {TypesAndInvokers tis = getTypesAndInvokers();MethodType mt = tis.methodType_table[accessTypeOrdinal];if (mt == null) {mt = tis.methodType_table[accessTypeOrdinal] =accessModeTypeUncached(accessTypeOrdinal);}return mt;}final MethodType accessModeTypeUncached(int accessTypeOrdinal) {return accessModeTypeUncached(AccessType.values()[accessTypeOrdinal]);}abstract MethodType accessModeTypeUncached(AccessType accessMode);/*** Returns {@code true} if the given access mode is supported, otherwise* {@code false}.** <p>The return of a {@code false} value for a given access mode indicates* that an {@code UnsupportedOperationException} is thrown on invocation* of the corresponding access mode method.** @param accessMode the access mode, corresponding to the* signature-polymorphic method of the same name* @return {@code true} if the given access mode is supported, otherwise* {@code false}.*/public final boolean isAccessModeSupported(AccessMode accessMode) {return vform.getMemberNameOrNull(accessMode.ordinal()) != null;}/*** Obtains a method handle bound to this VarHandle and the given access* mode.** @apiNote This method, for a VarHandle {@code vh} and access mode* {@code {access-mode}}, returns a method handle that is equivalent to* method handle {@code bmh} in the following code (though it may be more* efficient):* <pre>{@code* MethodHandle mh = MethodHandles.varHandleExactInvoker(*                       vh.accessModeType(VarHandle.AccessMode.{access-mode}));** MethodHandle bmh = mh.bindTo(vh);* }</pre>** @param accessMode the access mode, corresponding to the* signature-polymorphic method of the same name* @return a method handle bound to this VarHandle and the given access mode*/public MethodHandle toMethodHandle(AccessMode accessMode) {if (isAccessModeSupported(accessMode)) {MethodHandle mh = getMethodHandle(accessMode.ordinal());return mh.bindTo(this);}else {// Ensure an UnsupportedOperationException is thrownreturn MethodHandles.varHandleInvoker(accessMode, accessModeType(accessMode)).bindTo(this);}}/*** Return a nominal descriptor for this instance, if one can be* constructed, or an empty {@link Optional} if one cannot be.** @return An {@link Optional} containing the resulting nominal descriptor,* or an empty {@link Optional} if one cannot be constructed.* @since 12*/@Overridepublic Optional<VarHandleDesc> describeConstable() {// partial function for field and array onlyreturn Optional.empty();}@StableTypesAndInvokers typesAndInvokers;static class TypesAndInvokers {final @StableMethodType[] methodType_table = new MethodType[VarHandle.AccessType.COUNT];final @StableMethodHandle[] methodHandle_table = new MethodHandle[AccessMode.COUNT];}@ForceInlineprivate final TypesAndInvokers getTypesAndInvokers() {TypesAndInvokers tis = typesAndInvokers;if (tis == null) {tis = typesAndInvokers = new TypesAndInvokers();}return tis;}@ForceInlineMethodHandle getMethodHandle(int mode) {TypesAndInvokers tis = getTypesAndInvokers();MethodHandle mh = tis.methodHandle_table[mode];if (mh == null) {mh = tis.methodHandle_table[mode] = getMethodHandleUncached(mode);}return mh;}private final MethodHandle getMethodHandleUncached(int mode) {MethodType mt = accessModeType(AccessMode.values()[mode]).insertParameterTypes(0, VarHandle.class);MemberName mn = vform.getMemberName(mode);DirectMethodHandle dmh = DirectMethodHandle.make(mn);// Such a method handle must not be publicly exposed directly// otherwise it can be cracked, it must be transformed or rebound// before exposureMethodHandle mh = dmh.copyWith(mt, dmh.form);assert mh.type().erase() == mn.getMethodType().erase();return mh;}/*non-public*/final void updateVarForm(VarForm newVForm) {if (vform == newVForm) return;UNSAFE.putReference(this, VFORM_OFFSET, newVForm);UNSAFE.fullFence();}static final BiFunction<String, List<Number>, ArrayIndexOutOfBoundsException>AIOOBE_SUPPLIER = Preconditions.outOfBoundsExceptionFormatter(new Function<String, ArrayIndexOutOfBoundsException>() {@Overridepublic ArrayIndexOutOfBoundsException apply(String s) {return new ArrayIndexOutOfBoundsException(s);}});private static final long VFORM_OFFSET;static {VFORM_OFFSET = UNSAFE.objectFieldOffset(VarHandle.class, "vform");// The VarHandleGuards must be initialized to ensure correct// compilation of the guard methodsUNSAFE.ensureClassInitialized(VarHandleGuards.class);}// Fence methods/*** Ensures that loads and stores before the fence will not be reordered* with* loads and stores after the fence.** @apiNote Ignoring the many semantic differences from C and C++, this* method has memory ordering effects compatible with* {@code atomic_thread_fence(memory_order_seq_cst)}*/@ForceInlinepublic static void fullFence() {UNSAFE.fullFence();}/*** Ensures that loads before the fence will not be reordered with loads and* stores after the fence.** @apiNote Ignoring the many semantic differences from C and C++, this* method has memory ordering effects compatible with* {@code atomic_thread_fence(memory_order_acquire)}*/@ForceInlinepublic static void acquireFence() {UNSAFE.loadFence();}/*** Ensures that loads and stores before the fence will not be* reordered with stores after the fence.** @apiNote Ignoring the many semantic differences from C and C++, this* method has memory ordering effects compatible with* {@code atomic_thread_fence(memory_order_release)}*/@ForceInlinepublic static void releaseFence() {UNSAFE.storeFence();}/*** 确保在栅栏(fence)之前的加载操作不会与栅栏之后的加载操作重新排序。*/@ForceInlinepublic static void loadLoadFence() {UNSAFE.loadLoadFence();}/*** 确保在栅栏(fence)之前的存储操作不会与栅栏之后的存储操作重新排序。*/@ForceInlinepublic static void storeStoreFence() {UNSAFE.storeStoreFence();}/*** 描述VarHandle常量的标称描述符 * @since 12*/public static final class VarHandleDesc extends DynamicConstantDesc<VarHandle> {/*** Kinds of variable handle descs*/private enum Kind {FIELD(ConstantDescs.BSM_VARHANDLE_FIELD),STATIC_FIELD(ConstantDescs.BSM_VARHANDLE_STATIC_FIELD),ARRAY(ConstantDescs.BSM_VARHANDLE_ARRAY);final DirectMethodHandleDesc bootstrapMethod;Kind(DirectMethodHandleDesc bootstrapMethod) {this.bootstrapMethod = bootstrapMethod;}ConstantDesc[] toBSMArgs(ClassDesc declaringClass, ClassDesc varType) {return switch (this) {case FIELD, STATIC_FIELD -> new ConstantDesc[]{declaringClass, varType};case ARRAY               -> new ConstantDesc[]{declaringClass};default -> throw new InternalError("Cannot reach here");};}}private final Kind kind;private final ClassDesc declaringClass;private final ClassDesc varType;/*** Construct a {@linkplain VarHandleDesc} given a kind, name, and declaring* class.** @param kind the kind of the var handle* @param name the unqualified name of the field, for field var handles; otherwise ignored* @param declaringClass a {@link ClassDesc} describing the declaring class,*                       for field var handles* @param varType a {@link ClassDesc} describing the type of the variable* @throws NullPointerException if any required argument is null* @jvms 4.2.2 Unqualified Names*/private VarHandleDesc(Kind kind, String name, ClassDesc declaringClass, ClassDesc varType) {super(kind.bootstrapMethod, name,ConstantDescs.CD_VarHandle,kind.toBSMArgs(declaringClass, varType));this.kind = kind;this.declaringClass = declaringClass;this.varType = varType;}/*** Returns a {@linkplain VarHandleDesc} corresponding to a {@link VarHandle}* for an instance field.** @param name the unqualified name of the field* @param declaringClass a {@link ClassDesc} describing the declaring class,*                       for field var handles* @param fieldType a {@link ClassDesc} describing the type of the field* @return the {@linkplain VarHandleDesc}* @throws NullPointerException if any of the arguments are null* @jvms 4.2.2 Unqualified Names*/public static VarHandleDesc ofField(ClassDesc declaringClass, String name, ClassDesc fieldType) {Objects.requireNonNull(declaringClass);Objects.requireNonNull(name);Objects.requireNonNull(fieldType);return new VarHandleDesc(Kind.FIELD, name, declaringClass, fieldType);}/*** Returns a {@linkplain VarHandleDesc} corresponding to a {@link VarHandle}* for a static field.** @param name the unqualified name of the field* @param declaringClass a {@link ClassDesc} describing the declaring class,*                       for field var handles* @param fieldType a {@link ClassDesc} describing the type of the field* @return the {@linkplain VarHandleDesc}* @throws NullPointerException if any of the arguments are null* @jvms 4.2.2 Unqualified Names*/public static VarHandleDesc ofStaticField(ClassDesc declaringClass, String name, ClassDesc fieldType) {Objects.requireNonNull(declaringClass);Objects.requireNonNull(name);Objects.requireNonNull(fieldType);return new VarHandleDesc(Kind.STATIC_FIELD, name, declaringClass, fieldType);}/*** Returns a {@linkplain VarHandleDesc} corresponding to a {@link VarHandle}* for an array type.** @param arrayClass a {@link ClassDesc} describing the type of the array* @return the {@linkplain VarHandleDesc}* @throws NullPointerException if any of the arguments are null*/public static VarHandleDesc ofArray(ClassDesc arrayClass) {Objects.requireNonNull(arrayClass);if (!arrayClass.isArray())throw new IllegalArgumentException("Array class argument not an array: " + arrayClass);return new VarHandleDesc(Kind.ARRAY, ConstantDescs.DEFAULT_NAME, arrayClass, arrayClass.componentType());}/*** Returns a {@link ClassDesc} describing the type of the variable described* by this descriptor.** @return the variable type*/public ClassDesc varType() {return varType;}@Overridepublic VarHandle resolveConstantDesc(MethodHandles.Lookup lookup)throws ReflectiveOperationException {return switch (kind) {case FIELD        -> lookup.findVarHandle((Class<?>) declaringClass.resolveConstantDesc(lookup),constantName(),(Class<?>) varType.resolveConstantDesc(lookup));case STATIC_FIELD -> lookup.findStaticVarHandle((Class<?>) declaringClass.resolveConstantDesc(lookup),constantName(),(Class<?>) varType.resolveConstantDesc(lookup));case ARRAY        -> MethodHandles.arrayElementVarHandle((Class<?>) declaringClass.resolveConstantDesc(lookup));default -> throw new InternalError("Cannot reach here");};}/*** Returns a compact textual description of this constant description.* For a field {@linkplain VarHandle}, includes the owner, name, and type* of the field, and whether it is static; for an array {@linkplain VarHandle},* the name of the component type.** @return A compact textual description of this descriptor*/@Overridepublic String toString() {return switch (kind) {case FIELD, STATIC_FIELD -> String.format("VarHandleDesc[%s%s.%s:%s]",(kind == Kind.STATIC_FIELD) ? "static " : "",declaringClass.displayName(), constantName(), varType.displayName());case ARRAY               -> String.format("VarHandleDesc[%s[]]", declaringClass.displayName());default -> throw new InternalError("Cannot reach here");};}}}
关键字:东至网站建设_官网cms系统_平台关键词排名优化_百度竞价优化软件

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: