8339131: Remove rarely-used accessor methods from Opcode

Reviewed-by: asotona
This commit is contained in:
Chen Liang 2024-09-04 12:29:40 +00:00
parent e25a9e7fd8
commit bd8569bc6c
8 changed files with 392 additions and 280 deletions

View file

@ -75,7 +75,7 @@ public sealed interface ConstantInstruction extends Instruction {
*/
@Override
default TypeKind typeKind() {
return opcode().primaryTypeKind();
return BytecodeHelpers.intrinsicConstantType(opcode());
}
}
@ -98,7 +98,7 @@ public sealed interface ConstantInstruction extends Instruction {
*/
@Override
default TypeKind typeKind() {
return opcode().primaryTypeKind();
return TypeKind.INT;
}
}
@ -137,7 +137,7 @@ public sealed interface ConstantInstruction extends Instruction {
*/
static IntrinsicConstantInstruction ofIntrinsic(Opcode op) {
Util.checkKind(op, Opcode.Kind.CONSTANT);
if (op.constantValue() == null)
if (op.sizeIfFixed() != 1)
throw new IllegalArgumentException(String.format("Wrong opcode specified; found %s, expected xCONST_val", op));
return new AbstractInstruction.UnboundIntrinsicConstantInstruction(op);
}