mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8339115: Rename TypeKind enum constants to follow code style
Reviewed-by: asotona
This commit is contained in:
parent
fef1ef7dfe
commit
25e03b5209
38 changed files with 725 additions and 638 deletions
|
@ -368,9 +368,9 @@ class InvokerBytecodeGenerator {
|
|||
*/
|
||||
private void emitUnboxing(CodeBuilder cob, TypeKind target) {
|
||||
switch (target) {
|
||||
case BooleanType -> emitReferenceCast(cob, Boolean.class, null);
|
||||
case CharType -> emitReferenceCast(cob, Character.class, null);
|
||||
case ByteType, DoubleType, FloatType, IntType, LongType, ShortType ->
|
||||
case BOOLEAN -> emitReferenceCast(cob, Boolean.class, null);
|
||||
case CHAR -> emitReferenceCast(cob, Character.class, null);
|
||||
case BYTE, DOUBLE, FLOAT, INT, LONG, SHORT ->
|
||||
emitReferenceCast(cob, Number.class, null);
|
||||
default -> {}
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ class InvokerBytecodeGenerator {
|
|||
}
|
||||
if (writeBack != null) {
|
||||
cob.dup();
|
||||
emitStoreInsn(cob, TypeKind.ReferenceType, writeBack.index());
|
||||
emitStoreInsn(cob, TypeKind.REFERENCE, writeBack.index());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -901,7 +901,7 @@ class InvokerBytecodeGenerator {
|
|||
// invoke selectAlternativeName.arguments[1]
|
||||
Class<?>[] preForkClasses = localClasses.clone();
|
||||
emitPushArgument(cob, selectAlternativeName, 1); // get 2nd argument of selectAlternative
|
||||
emitStoreInsn(cob, TypeKind.ReferenceType, receiver.index()); // store the MH in the receiver slot
|
||||
emitStoreInsn(cob, TypeKind.REFERENCE, receiver.index()); // store the MH in the receiver slot
|
||||
emitStaticInvoke(cob, invokeBasicName);
|
||||
|
||||
// goto L_done
|
||||
|
@ -913,7 +913,7 @@ class InvokerBytecodeGenerator {
|
|||
// invoke selectAlternativeName.arguments[2]
|
||||
System.arraycopy(preForkClasses, 0, localClasses, 0, preForkClasses.length);
|
||||
emitPushArgument(cob, selectAlternativeName, 2); // get 3rd argument of selectAlternative
|
||||
emitStoreInsn(cob, TypeKind.ReferenceType, receiver.index()); // store the MH in the receiver slot
|
||||
emitStoreInsn(cob, TypeKind.REFERENCE, receiver.index()); // store the MH in the receiver slot
|
||||
emitStaticInvoke(cob, invokeBasicName);
|
||||
|
||||
// L_done:
|
||||
|
@ -1151,7 +1151,7 @@ class InvokerBytecodeGenerator {
|
|||
emitPushArgument(cob, invoker, 2); // push cases
|
||||
cob.getfield(CD_CasesHolder, "cases", CD_MethodHandle_array);
|
||||
int casesLocal = extendLocalsMap(new Class<?>[] { MethodHandle[].class });
|
||||
emitStoreInsn(cob, TypeKind.ReferenceType, casesLocal);
|
||||
emitStoreInsn(cob, TypeKind.REFERENCE, casesLocal);
|
||||
|
||||
Label endLabel = cob.newLabel();
|
||||
Label defaultLabel = cob.newLabel();
|
||||
|
@ -1172,7 +1172,7 @@ class InvokerBytecodeGenerator {
|
|||
for (int i = 0; i < numCases; i++) {
|
||||
cob.labelBinding(cases.get(i).target());
|
||||
// Load the particular case:
|
||||
emitLoadInsn(cob, TypeKind.ReferenceType, casesLocal);
|
||||
emitLoadInsn(cob, TypeKind.REFERENCE, casesLocal);
|
||||
cob.loadConstant(i);
|
||||
cob.aaload();
|
||||
|
||||
|
@ -1311,7 +1311,7 @@ class InvokerBytecodeGenerator {
|
|||
// PREINIT:
|
||||
emitPushArgument(cob, MethodHandleImpl.LoopClauses.class, invoker.arguments[1]);
|
||||
cob.getfield(CD_LoopClauses, "clauses", CD_MethodHandle_array2);
|
||||
emitStoreInsn(cob, TypeKind.ReferenceType, clauseDataIndex);
|
||||
emitStoreInsn(cob, TypeKind.REFERENCE, clauseDataIndex);
|
||||
|
||||
// INIT:
|
||||
for (int c = 0, state = 0; c < nClauses; ++c) {
|
||||
|
@ -1398,7 +1398,7 @@ class InvokerBytecodeGenerator {
|
|||
}
|
||||
|
||||
private void emitPushClauseArray(CodeBuilder cob, int clauseDataSlot, int which) {
|
||||
emitLoadInsn(cob, TypeKind.ReferenceType, clauseDataSlot);
|
||||
emitLoadInsn(cob, TypeKind.REFERENCE, clauseDataSlot);
|
||||
cob.loadConstant(which - 1);
|
||||
cob.aaload();
|
||||
}
|
||||
|
@ -1497,7 +1497,7 @@ class InvokerBytecodeGenerator {
|
|||
// long - l2i,i2b l2i,i2s l2i,i2c l2i <-> l2f l2d
|
||||
// float - f2i,i2b f2i,i2s f2i,i2c f2i f2l <-> f2d
|
||||
// double - d2i,i2b d2i,i2s d2i,i2c d2i d2l d2f <->
|
||||
if (from != to && from != TypeKind.BooleanType) try {
|
||||
if (from != to && from != TypeKind.BOOLEAN) try {
|
||||
cob.conversion(from, to);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new IllegalStateException("unhandled prim cast: " + from + "2" + to);
|
||||
|
|
|
@ -138,12 +138,12 @@ class LambdaForm {
|
|||
public static final int VOID_RESULT = -1, LAST_RESULT = -2;
|
||||
|
||||
enum BasicType {
|
||||
L_TYPE('L', Object.class, Wrapper.OBJECT, TypeKind.ReferenceType), // all reference types
|
||||
I_TYPE('I', int.class, Wrapper.INT, TypeKind.IntType),
|
||||
J_TYPE('J', long.class, Wrapper.LONG, TypeKind.LongType),
|
||||
F_TYPE('F', float.class, Wrapper.FLOAT, TypeKind.FloatType),
|
||||
D_TYPE('D', double.class, Wrapper.DOUBLE, TypeKind.DoubleType), // all primitive types
|
||||
V_TYPE('V', void.class, Wrapper.VOID, TypeKind.VoidType); // not valid in all contexts
|
||||
L_TYPE('L', Object.class, Wrapper.OBJECT, TypeKind.REFERENCE), // all reference types
|
||||
I_TYPE('I', int.class, Wrapper.INT, TypeKind.INT),
|
||||
J_TYPE('J', long.class, Wrapper.LONG, TypeKind.LONG),
|
||||
F_TYPE('F', float.class, Wrapper.FLOAT, TypeKind.FLOAT),
|
||||
D_TYPE('D', double.class, Wrapper.DOUBLE, TypeKind.DOUBLE), // all primitive types
|
||||
V_TYPE('V', void.class, Wrapper.VOID, TypeKind.VOID); // not valid in all contexts
|
||||
|
||||
static final @Stable BasicType[] ALL_TYPES = BasicType.values();
|
||||
static final @Stable BasicType[] ARG_TYPES = Arrays.copyOf(ALL_TYPES, ALL_TYPES.length-1);
|
||||
|
|
|
@ -49,8 +49,6 @@ import java.lang.constant.ClassDesc;
|
|||
import java.lang.constant.MethodTypeDesc;
|
||||
import java.lang.invoke.MethodHandles.Lookup;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
@ -1419,11 +1417,11 @@ public final class StringConcatFactory {
|
|||
// Compute parameter variable slots
|
||||
int paramCount = concatArgs.parameterCount(),
|
||||
thisSlot = cb.receiverSlot(),
|
||||
lengthSlot = cb.allocateLocal(TypeKind.IntType),
|
||||
coderSlot = cb.allocateLocal(TypeKind.ByteType),
|
||||
bufSlot = cb.allocateLocal(TypeKind.ReferenceType),
|
||||
constantsSlot = cb.allocateLocal(TypeKind.ReferenceType),
|
||||
suffixSlot = cb.allocateLocal(TypeKind.ReferenceType);
|
||||
lengthSlot = cb.allocateLocal(TypeKind.INT),
|
||||
coderSlot = cb.allocateLocal(TypeKind.BYTE),
|
||||
bufSlot = cb.allocateLocal(TypeKind.REFERENCE),
|
||||
constantsSlot = cb.allocateLocal(TypeKind.REFERENCE),
|
||||
suffixSlot = cb.allocateLocal(TypeKind.REFERENCE);
|
||||
|
||||
/*
|
||||
* Types other than int/long/char/boolean require local variables to store the result of stringOf.
|
||||
|
@ -1447,7 +1445,7 @@ public final class StringConcatFactory {
|
|||
} else {
|
||||
methodTypeDesc = MTD_String_Object;
|
||||
}
|
||||
stringSlots[i] = cb.allocateLocal(TypeKind.ReferenceType);
|
||||
stringSlots[i] = cb.allocateLocal(TypeKind.REFERENCE);
|
||||
cb.loadLocal(TypeKind.from(cl), cb.parameterSlot(i))
|
||||
.invokestatic(CD_StringConcatHelper, "stringOf", methodTypeDesc)
|
||||
.astore(stringSlots[i]);
|
||||
|
@ -1464,7 +1462,7 @@ public final class StringConcatFactory {
|
|||
var cl = concatArgs.parameterType(i);
|
||||
if (maybeUTF16(cl)) {
|
||||
if (cl == char.class) {
|
||||
cb.loadLocal(TypeKind.CharType, cb.parameterSlot(i));
|
||||
cb.loadLocal(TypeKind.CHAR, cb.parameterSlot(i));
|
||||
} else {
|
||||
cb.aload(stringSlots[i]);
|
||||
}
|
||||
|
@ -1531,7 +1529,7 @@ public final class StringConcatFactory {
|
|||
var kind = TypeKind.from(cl);
|
||||
if (needStringOf(cl)) {
|
||||
paramSlot = stringSlots[i];
|
||||
kind = TypeKind.ReferenceType;
|
||||
kind = TypeKind.REFERENCE;
|
||||
}
|
||||
cb.loadLocal(kind, paramSlot);
|
||||
}
|
||||
|
@ -1682,7 +1680,7 @@ public final class StringConcatFactory {
|
|||
} else if (cl == CD_char) {
|
||||
methodTypeDesc = PREPEND_char;
|
||||
} else {
|
||||
kind = TypeKind.ReferenceType;
|
||||
kind = TypeKind.REFERENCE;
|
||||
methodTypeDesc = PREPEND_String;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,14 +69,14 @@ class TypeConvertingMethodAdapter {
|
|||
}
|
||||
|
||||
private static TypeKind primitiveTypeKindFromClass(Class<?> type) {
|
||||
if (type == Integer.class) return TypeKind.IntType;
|
||||
if (type == Long.class) return TypeKind.LongType;
|
||||
if (type == Boolean.class) return TypeKind.BooleanType;
|
||||
if (type == Short.class) return TypeKind.ShortType;
|
||||
if (type == Byte.class) return TypeKind.ByteType;
|
||||
if (type == Character.class) return TypeKind.CharType;
|
||||
if (type == Float.class) return TypeKind.FloatType;
|
||||
if (type == Double.class) return TypeKind.DoubleType;
|
||||
if (type == Integer.class) return TypeKind.INT;
|
||||
if (type == Long.class) return TypeKind.LONG;
|
||||
if (type == Boolean.class) return TypeKind.BOOLEAN;
|
||||
if (type == Short.class) return TypeKind.SHORT;
|
||||
if (type == Byte.class) return TypeKind.BYTE;
|
||||
if (type == Character.class) return TypeKind.CHAR;
|
||||
if (type == Float.class) return TypeKind.FLOAT;
|
||||
if (type == Double.class) return TypeKind.DOUBLE;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -94,27 +94,27 @@ class TypeConvertingMethodAdapter {
|
|||
|
||||
static void box(CodeBuilder cob, TypeKind tk) {
|
||||
switch (tk) {
|
||||
case BooleanType -> cob.invokestatic(BoxHolder.BOX_BOOLEAN);
|
||||
case ByteType -> cob.invokestatic(BoxHolder.BOX_BYTE);
|
||||
case CharType -> cob.invokestatic(BoxHolder.BOX_CHAR);
|
||||
case DoubleType -> cob.invokestatic(BoxHolder.BOX_DOUBLE);
|
||||
case FloatType -> cob.invokestatic(BoxHolder.BOX_FLOAT);
|
||||
case IntType -> cob.invokestatic(BoxHolder.BOX_INT);
|
||||
case LongType -> cob.invokestatic(BoxHolder.BOX_LONG);
|
||||
case ShortType -> cob.invokestatic(BoxHolder.BOX_SHORT);
|
||||
case BOOLEAN -> cob.invokestatic(BoxHolder.BOX_BOOLEAN);
|
||||
case BYTE -> cob.invokestatic(BoxHolder.BOX_BYTE);
|
||||
case CHAR -> cob.invokestatic(BoxHolder.BOX_CHAR);
|
||||
case DOUBLE -> cob.invokestatic(BoxHolder.BOX_DOUBLE);
|
||||
case FLOAT -> cob.invokestatic(BoxHolder.BOX_FLOAT);
|
||||
case INT -> cob.invokestatic(BoxHolder.BOX_INT);
|
||||
case LONG -> cob.invokestatic(BoxHolder.BOX_LONG);
|
||||
case SHORT -> cob.invokestatic(BoxHolder.BOX_SHORT);
|
||||
}
|
||||
}
|
||||
|
||||
static void unbox(CodeBuilder cob, TypeKind to) {
|
||||
switch (to) {
|
||||
case BooleanType -> cob.invokevirtual(BoxHolder.UNBOX_BOOLEAN);
|
||||
case ByteType -> cob.invokevirtual(BoxHolder.UNBOX_BYTE);
|
||||
case CharType -> cob.invokevirtual(BoxHolder.UNBOX_CHAR);
|
||||
case DoubleType -> cob.invokevirtual(BoxHolder.UNBOX_DOUBLE);
|
||||
case FloatType -> cob.invokevirtual(BoxHolder.UNBOX_FLOAT);
|
||||
case IntType -> cob.invokevirtual(BoxHolder.UNBOX_INT);
|
||||
case LongType -> cob.invokevirtual(BoxHolder.UNBOX_LONG);
|
||||
case ShortType -> cob.invokevirtual(BoxHolder.UNBOX_SHORT);
|
||||
case BOOLEAN -> cob.invokevirtual(BoxHolder.UNBOX_BOOLEAN);
|
||||
case BYTE -> cob.invokevirtual(BoxHolder.UNBOX_BYTE);
|
||||
case CHAR -> cob.invokevirtual(BoxHolder.UNBOX_CHAR);
|
||||
case DOUBLE -> cob.invokevirtual(BoxHolder.UNBOX_DOUBLE);
|
||||
case FLOAT -> cob.invokevirtual(BoxHolder.UNBOX_FLOAT);
|
||||
case INT -> cob.invokevirtual(BoxHolder.UNBOX_INT);
|
||||
case LONG -> cob.invokevirtual(BoxHolder.UNBOX_LONG);
|
||||
case SHORT -> cob.invokevirtual(BoxHolder.UNBOX_SHORT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue