mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8267612: Declare package-private VarHandle.AccessMode/AccessType counts
Reviewed-by: mchung
This commit is contained in:
parent
a52c4ede2f
commit
66b190e1e7
4 changed files with 16 additions and 10 deletions
|
@ -45,7 +45,7 @@ import java.util.function.BiFunction;
|
|||
/* package */ class IndirectVarHandle extends VarHandle {
|
||||
|
||||
@Stable
|
||||
private final MethodHandle[] handleMap = new MethodHandle[AccessMode.values().length];
|
||||
private final MethodHandle[] handleMap = new MethodHandle[AccessMode.COUNT];
|
||||
private final VarHandle directTarget; // cache, for performance reasons
|
||||
private final VarHandle target;
|
||||
private final BiFunction<AccessMode, MethodHandle, MethodHandle> handleFactory;
|
||||
|
|
|
@ -55,8 +55,8 @@ class Invokers {
|
|||
INV_GENERIC = 1, // MethodHandles.invoker (generic invocation)
|
||||
INV_BASIC = 2, // MethodHandles.basicInvoker
|
||||
VH_INV_EXACT = 3, // MethodHandles.varHandleExactInvoker
|
||||
VH_INV_GENERIC = VH_INV_EXACT + VarHandle.AccessMode.values().length, // MethodHandles.varHandleInvoker
|
||||
INV_LIMIT = VH_INV_GENERIC + VarHandle.AccessMode.values().length;
|
||||
VH_INV_GENERIC = VH_INV_EXACT + VarHandle.AccessMode.COUNT, // MethodHandles.varHandleInvoker
|
||||
INV_LIMIT = VH_INV_GENERIC + VarHandle.AccessMode.COUNT;
|
||||
|
||||
/** Compute and cache information common to all collecting adapters
|
||||
* that implement members of the erasure-family of the given erased type.
|
||||
|
|
|
@ -49,8 +49,8 @@ final class VarForm {
|
|||
final @Stable MemberName[] memberName_table;
|
||||
|
||||
VarForm(Class<?> implClass, Class<?> receiver, Class<?> value, Class<?>... intermediate) {
|
||||
this.methodType_table = new MethodType[VarHandle.AccessType.values().length];
|
||||
this.memberName_table = new MemberName[VarHandle.AccessMode.values().length];
|
||||
this.methodType_table = new MethodType[VarHandle.AccessType.COUNT];
|
||||
this.memberName_table = new MemberName[VarHandle.AccessMode.COUNT];
|
||||
this.implClass = implClass;
|
||||
if (receiver == null) {
|
||||
initMethodTypes(value, intermediate);
|
||||
|
@ -64,7 +64,7 @@ final class VarForm {
|
|||
|
||||
// Used by IndirectVarHandle
|
||||
VarForm(Class<?> value, Class<?>[] coordinates) {
|
||||
this.methodType_table = new MethodType[VarHandle.AccessType.values().length];
|
||||
this.methodType_table = new MethodType[VarHandle.AccessType.COUNT];
|
||||
this.memberName_table = null;
|
||||
this.implClass = null;
|
||||
initMethodTypes(value, coordinates);
|
||||
|
|
|
@ -1637,6 +1637,10 @@ public abstract class VarHandle implements Constable {
|
|||
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;
|
||||
|
||||
|
@ -1891,6 +1895,10 @@ public abstract class VarHandle implements Constable {
|
|||
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;
|
||||
|
||||
|
@ -2126,12 +2134,10 @@ public abstract class VarHandle implements Constable {
|
|||
|
||||
static class TypesAndInvokers {
|
||||
final @Stable
|
||||
MethodType[] methodType_table =
|
||||
new MethodType[VarHandle.AccessType.values().length];
|
||||
MethodType[] methodType_table = new MethodType[VarHandle.AccessType.COUNT];
|
||||
|
||||
final @Stable
|
||||
MethodHandle[] methodHandle_table =
|
||||
new MethodHandle[AccessMode.values().length];
|
||||
MethodHandle[] methodHandle_table = new MethodHandle[AccessMode.COUNT];
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue