jdk-VarHandle 翻译

类介绍

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

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

public abstract class VarHandle implements Constable {final VarForm vform;final boolean exact;/*** 判断 VarHandle  是否有 invoke-exact behavior*/public boolean hasInvokeExactBehavior() {return exact;}// 普通访问/*** 1. 获取一个变量的值*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject get(Object... args);/*** 1. 设置当前变量的值为一个新的值(按照代码的顺序),变量不能被final和volatile修饰,参考普通的写操作* 2. 该方法的签名为:(CT1 ct1, ..., CTn ctn, T newValue)void* 3. 调用set方法传入的参数类型必须和access mode type保持一致** @param args 参数列表 (CT1 ct1, ..., CTn ctn, T newValue),静态使用varargs* @throws UnsupportedOperationException 针对当前的VarHandle 如果 the access mode 不支持* @throws WrongMethodTypeException 如果access mode type 不匹配调用者传入参数的类型* @throws ClassCastException 如果the access mode type匹配调用者传入参数的类型,但是引用转化失败*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidatevoid set(Object... args);// Volatile 属性访问/*** 1. 返回Volatile 修饰的变量的值* 2. 该方法的签名为:(CT1 ct1, ..., CTn ctn)T* 3. 调用set方法传入的参数类型必须和access mode type( accessModeType(VarHandle.AccessMode.GET_VOLATILE))保持一致**/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject getVolatile(Object... args);/*** 1. 设置Volatile 修饰的变量的值* 2. 该方法的签名为:(CT1 ct1, ..., CTn ctn, T newValue)void* 3. 调用set方法传入的参数类型必须和access mode type( accessModeType(VarHandle.AccessMode.SET_VOLATILE))保持一致*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidatevoid setVolatile(Object... args);/*** 1. 返回变量的值* 2. 该方法的签名为:(CT1 ct1, ..., CTn ctn)T* 3. 调用set方法传入的参数类型必须和access mode type( accessModeType(VarHandle.AccessMode.GET_OPAQUE))保持一致*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject getOpaque(Object... args);/*** 1. 设置变量的值* 2. 该方法的签名为:(CT1 ct1, ..., CTn ctn, T newValue)void* 3. 调用set方法传入的参数类型必须和access mode type( accessModeType(VarHandle.AccessMode.SET_OPAQUE))保持一致*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidatevoid setOpaque(Object... args);// Lazy accessors 懒访问/*** 1. 返回变量的值,确保后来的loads和stores操作不会重排序到这个操作前* 2. 该方法的签名为:(CT1 ct1, ..., CTn ctn)T* 3. 调用set方法传入的参数类型必须和access mode type( accessModeType(VarHandle.AccessMode.GET_ACQUIRE))保持一致*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateObject getAcquire(Object... args);/*** 1. 设置变量的值,确保后来的loads和stores操作不会重排序到这个操作前*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidatevoid setRelease(Object... args);// CAS accessors/*** 1. 如果变量的当前值(current value)和expectedValue(内存语义操作做为 getVolatile)相等, * 		原子操作来设置变量的值(内存语义操作做为 setVolatile)* 2. 该方法的签名为:(CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)boolean*/public final native@MethodHandle.PolymorphicSignature@IntrinsicCandidateboolean compareAndSet(Object... args);/*** 同 compareAndSet* 1. 如果变量的当前值(current value)和expectedValue(内存语义操作做为 getVolatile)相等, * 		原子操作来设置变量的值(内存语义操作做为 setVolatile)* 2. 该方法的签名为:(CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)boolean** 返回值:如果设置成功,返回witness value*/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);/*** 返回当前VarHandle对应的coordinate types*/public List<Class<?>> coordinateTypes() {MethodType typeGet = accessModeType(AccessMode.GET);return typeGet.parameterList();}/*** 根据给定的access mode来获取当前VarHandle的MethodType*/public final MethodType accessModeType(AccessMode accessMode) {return accessModeType(accessMode.at.ordinal());}/*** 判断给定的AccessMode 是否支持*/public final boolean isAccessModeSupported(AccessMode accessMode) {return vform.getMemberNameOrNull(accessMode.ordinal()) != null;}/*** 获取和当前VarHandle 绑定的MethodHandle * 下面的代码更加高效:* MethodHandle mh = MethodHandles.varHandleExactInvoker(vh.accessModeType(VarHandle.AccessMode.{access-mode}));* MethodHandle bmh = mh.bindTo(vh);*/public MethodHandle toMethodHandle(AccessMode accessMode) {。。。}/*** 当前实例的名义操作符*/@Overridepublic Optional<VarHandleDesc> describeConstable() {return Optional.empty();}// Fence methods/*** 确保在栅栏(fence)之前的load and stores操作不会与栅栏之后的 loads andstores 操作重新排序。*/@ForceInlinepublic static void fullFence() {UNSAFE.fullFence();}/*** 确保在栅栏(fence)之前的load 操作不会与栅栏之后的 loads and stores 操作重新排序。*/@ForceInlinepublic static void acquireFence() {UNSAFE.loadFence();}/*** 确保在栅栏(fence)之前的load 和 stores 操作不会与栅栏之后的stores 操作重新排序。*/@ForceInlinepublic static void releaseFence() {UNSAFE.storeFence();}/*** 确保在栅栏(fence)之前的加载操作不会与栅栏之后的加载操作重新排序。*/@ForceInlinepublic static void loadLoadFence() {UNSAFE.loadLoadFence();}/*** 确保在栅栏(fence)之前的存储操作不会与栅栏之后的存储操作重新排序。*/@ForceInlinepublic static void storeStoreFence() {UNSAFE.storeStoreFence();}}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/478300.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【C++】C++11新特性详解:可变参数模板与emplace系列的应用

C语法相关知识点可以通过点击以下链接进行学习一起加油&#xff01;命名空间缺省参数与函数重载C相关特性类和对象-上篇类和对象-中篇类和对象-下篇日期类C/C内存管理模板初阶String使用String模拟实现Vector使用及其模拟实现List使用及其模拟实现容器适配器Stack与QueuePriori…

多模态大型语言模型(MLLM)综述

目录 多模态大语言模型的基础 长短期网络结构(LSTM) 自注意力机制 基于Transformer架构的自然语言处理模型 多模态嵌入的关键步骤 TF-IDF TF-IDF的概念 TF-IDF的计算公式 TF-IDF的主要思路 TF-IDF的案例 训练和微调多模态大语言模型(MLLM) 对比学习 (CLIP, ALIG…

Otter 安装流程

优质博文&#xff1a;IT-BLOG-CN 一、背景 随着公司的发展&#xff0c;订单库的数据目前已达到千万级别&#xff0c;需要进行分表分库&#xff0c;就需要对数据进行迁移&#xff0c;我们使用了otter&#xff0c;这里简单整理下&#xff0c;otter 的安装过程&#xff0c;希望对…

Web3 游戏周报(11.17 - 11.23)

回顾上周的区块链游戏概况&#xff0c;查看 Footprint Analytics 与 ABGA 最新发布的数据报告。 【11.17 - 11.23】Web3 游戏行业动态&#xff1a; 加密游戏开发商 Gunzilla Games 发推表示&#xff0c;其已与 Coinbase Ventures 达成合作并获得其投资。 国际足联将与 Mythica…

【linux学习指南】初识Linux进程信号与使用

文章目录 &#x1f4dd;信号快速认识&#x1f4f6;⽣活⻆度的信号&#x1f4f6; 技术应⽤⻆度的信号&#x1f309; 前台进程&#xff08;键盘&#xff09;&#x1f309;⼀个系统函数 &#x1f4f6;信号概念&#x1f4f6;查看信号 &#x1f320; 信号处理&#x1f309; 忽略此信…

3DEXPERIENCE软件是干什么的—3DE软件代理商微辰三维

在当今数字化转型浪潮席卷全球各个行业的大背景下&#xff0c;3DEXPERIENCE 软件宛如一颗璀璨的明星&#xff0c;闪耀在产品设计、制造以及协同创新等诸多领域。它是由达索系统公司推出的一款综合性的、功能强大的商业软件平台&#xff0c;为企业的整个产品生命周期管理带来了前…

【大数据学习 | Spark-Core】广播变量和累加器

1. 共享变量 Spark两种共享变量&#xff1a;广播变量&#xff08;broadcast variable&#xff09;与累加器&#xff08;accumulator&#xff09;。 累加器用来对信息进行聚合&#xff0c;相当于mapreduce中的counter&#xff1b;而广播变量用来高效分发较大的对象&#xff0c…

STM32编程小工具FlyMcu和STLINK Utility 《通俗易懂》破解

FlyMcu FlyMcu 模拟仿真软件是一款用于 STM32 芯片 ISP 串口烧录程序的专用工具&#xff0c;免费&#xff0c;且较为非常容易下手&#xff0c;好用便捷。 注意&#xff1a;STM32 芯片的 ISP 下载&#xff0c;只能使用串口1&#xff08;USART1&#xff09;&#xff0c;对应的串口…

MTK主板_安卓主板方案_MTK联发科主板定制开发

联发科(MTK)主板以其强大的性能和多样化的功能而受到广泛关注。该平台包括多个型号&#xff0c;例如MT6761、MT8766、MT6762、MT6765、MT8768和MT8788等&#xff0c;均配置了四核或八核64位处理器&#xff0c;主频可高达2.0GHz。采用先进的12nm工艺&#xff0c;搭载Android 11.…

信息收集(1)

学习视频引路信息收集&#xff08;1&#xff09;_哔哩哔哩_bilibili View信息收集&#xff08;1&#xff09; 分享一个漏洞挖掘平台&#xff1a;补天 以吉林通用航空职业技术学院|官网 (jlthedu.com)为目标 第一步&#xff1a;查看cdn和域名被注册的信息 可以查询域名信息的…

React(六)——Redux

文章目录 项目地址基本理解一、配置Redux store二、创建slice配置到store里并使用三、给Slice配置reducers&#xff0c;用来修改初始值 项目地址 教程作者&#xff1a;教程地址&#xff1a; 代码仓库地址&#xff1a; 所用到的框架和插件&#xff1a; dbt airflow基本理解 s…

如何利用ATECLOUD平台来实现数据报告的导出和数据分析?-纳米软件

1.数据报告导出 选择报告模板&#xff1a;ATECLOUD 平台通常会提供多种预设的数据报告模板&#xff0c;这些模板是根据不同的测试场景和需求设计的。例如&#xff0c;在电源模块测试中&#xff0c;有针对输出电压、电流、功率等基本参数的报告模板&#xff0c;也有包含纹波系数…

[ZJCTF 2019]NiZhuanSiWei

[ZJCTF 2019]NiZhuanSiWei 上面代码&#xff0c;使用get上传了三个参数&#xff0c;在text者用力恒等于&#xff0c;然后就输出&#xff0c;接着第二个参数中出现flag就输出not now&#xff0c;接着第三个参数是反序了一下输出。 ?textdata://text/plain,welcome to the zjct…

JSONCPP 数据解析与序列化

常用类接口 Json::Value 类 用于存储 JSON 数据的核心类。它支持将数据解析为对象、数组或基本类型&#xff08;如字符串、数值等&#xff09; 赋值操作符&#xff1a;Value& operator(Value other); 用于将一个 JSON 值赋给另一个 JSON 值 Json::Value value; value &…

40分钟学 Go 语言高并发:【实战】并发安全的配置管理器(功能扩展)

【实战】并发安全的配置管理器&#xff08;功能扩展&#xff09; 一、扩展思考 分布式配置中心 实现配置的集中管理支持多节点配置同步实现配置的版本一致性 配置加密 敏感配置的加密存储配置的安全传输访问权限控制 配置格式支持 支持YAML、TOML等多种格式配置格式自动…

ChatGPT 桌面版发布了,如何安装?

本章教程教大家如何进行安装。 一、下载安装包 官网地址地址&#xff1a;https://openai.com/chatgpt/desktop/ 支持Windows和MacOS操作系统 二、安装步骤 Windows用户下载之后&#xff0c;会有一个exe安装包&#xff0c;点击运行安装即可。 注意事项&#xff0c;如果Windows操…

【Electron学习笔记(二)】基于Electron开发应用程序

基于Electron开发本地应用程序 基于Electron开发本地应用程序前言正文1、创建 pages 目录2、创建 index.html 文件3 、创建 html.css 文件4 、main.js里引入页面5 、运行 start 命令6 、启用开发者模式7 、解决内容安全策略8、完善窗口行为9、配置自动重启&#xff0c;保存后自…

力扣--LCR 154.复杂链表的复制

题目 请实现 copyRandomList 函数&#xff0c;复制一个复杂链表。在复杂链表中&#xff0c;每个节点除了有一个 next 指针指向下一个节点&#xff0c;还有一个 random 指针指向链表中的任意节点或者 null。 提示&#xff1a; -10000 < Node.val < 10000 Node.random 为…

windows server 2019 启动 nginx 报错

环境 &#xff1a;windows server 2019 &#xff0c;nginx-1.19.7 背景&#xff1a; 自己经常用这个 nginx 包作为 web 服务器。今天发现 部署到 server 2019 上直接报错了。这可是原生的包&#xff0c;我啥也没改&#xff0c;怎么可能报错。而且之前在 其他服务器用都没问题…