8339115: Rename TypeKind enum constants to follow code style

Reviewed-by: asotona
This commit is contained in:
Chen Liang 2024-08-30 17:28:28 +00:00
parent fef1ef7dfe
commit 25e03b5209
38 changed files with 725 additions and 638 deletions

View file

@ -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);