8339260: Move rarely used constants out of ClassFile

Reviewed-by: asotona
This commit is contained in:
Chen Liang 2024-09-26 06:34:18 +00:00
parent 47c10694c6
commit 8c8f0d85ce
37 changed files with 1545 additions and 1916 deletions

View File

@ -60,7 +60,7 @@ public sealed interface AnnotationValue {
/**
* Models an annotation value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_ANNOTATION}.
* The {@linkplain #tag tag} of this value is {@value TAG_ANNOTATION}.
*
* @since 22
*/
@ -73,7 +73,7 @@ public sealed interface AnnotationValue {
/**
* Models an array value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_ARRAY}.
* The {@linkplain #tag tag} of this value is {@value TAG_ARRAY}.
*
* @since 22
*/
@ -131,7 +131,7 @@ public sealed interface AnnotationValue {
/**
* Models a string value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_STRING}.
* The {@linkplain #tag tag} of this value is {@value TAG_STRING}.
*
* @since 22
*/
@ -159,7 +159,7 @@ public sealed interface AnnotationValue {
/**
* Models a double value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_DOUBLE}.
* The {@linkplain #tag tag} of this value is {@value TAG_DOUBLE}.
*
* @since 22
*/
@ -187,7 +187,7 @@ public sealed interface AnnotationValue {
/**
* Models a float value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_FLOAT}.
* The {@linkplain #tag tag} of this value is {@value TAG_FLOAT}.
*
* @since 22
*/
@ -215,7 +215,7 @@ public sealed interface AnnotationValue {
/**
* Models a long value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_LONG}.
* The {@linkplain #tag tag} of this value is {@value TAG_LONG}.
*
* @since 22
*/
@ -243,7 +243,7 @@ public sealed interface AnnotationValue {
/**
* Models an int value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_INT}.
* The {@linkplain #tag tag} of this value is {@value TAG_INT}.
*
* @since 22
*/
@ -271,7 +271,7 @@ public sealed interface AnnotationValue {
/**
* Models a short value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_SHORT}.
* The {@linkplain #tag tag} of this value is {@value TAG_SHORT}.
*
* @since 22
*/
@ -302,7 +302,7 @@ public sealed interface AnnotationValue {
/**
* Models a char value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_CHAR}.
* The {@linkplain #tag tag} of this value is {@value TAG_CHAR}.
*
* @since 22
*/
@ -333,7 +333,7 @@ public sealed interface AnnotationValue {
/**
* Models a byte value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_BYTE}.
* The {@linkplain #tag tag} of this value is {@value TAG_BYTE}.
*
* @since 22
*/
@ -364,7 +364,7 @@ public sealed interface AnnotationValue {
/**
* Models a boolean value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_BOOLEAN}.
* The {@linkplain #tag tag} of this value is {@value TAG_BOOLEAN}.
*
* @since 22
*/
@ -395,7 +395,7 @@ public sealed interface AnnotationValue {
/**
* Models a class value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_CLASS}.
* The {@linkplain #tag tag} of this value is {@value TAG_CLASS}.
*
* @since 22
*/
@ -413,7 +413,7 @@ public sealed interface AnnotationValue {
/**
* Models an enum value of an element-value pair.
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_ENUM}.
* The {@linkplain #tag tag} of this value is {@value TAG_ENUM}.
*
* @since 22
*/
@ -432,9 +432,52 @@ public sealed interface AnnotationValue {
Utf8Entry constantName();
}
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfByte}. */
int TAG_BYTE = 'B';
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfChar}. */
int TAG_CHAR = 'C';
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfDouble}. */
int TAG_DOUBLE = 'D';
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfFloat}. */
int TAG_FLOAT = 'F';
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfInt}. */
int TAG_INT = 'I';
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfLong}. */
int TAG_LONG = 'J';
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfShort}. */
int TAG_SHORT = 'S';
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfBoolean}. */
int TAG_BOOLEAN = 'Z';
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfString}. */
int TAG_STRING = 's';
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfEnum}. */
int TAG_ENUM = 'e';
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfClass}. */
int TAG_CLASS = 'c';
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfAnnotation}. */
int TAG_ANNOTATION = '@';
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfArray}. */
int TAG_ARRAY = '[';
/**
* {@return the tag character for this value as per JVMS {@jvms 4.7.16.1}}
* The tag characters have a one-to-one mapping to the types of annotation element values.
*
* @apiNote
* {@code TAG_}-prefixed constants in this class, such as {@link #TAG_INT},
* describe the possible return values of this method.
*/
char tag();

View File

@ -512,903 +512,75 @@ public sealed interface ClassFile
/** 0xCAFEBABE */
int MAGIC_NUMBER = 0xCAFEBABE;
/** The integer value used to encode the NOP instruction. */
int NOP = 0;
/** The integer value used to encode the ACONST_NULL instruction. */
int ACONST_NULL = 1;
/** The integer value used to encode the ICONST_M1 instruction. */
int ICONST_M1 = 2;
/** The integer value used to encode the ICONST_0 instruction. */
int ICONST_0 = 3;
/** The integer value used to encode the ICONST_1 instruction. */
int ICONST_1 = 4;
/** The integer value used to encode the ICONST_2 instruction. */
int ICONST_2 = 5;
/** The integer value used to encode the ICONST_3 instruction. */
int ICONST_3 = 6;
/** The integer value used to encode the ICONST_4 instruction. */
int ICONST_4 = 7;
/** The integer value used to encode the ICONST_5 instruction. */
int ICONST_5 = 8;
/** The integer value used to encode the LCONST_0 instruction. */
int LCONST_0 = 9;
/** The integer value used to encode the LCONST_1 instruction. */
int LCONST_1 = 10;
/** The integer value used to encode the FCONST_0 instruction. */
int FCONST_0 = 11;
/** The integer value used to encode the FCONST_1 instruction. */
int FCONST_1 = 12;
/** The integer value used to encode the FCONST_2 instruction. */
int FCONST_2 = 13;
/** The integer value used to encode the DCONST_0 instruction. */
int DCONST_0 = 14;
/** The integer value used to encode the DCONST_1 instruction. */
int DCONST_1 = 15;
/** The integer value used to encode the BIPUSH instruction. */
int BIPUSH = 16;
/** The integer value used to encode the SIPUSH instruction. */
int SIPUSH = 17;
/** The integer value used to encode the LDC instruction. */
int LDC = 18;
/** The integer value used to encode the LDC_W instruction. */
int LDC_W = 19;
/** The integer value used to encode the LDC2_W instruction. */
int LDC2_W = 20;
/** The integer value used to encode the ILOAD instruction. */
int ILOAD = 21;
/** The integer value used to encode the LLOAD instruction. */
int LLOAD = 22;
/** The integer value used to encode the FLOAD instruction. */
int FLOAD = 23;
/** The integer value used to encode the DLOAD instruction. */
int DLOAD = 24;
/** The integer value used to encode the ALOAD instruction. */
int ALOAD = 25;
/** The integer value used to encode the ILOAD_0 instruction. */
int ILOAD_0 = 26;
/** The integer value used to encode the ILOAD_1 instruction. */
int ILOAD_1 = 27;
/** The integer value used to encode the ILOAD_2 instruction. */
int ILOAD_2 = 28;
/** The integer value used to encode the ILOAD_3 instruction. */
int ILOAD_3 = 29;
/** The integer value used to encode the LLOAD_0 instruction. */
int LLOAD_0 = 30;
/** The integer value used to encode the LLOAD_1 instruction. */
int LLOAD_1 = 31;
/** The integer value used to encode the LLOAD_2 instruction. */
int LLOAD_2 = 32;
/** The integer value used to encode the LLOAD_3 instruction. */
int LLOAD_3 = 33;
/** The integer value used to encode the FLOAD_0 instruction. */
int FLOAD_0 = 34;
/** The integer value used to encode the FLOAD_1 instruction. */
int FLOAD_1 = 35;
/** The integer value used to encode the FLOAD_2 instruction. */
int FLOAD_2 = 36;
/** The integer value used to encode the FLOAD_3 instruction. */
int FLOAD_3 = 37;
/** The integer value used to encode the DLOAD_0 instruction. */
int DLOAD_0 = 38;
/** The integer value used to encode the DLOAD_1 instruction. */
int DLOAD_1 = 39;
/** The integer value used to encode the DLOAD_2 instruction. */
int DLOAD_2 = 40;
/** The integer value used to encode the DLOAD_3 instruction. */
int DLOAD_3 = 41;
/** The integer value used to encode the ALOAD_0 instruction. */
int ALOAD_0 = 42;
/** The integer value used to encode the ALOAD_1 instruction. */
int ALOAD_1 = 43;
/** The integer value used to encode the ALOAD_2 instruction. */
int ALOAD_2 = 44;
/** The integer value used to encode the ALOAD_3 instruction. */
int ALOAD_3 = 45;
/** The integer value used to encode the IALOAD instruction. */
int IALOAD = 46;
/** The integer value used to encode the LALOAD instruction. */
int LALOAD = 47;
/** The integer value used to encode the FALOAD instruction. */
int FALOAD = 48;
/** The integer value used to encode the DALOAD instruction. */
int DALOAD = 49;
/** The integer value used to encode the AALOAD instruction. */
int AALOAD = 50;
/** The integer value used to encode the BALOAD instruction. */
int BALOAD = 51;
/** The integer value used to encode the CALOAD instruction. */
int CALOAD = 52;
/** The integer value used to encode the SALOAD instruction. */
int SALOAD = 53;
/** The integer value used to encode the ISTORE instruction. */
int ISTORE = 54;
/** The integer value used to encode the LSTORE instruction. */
int LSTORE = 55;
/** The integer value used to encode the FSTORE instruction. */
int FSTORE = 56;
/** The integer value used to encode the DSTORE instruction. */
int DSTORE = 57;
/** The integer value used to encode the ASTORE instruction. */
int ASTORE = 58;
/** The integer value used to encode the ISTORE_0 instruction. */
int ISTORE_0 = 59;
/** The integer value used to encode the ISTORE_1 instruction. */
int ISTORE_1 = 60;
/** The integer value used to encode the ISTORE_2 instruction. */
int ISTORE_2 = 61;
/** The integer value used to encode the ISTORE_3 instruction. */
int ISTORE_3 = 62;
/** The integer value used to encode the LSTORE_0 instruction. */
int LSTORE_0 = 63;
/** The integer value used to encode the LSTORE_1 instruction. */
int LSTORE_1 = 64;
/** The integer value used to encode the LSTORE_2 instruction. */
int LSTORE_2 = 65;
/** The integer value used to encode the LSTORE_3 instruction. */
int LSTORE_3 = 66;
/** The integer value used to encode the FSTORE_0 instruction. */
int FSTORE_0 = 67;
/** The integer value used to encode the FSTORE_1 instruction. */
int FSTORE_1 = 68;
/** The integer value used to encode the FSTORE_2 instruction. */
int FSTORE_2 = 69;
/** The integer value used to encode the FSTORE_3 instruction. */
int FSTORE_3 = 70;
/** The integer value used to encode the DSTORE_0 instruction. */
int DSTORE_0 = 71;
/** The integer value used to encode the DSTORE_1 instruction. */
int DSTORE_1 = 72;
/** The integer value used to encode the DSTORE_2 instruction. */
int DSTORE_2 = 73;
/** The integer value used to encode the DSTORE_3 instruction. */
int DSTORE_3 = 74;
/** The integer value used to encode the ASTORE_0 instruction. */
int ASTORE_0 = 75;
/** The integer value used to encode the ASTORE_1 instruction. */
int ASTORE_1 = 76;
/** The integer value used to encode the ASTORE_2 instruction. */
int ASTORE_2 = 77;
/** The integer value used to encode the ASTORE_3 instruction. */
int ASTORE_3 = 78;
/** The integer value used to encode the IASTORE instruction. */
int IASTORE = 79;
/** The integer value used to encode the LASTORE instruction. */
int LASTORE = 80;
/** The integer value used to encode the FASTORE instruction. */
int FASTORE = 81;
/** The integer value used to encode the DASTORE instruction. */
int DASTORE = 82;
/** The integer value used to encode the AASTORE instruction. */
int AASTORE = 83;
/** The integer value used to encode the BASTORE instruction. */
int BASTORE = 84;
/** The integer value used to encode the CASTORE instruction. */
int CASTORE = 85;
/** The integer value used to encode the SASTORE instruction. */
int SASTORE = 86;
/** The integer value used to encode the POP instruction. */
int POP = 87;
/** The integer value used to encode the POP2 instruction. */
int POP2 = 88;
/** The integer value used to encode the DUP instruction. */
int DUP = 89;
/** The integer value used to encode the DUP_X1 instruction. */
int DUP_X1 = 90;
/** The integer value used to encode the DUP_X2 instruction. */
int DUP_X2 = 91;
/** The integer value used to encode the DUP2 instruction. */
int DUP2 = 92;
/** The integer value used to encode the DUP2_X1 instruction. */
int DUP2_X1 = 93;
/** The integer value used to encode the DUP2_X2 instruction. */
int DUP2_X2 = 94;
/** The integer value used to encode the SWAP instruction. */
int SWAP = 95;
/** The integer value used to encode the IADD instruction. */
int IADD = 96;
/** The integer value used to encode the LADD instruction. */
int LADD = 97;
/** The integer value used to encode the FADD instruction. */
int FADD = 98;
/** The integer value used to encode the DADD instruction. */
int DADD = 99;
/** The integer value used to encode the ISUB instruction. */
int ISUB = 100;
/** The integer value used to encode the LSUB instruction. */
int LSUB = 101;
/** The integer value used to encode the FSUB instruction. */
int FSUB = 102;
/** The integer value used to encode the DSUB instruction. */
int DSUB = 103;
/** The integer value used to encode the IMUL instruction. */
int IMUL = 104;
/** The integer value used to encode the LMUL instruction. */
int LMUL = 105;
/** The integer value used to encode the FMUL instruction. */
int FMUL = 106;
/** The integer value used to encode the DMUL instruction. */
int DMUL = 107;
/** The integer value used to encode the IDIV instruction. */
int IDIV = 108;
/** The integer value used to encode the LDIV instruction. */
int LDIV = 109;
/** The integer value used to encode the FDIV instruction. */
int FDIV = 110;
/** The integer value used to encode the DDIV instruction. */
int DDIV = 111;
/** The integer value used to encode the IREM instruction. */
int IREM = 112;
/** The integer value used to encode the LREM instruction. */
int LREM = 113;
/** The integer value used to encode the FREM instruction. */
int FREM = 114;
/** The integer value used to encode the DREM instruction. */
int DREM = 115;
/** The integer value used to encode the INEG instruction. */
int INEG = 116;
/** The integer value used to encode the LNEG instruction. */
int LNEG = 117;
/** The integer value used to encode the FNEG instruction. */
int FNEG = 118;
/** The integer value used to encode the DNEG instruction. */
int DNEG = 119;
/** The integer value used to encode the ISHL instruction. */
int ISHL = 120;
/** The integer value used to encode the LSHL instruction. */
int LSHL = 121;
/** The integer value used to encode the ISHR instruction. */
int ISHR = 122;
/** The integer value used to encode the LSHR instruction. */
int LSHR = 123;
/** The integer value used to encode the IUSHR instruction. */
int IUSHR = 124;
/** The integer value used to encode the LUSHR instruction. */
int LUSHR = 125;
/** The integer value used to encode the IAND instruction. */
int IAND = 126;
/** The integer value used to encode the LAND instruction. */
int LAND = 127;
/** The integer value used to encode the IOR instruction. */
int IOR = 128;
/** The integer value used to encode the LOR instruction. */
int LOR = 129;
/** The integer value used to encode the IXOR instruction. */
int IXOR = 130;
/** The integer value used to encode the LXOR instruction. */
int LXOR = 131;
/** The integer value used to encode the IINC instruction. */
int IINC = 132;
/** The integer value used to encode the I2L instruction. */
int I2L = 133;
/** The integer value used to encode the I2F instruction. */
int I2F = 134;
/** The integer value used to encode the I2D instruction. */
int I2D = 135;
/** The integer value used to encode the L2I instruction. */
int L2I = 136;
/** The integer value used to encode the L2F instruction. */
int L2F = 137;
/** The integer value used to encode the L2D instruction. */
int L2D = 138;
/** The integer value used to encode the F2I instruction. */
int F2I = 139;
/** The integer value used to encode the F2L instruction. */
int F2L = 140;
/** The integer value used to encode the F2D instruction. */
int F2D = 141;
/** The integer value used to encode the D2I instruction. */
int D2I = 142;
/** The integer value used to encode the D2L instruction. */
int D2L = 143;
/** The integer value used to encode the D2F instruction. */
int D2F = 144;
/** The integer value used to encode the I2B instruction. */
int I2B = 145;
/** The integer value used to encode the I2C instruction. */
int I2C = 146;
/** The integer value used to encode the I2S instruction. */
int I2S = 147;
/** The integer value used to encode the LCMP instruction. */
int LCMP = 148;
/** The integer value used to encode the FCMPL instruction. */
int FCMPL = 149;
/** The integer value used to encode the FCMPG instruction. */
int FCMPG = 150;
/** The integer value used to encode the DCMPL instruction. */
int DCMPL = 151;
/** The integer value used to encode the DCMPG instruction. */
int DCMPG = 152;
/** The integer value used to encode the IFEQ instruction. */
int IFEQ = 153;
/** The integer value used to encode the IFNE instruction. */
int IFNE = 154;
/** The integer value used to encode the IFLT instruction. */
int IFLT = 155;
/** The integer value used to encode the IFGE instruction. */
int IFGE = 156;
/** The integer value used to encode the IFGT instruction. */
int IFGT = 157;
/** The integer value used to encode the IFLE instruction. */
int IFLE = 158;
/** The integer value used to encode the IF_ICMPEQ instruction. */
int IF_ICMPEQ = 159;
/** The integer value used to encode the IF_ICMPNE instruction. */
int IF_ICMPNE = 160;
/** The integer value used to encode the IF_ICMPLT instruction. */
int IF_ICMPLT = 161;
/** The integer value used to encode the IF_ICMPGE instruction. */
int IF_ICMPGE = 162;
/** The integer value used to encode the IF_ICMPGT instruction. */
int IF_ICMPGT = 163;
/** The integer value used to encode the IF_ICMPLE instruction. */
int IF_ICMPLE = 164;
/** The integer value used to encode the IF_ACMPEQ instruction. */
int IF_ACMPEQ = 165;
/** The integer value used to encode the IF_ACMPNE instruction. */
int IF_ACMPNE = 166;
/** The integer value used to encode the GOTO instruction. */
int GOTO = 167;
/** The integer value used to encode the JSR instruction. */
int JSR = 168;
/** The integer value used to encode the RET instruction. */
int RET = 169;
/** The integer value used to encode the TABLESWITCH instruction. */
int TABLESWITCH = 170;
/** The integer value used to encode the LOOKUPSWITCH instruction. */
int LOOKUPSWITCH = 171;
/** The integer value used to encode the IRETURN instruction. */
int IRETURN = 172;
/** The integer value used to encode the LRETURN instruction. */
int LRETURN = 173;
/** The integer value used to encode the FRETURN instruction. */
int FRETURN = 174;
/** The integer value used to encode the DRETURN instruction. */
int DRETURN = 175;
/** The integer value used to encode the ARETURN instruction. */
int ARETURN = 176;
/** The integer value used to encode the RETURN instruction. */
int RETURN = 177;
/** The integer value used to encode the GETSTATIC instruction. */
int GETSTATIC = 178;
/** The integer value used to encode the PUTSTATIC instruction. */
int PUTSTATIC = 179;
/** The integer value used to encode the GETFIELD instruction. */
int GETFIELD = 180;
/** The integer value used to encode the PUTFIELD instruction. */
int PUTFIELD = 181;
/** The integer value used to encode the INVOKEVIRTUAL instruction. */
int INVOKEVIRTUAL = 182;
/** The integer value used to encode the INVOKESPECIAL instruction. */
int INVOKESPECIAL = 183;
/** The integer value used to encode the INVOKESTATIC instruction. */
int INVOKESTATIC = 184;
/** The integer value used to encode the INVOKEINTERFACE instruction. */
int INVOKEINTERFACE = 185;
/** The integer value used to encode the INVOKEDYNAMIC instruction. */
int INVOKEDYNAMIC = 186;
/** The integer value used to encode the NEW instruction. */
int NEW = 187;
/** The integer value used to encode the NEWARRAY instruction. */
int NEWARRAY = 188;
/** The integer value used to encode the ANEWARRAY instruction. */
int ANEWARRAY = 189;
/** The integer value used to encode the ARRAYLENGTH instruction. */
int ARRAYLENGTH = 190;
/** The integer value used to encode the ATHROW instruction. */
int ATHROW = 191;
/** The integer value used to encode the CHECKCAST instruction. */
int CHECKCAST = 192;
/** The integer value used to encode the INSTANCEOF instruction. */
int INSTANCEOF = 193;
/** The integer value used to encode the MONITORENTER instruction. */
int MONITORENTER = 194;
/** The integer value used to encode the MONITOREXIT instruction. */
int MONITOREXIT = 195;
/** The integer value used to encode the WIDE instruction. */
int WIDE = 196;
/** The integer value used to encode the MULTIANEWARRAY instruction. */
int MULTIANEWARRAY = 197;
/** The integer value used to encode the IFNULL instruction. */
int IFNULL = 198;
/** The integer value used to encode the IFNONNULL instruction. */
int IFNONNULL = 199;
/** The integer value used to encode the GOTO_W instruction. */
int GOTO_W = 200;
/** The integer value used to encode the JSR_W instruction. */
int JSR_W = 201;
/** The value of PUBLIC access and property modifier. */
/** The bit mask of PUBLIC access and property modifier. */
int ACC_PUBLIC = 0x0001;
/** The value of PROTECTED access and property modifier. */
/** The bit mask of PROTECTED access and property modifier. */
int ACC_PROTECTED = 0x0004;
/** The value of PRIVATE access and property modifier. */
/** The bit mask of PRIVATE access and property modifier. */
int ACC_PRIVATE = 0x0002;
/** The value of INTERFACE access and property modifier. */
/** The bit mask of INTERFACE access and property modifier. */
int ACC_INTERFACE = 0x0200;
/** The value of ENUM access and property modifier. */
/** The bit mask of ENUM access and property modifier. */
int ACC_ENUM = 0x4000;
/** The value of ANNOTATION access and property modifier. */
/** The bit mask of ANNOTATION access and property modifier. */
int ACC_ANNOTATION = 0x2000;
/** The value of SUPER access and property modifier. */
/** The bit mask of SUPER access and property modifier. */
int ACC_SUPER = 0x0020;
/** The value of ABSTRACT access and property modifier. */
/** The bit mask of ABSTRACT access and property modifier. */
int ACC_ABSTRACT = 0x0400;
/** The value of VOLATILE access and property modifier. */
/** The bit mask of VOLATILE access and property modifier. */
int ACC_VOLATILE = 0x0040;
/** The value of TRANSIENT access and property modifier. */
/** The bit mask of TRANSIENT access and property modifier. */
int ACC_TRANSIENT = 0x0080;
/** The value of SYNTHETIC access and property modifier. */
/** The bit mask of SYNTHETIC access and property modifier. */
int ACC_SYNTHETIC = 0x1000;
/** The value of STATIC access and property modifier. */
/** The bit mask of STATIC access and property modifier. */
int ACC_STATIC = 0x0008;
/** The value of FINAL access and property modifier. */
/** The bit mask of FINAL access and property modifier. */
int ACC_FINAL = 0x0010;
/** The value of SYNCHRONIZED access and property modifier. */
/** The bit mask of SYNCHRONIZED access and property modifier. */
int ACC_SYNCHRONIZED = 0x0020;
/** The value of BRIDGE access and property modifier. */
/** The bit mask of BRIDGE access and property modifier. */
int ACC_BRIDGE = 0x0040;
/** The value of VARARGS access and property modifier. */
/** The bit mask of VARARGS access and property modifier. */
int ACC_VARARGS = 0x0080;
/** The value of NATIVE access and property modifier. */
/** The bit mask of NATIVE access and property modifier. */
int ACC_NATIVE = 0x0100;
/** The value of STRICT access and property modifier. */
/** The bit mask of STRICT access and property modifier. */
int ACC_STRICT = 0x0800;
/** The value of MODULE access and property modifier. */
/** The bit mask of MODULE access and property modifier. */
int ACC_MODULE = 0x8000;
/** The value of OPEN access and property modifier. */
/** The bit mask of OPEN access and property modifier. */
int ACC_OPEN = 0x20;
/** The value of MANDATED access and property modifier. */
/** The bit mask of MANDATED access and property modifier. */
int ACC_MANDATED = 0x8000;
/** The value of TRANSITIVE access and property modifier. */
/** The bit mask of TRANSITIVE access and property modifier. */
int ACC_TRANSITIVE = 0x20;
/** The value of STATIC_PHASE access and property modifier. */
/** The bit mask of STATIC_PHASE access and property modifier. */
int ACC_STATIC_PHASE = 0x40;
/** The value of STATEMENT {@link CharacterRangeInfo} kind. */
int CRT_STATEMENT = 0x0001;
/** The value of BLOCK {@link CharacterRangeInfo} kind. */
int CRT_BLOCK = 0x0002;
/** The value of ASSIGNMENT {@link CharacterRangeInfo} kind. */
int CRT_ASSIGNMENT = 0x0004;
/** The value of FLOW_CONTROLLER {@link CharacterRangeInfo} kind. */
int CRT_FLOW_CONTROLLER = 0x0008;
/** The value of FLOW_TARGET {@link CharacterRangeInfo} kind. */
int CRT_FLOW_TARGET = 0x0010;
/** The value of INVOKE {@link CharacterRangeInfo} kind. */
int CRT_INVOKE = 0x0020;
/** The value of CREATE {@link CharacterRangeInfo} kind. */
int CRT_CREATE = 0x0040;
/** The value of BRANCH_TRUE {@link CharacterRangeInfo} kind. */
int CRT_BRANCH_TRUE = 0x0080;
/** The value of BRANCH_FALSE {@link CharacterRangeInfo} kind. */
int CRT_BRANCH_FALSE = 0x0100;
/** The value of constant pool tag CLASS. */
int TAG_CLASS = 7;
/** The value of constant pool tag CONSTANTDYNAMIC. */
int TAG_CONSTANTDYNAMIC = 17;
/** The value of constant pool tag DOUBLE. */
int TAG_DOUBLE = 6;
/** The value of constant pool tag FIELDREF. */
int TAG_FIELDREF = 9;
/** The value of constant pool tag FLOAT. */
int TAG_FLOAT = 4;
/** The value of constant pool tag INTEGER. */
int TAG_INTEGER = 3;
/** The value of constant pool tag INTERFACEMETHODREF. */
int TAG_INTERFACEMETHODREF = 11;
/** The value of constant pool tag INVOKEDYNAMIC. */
int TAG_INVOKEDYNAMIC = 18;
/** The value of constant pool tag LONG. */
int TAG_LONG = 5;
/** The value of constant pool tag METHODHANDLE. */
int TAG_METHODHANDLE = 15;
/** The value of constant pool tag METHODREF. */
int TAG_METHODREF = 10;
/** The value of constant pool tag METHODTYPE. */
int TAG_METHODTYPE = 16;
/** The value of constant pool tag MODULE. */
int TAG_MODULE = 19;
/** The value of constant pool tag NAMEANDTYPE. */
int TAG_NAMEANDTYPE = 12;
/** The value of constant pool tag PACKAGE. */
int TAG_PACKAGE = 20;
/** The value of constant pool tag STRING. */
int TAG_STRING = 8;
/** The value of constant pool tag UNICODE. */
int TAG_UNICODE = 2;
/** The value of constant pool tag UTF8. */
int TAG_UTF8 = 1;
// annotation element values
/** The value of annotation element value type AEV_BYTE. */
int AEV_BYTE = 'B';
/** The value of annotation element value type AEV_CHAR. */
int AEV_CHAR = 'C';
/** The value of annotation element value type AEV_DOUBLE. */
int AEV_DOUBLE = 'D';
/** The value of annotation element value type AEV_FLOAT. */
int AEV_FLOAT = 'F';
/** The value of annotation element value type AEV_INT. */
int AEV_INT = 'I';
/** The value of annotation element value type AEV_LONG. */
int AEV_LONG = 'J';
/** The value of annotation element value type AEV_SHORT. */
int AEV_SHORT = 'S';
/** The value of annotation element value type AEV_BOOLEAN. */
int AEV_BOOLEAN = 'Z';
/** The value of annotation element value type AEV_STRING. */
int AEV_STRING = 's';
/** The value of annotation element value type AEV_ENUM. */
int AEV_ENUM = 'e';
/** The value of annotation element value type AEV_CLASS. */
int AEV_CLASS = 'c';
/** The value of annotation element value type AEV_ANNOTATION. */
int AEV_ANNOTATION = '@';
/** The value of annotation element value type AEV_ARRAY. */
int AEV_ARRAY = '[';
//type annotations
/** The value of type annotation target type CLASS_TYPE_PARAMETER. */
int TAT_CLASS_TYPE_PARAMETER = 0x00;
/** The value of type annotation target type METHOD_TYPE_PARAMETER. */
int TAT_METHOD_TYPE_PARAMETER = 0x01;
/** The value of type annotation target type CLASS_EXTENDS. */
int TAT_CLASS_EXTENDS = 0x10;
/** The value of type annotation target type CLASS_TYPE_PARAMETER_BOUND. */
int TAT_CLASS_TYPE_PARAMETER_BOUND = 0x11;
/** The value of type annotation target type METHOD_TYPE_PARAMETER_BOUND. */
int TAT_METHOD_TYPE_PARAMETER_BOUND = 0x12;
/** The value of type annotation target type FIELD. */
int TAT_FIELD = 0x13;
/** The value of type annotation target type METHOD_RETURN. */
int TAT_METHOD_RETURN = 0x14;
/** The value of type annotation target type METHOD_RECEIVER. */
int TAT_METHOD_RECEIVER = 0x15;
/** The value of type annotation target type METHOD_FORMAL_PARAMETER. */
int TAT_METHOD_FORMAL_PARAMETER = 0x16;
/** The value of type annotation target type THROWS. */
int TAT_THROWS = 0x17;
/** The value of type annotation target type LOCAL_VARIABLE. */
int TAT_LOCAL_VARIABLE = 0x40;
/** The value of type annotation target type RESOURCE_VARIABLE. */
int TAT_RESOURCE_VARIABLE = 0x41;
/** The value of type annotation target type EXCEPTION_PARAMETER. */
int TAT_EXCEPTION_PARAMETER = 0x42;
/** The value of type annotation target type INSTANCEOF. */
int TAT_INSTANCEOF = 0x43;
/** The value of type annotation target type NEW. */
int TAT_NEW = 0x44;
/** The value of type annotation target type CONSTRUCTOR_REFERENCE. */
int TAT_CONSTRUCTOR_REFERENCE = 0x45;
/** The value of type annotation target type METHOD_REFERENCE. */
int TAT_METHOD_REFERENCE = 0x46;
/** The value of type annotation target type CAST. */
int TAT_CAST = 0x47;
/** The value of type annotation target type CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT. */
int TAT_CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT = 0x48;
/** The value of type annotation target type METHOD_INVOCATION_TYPE_ARGUMENT. */
int TAT_METHOD_INVOCATION_TYPE_ARGUMENT = 0x49;
/** The value of type annotation target type CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT. */
int TAT_CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT = 0x4A;
/** The value of type annotation target type METHOD_REFERENCE_TYPE_ARGUMENT. */
int TAT_METHOD_REFERENCE_TYPE_ARGUMENT = 0x4B;
//stackmap verification types
/** The value of verification type TOP. */
int VT_TOP = 0;
/** The value of verification type INTEGER. */
int VT_INTEGER = 1;
/** The value of verification type FLOAT. */
int VT_FLOAT = 2;
/** The value of verification type DOUBLE. */
int VT_DOUBLE = 3;
/** The value of verification type LONG. */
int VT_LONG = 4;
/** The value of verification type NULL. */
int VT_NULL = 5;
/** The value of verification type UNINITIALIZED_THIS. */
int VT_UNINITIALIZED_THIS = 6;
/** The value of verification type OBJECT. */
int VT_OBJECT = 7;
/** The value of verification type UNINITIALIZED. */
int VT_UNINITIALIZED = 8;
/** The value of default class access flags */
int DEFAULT_CLASS_FLAGS = ACC_PUBLIC;
/** The class major version of JAVA_1. */
int JAVA_1_VERSION = 45;

View File

@ -24,6 +24,7 @@
*/
package java.lang.classfile;
import jdk.internal.classfile.impl.RawBytecodeHelper;
import jdk.internal.javac.PreviewFeature;
/**
@ -40,658 +41,658 @@ import jdk.internal.javac.PreviewFeature;
public enum Opcode {
/** Do nothing */
NOP(ClassFile.NOP, 1, Kind.NOP),
NOP(RawBytecodeHelper.NOP, 1, Kind.NOP),
/** Push null */
ACONST_NULL(ClassFile.ACONST_NULL, 1, Kind.CONSTANT),
ACONST_NULL(RawBytecodeHelper.ACONST_NULL, 1, Kind.CONSTANT),
/** Push int constant -1 */
ICONST_M1(ClassFile.ICONST_M1, 1, Kind.CONSTANT),
ICONST_M1(RawBytecodeHelper.ICONST_M1, 1, Kind.CONSTANT),
/** Push int constant 0 */
ICONST_0(ClassFile.ICONST_0, 1, Kind.CONSTANT),
ICONST_0(RawBytecodeHelper.ICONST_0, 1, Kind.CONSTANT),
/** Push int constant 1 */
ICONST_1(ClassFile.ICONST_1, 1, Kind.CONSTANT),
ICONST_1(RawBytecodeHelper.ICONST_1, 1, Kind.CONSTANT),
/** Push int constant 2 */
ICONST_2(ClassFile.ICONST_2, 1, Kind.CONSTANT),
ICONST_2(RawBytecodeHelper.ICONST_2, 1, Kind.CONSTANT),
/** Push int constant 3 */
ICONST_3(ClassFile.ICONST_3, 1, Kind.CONSTANT),
ICONST_3(RawBytecodeHelper.ICONST_3, 1, Kind.CONSTANT),
/** Push int constant 4 */
ICONST_4(ClassFile.ICONST_4, 1, Kind.CONSTANT),
ICONST_4(RawBytecodeHelper.ICONST_4, 1, Kind.CONSTANT),
/** Push int constant 5 */
ICONST_5(ClassFile.ICONST_5, 1, Kind.CONSTANT),
ICONST_5(RawBytecodeHelper.ICONST_5, 1, Kind.CONSTANT),
/** Push long constant 0 */
LCONST_0(ClassFile.LCONST_0, 1, Kind.CONSTANT),
LCONST_0(RawBytecodeHelper.LCONST_0, 1, Kind.CONSTANT),
/** Push long constant 1 */
LCONST_1(ClassFile.LCONST_1, 1, Kind.CONSTANT),
LCONST_1(RawBytecodeHelper.LCONST_1, 1, Kind.CONSTANT),
/** Push float constant 0 */
FCONST_0(ClassFile.FCONST_0, 1, Kind.CONSTANT),
FCONST_0(RawBytecodeHelper.FCONST_0, 1, Kind.CONSTANT),
/** Push float constant 1 */
FCONST_1(ClassFile.FCONST_1, 1, Kind.CONSTANT),
FCONST_1(RawBytecodeHelper.FCONST_1, 1, Kind.CONSTANT),
/** Push float constant 2 */
FCONST_2(ClassFile.FCONST_2, 1, Kind.CONSTANT),
FCONST_2(RawBytecodeHelper.FCONST_2, 1, Kind.CONSTANT),
/** Push double constant 0 */
DCONST_0(ClassFile.DCONST_0, 1, Kind.CONSTANT),
DCONST_0(RawBytecodeHelper.DCONST_0, 1, Kind.CONSTANT),
/** Push double constant 1 */
DCONST_1(ClassFile.DCONST_1, 1, Kind.CONSTANT),
DCONST_1(RawBytecodeHelper.DCONST_1, 1, Kind.CONSTANT),
/** Push byte */
BIPUSH(ClassFile.BIPUSH, 2, Kind.CONSTANT),
BIPUSH(RawBytecodeHelper.BIPUSH, 2, Kind.CONSTANT),
/** Push short */
SIPUSH(ClassFile.SIPUSH, 3, Kind.CONSTANT),
SIPUSH(RawBytecodeHelper.SIPUSH, 3, Kind.CONSTANT),
/** Push item from run-time constant pool */
LDC(ClassFile.LDC, 2, Kind.CONSTANT),
LDC(RawBytecodeHelper.LDC, 2, Kind.CONSTANT),
/** Push item from run-time constant pool (wide index) */
LDC_W(ClassFile.LDC_W, 3, Kind.CONSTANT),
LDC_W(RawBytecodeHelper.LDC_W, 3, Kind.CONSTANT),
/** Push long or double from run-time constant pool (wide index) */
LDC2_W(ClassFile.LDC2_W, 3, Kind.CONSTANT),
LDC2_W(RawBytecodeHelper.LDC2_W, 3, Kind.CONSTANT),
/** Load int from local variable */
ILOAD(ClassFile.ILOAD, 2, Kind.LOAD),
ILOAD(RawBytecodeHelper.ILOAD, 2, Kind.LOAD),
/** Load long from local variable */
LLOAD(ClassFile.LLOAD, 2, Kind.LOAD),
LLOAD(RawBytecodeHelper.LLOAD, 2, Kind.LOAD),
/** Load float from local variable */
FLOAD(ClassFile.FLOAD, 2, Kind.LOAD),
FLOAD(RawBytecodeHelper.FLOAD, 2, Kind.LOAD),
/** Load double from local variable */
DLOAD(ClassFile.DLOAD, 2, Kind.LOAD),
DLOAD(RawBytecodeHelper.DLOAD, 2, Kind.LOAD),
/** Load reference from local variable */
ALOAD(ClassFile.ALOAD, 2, Kind.LOAD),
ALOAD(RawBytecodeHelper.ALOAD, 2, Kind.LOAD),
/** Load int from local variable 0 */
ILOAD_0(ClassFile.ILOAD_0, 1, Kind.LOAD),
ILOAD_0(RawBytecodeHelper.ILOAD_0, 1, Kind.LOAD),
/** Load int from local variable 1 */
ILOAD_1(ClassFile.ILOAD_1, 1, Kind.LOAD),
ILOAD_1(RawBytecodeHelper.ILOAD_1, 1, Kind.LOAD),
/** Load int from local variable 2 */
ILOAD_2(ClassFile.ILOAD_2, 1, Kind.LOAD),
ILOAD_2(RawBytecodeHelper.ILOAD_2, 1, Kind.LOAD),
/** Load int from local variable3 */
ILOAD_3(ClassFile.ILOAD_3, 1, Kind.LOAD),
ILOAD_3(RawBytecodeHelper.ILOAD_3, 1, Kind.LOAD),
/** Load long from local variable 0 */
LLOAD_0(ClassFile.LLOAD_0, 1, Kind.LOAD),
LLOAD_0(RawBytecodeHelper.LLOAD_0, 1, Kind.LOAD),
/** Load long from local variable 1 */
LLOAD_1(ClassFile.LLOAD_1, 1, Kind.LOAD),
LLOAD_1(RawBytecodeHelper.LLOAD_1, 1, Kind.LOAD),
/** Load long from local variable 2 */
LLOAD_2(ClassFile.LLOAD_2, 1, Kind.LOAD),
LLOAD_2(RawBytecodeHelper.LLOAD_2, 1, Kind.LOAD),
/** Load long from local variable 3 */
LLOAD_3(ClassFile.LLOAD_3, 1, Kind.LOAD),
LLOAD_3(RawBytecodeHelper.LLOAD_3, 1, Kind.LOAD),
/** Load float from local variable 0 */
FLOAD_0(ClassFile.FLOAD_0, 1, Kind.LOAD),
FLOAD_0(RawBytecodeHelper.FLOAD_0, 1, Kind.LOAD),
/** Load float from local variable 1 */
FLOAD_1(ClassFile.FLOAD_1, 1, Kind.LOAD),
FLOAD_1(RawBytecodeHelper.FLOAD_1, 1, Kind.LOAD),
/** Load float from local variable 2 */
FLOAD_2(ClassFile.FLOAD_2, 1, Kind.LOAD),
FLOAD_2(RawBytecodeHelper.FLOAD_2, 1, Kind.LOAD),
/** Load float from local variable 3 */
FLOAD_3(ClassFile.FLOAD_3, 1, Kind.LOAD),
FLOAD_3(RawBytecodeHelper.FLOAD_3, 1, Kind.LOAD),
/** Load double from local variable 0 */
DLOAD_0(ClassFile.DLOAD_0, 1, Kind.LOAD),
DLOAD_0(RawBytecodeHelper.DLOAD_0, 1, Kind.LOAD),
/** Load double from local variable 1 */
DLOAD_1(ClassFile.DLOAD_1, 1, Kind.LOAD),
DLOAD_1(RawBytecodeHelper.DLOAD_1, 1, Kind.LOAD),
/** Load double from local variable 2 */
DLOAD_2(ClassFile.DLOAD_2, 1, Kind.LOAD),
DLOAD_2(RawBytecodeHelper.DLOAD_2, 1, Kind.LOAD),
/** Load double from local variable 3 */
DLOAD_3(ClassFile.DLOAD_3, 1, Kind.LOAD),
DLOAD_3(RawBytecodeHelper.DLOAD_3, 1, Kind.LOAD),
/** Load reference from local variable 0 */
ALOAD_0(ClassFile.ALOAD_0, 1, Kind.LOAD),
ALOAD_0(RawBytecodeHelper.ALOAD_0, 1, Kind.LOAD),
/** Load reference from local variable 1 */
ALOAD_1(ClassFile.ALOAD_1, 1, Kind.LOAD),
ALOAD_1(RawBytecodeHelper.ALOAD_1, 1, Kind.LOAD),
/** Load reference from local variable 2 */
ALOAD_2(ClassFile.ALOAD_2, 1, Kind.LOAD),
ALOAD_2(RawBytecodeHelper.ALOAD_2, 1, Kind.LOAD),
/** Load reference from local variable 3 */
ALOAD_3(ClassFile.ALOAD_3, 1, Kind.LOAD),
ALOAD_3(RawBytecodeHelper.ALOAD_3, 1, Kind.LOAD),
/** Load int from array */
IALOAD(ClassFile.IALOAD, 1, Kind.ARRAY_LOAD),
IALOAD(RawBytecodeHelper.IALOAD, 1, Kind.ARRAY_LOAD),
/** Load long from array */
LALOAD(ClassFile.LALOAD, 1, Kind.ARRAY_LOAD),
LALOAD(RawBytecodeHelper.LALOAD, 1, Kind.ARRAY_LOAD),
/** Load float from array */
FALOAD(ClassFile.FALOAD, 1, Kind.ARRAY_LOAD),
FALOAD(RawBytecodeHelper.FALOAD, 1, Kind.ARRAY_LOAD),
/** Load double from array */
DALOAD(ClassFile.DALOAD, 1, Kind.ARRAY_LOAD),
DALOAD(RawBytecodeHelper.DALOAD, 1, Kind.ARRAY_LOAD),
/** Load reference from array */
AALOAD(ClassFile.AALOAD, 1, Kind.ARRAY_LOAD),
AALOAD(RawBytecodeHelper.AALOAD, 1, Kind.ARRAY_LOAD),
/** Load byte from array */
BALOAD(ClassFile.BALOAD, 1, Kind.ARRAY_LOAD),
BALOAD(RawBytecodeHelper.BALOAD, 1, Kind.ARRAY_LOAD),
/** Load char from array */
CALOAD(ClassFile.CALOAD, 1, Kind.ARRAY_LOAD),
CALOAD(RawBytecodeHelper.CALOAD, 1, Kind.ARRAY_LOAD),
/** Load short from array */
SALOAD(ClassFile.SALOAD, 1, Kind.ARRAY_LOAD),
SALOAD(RawBytecodeHelper.SALOAD, 1, Kind.ARRAY_LOAD),
/** Store int into local variable */
ISTORE(ClassFile.ISTORE, 2, Kind.STORE),
ISTORE(RawBytecodeHelper.ISTORE, 2, Kind.STORE),
/** Store long into local variable */
LSTORE(ClassFile.LSTORE, 2, Kind.STORE),
LSTORE(RawBytecodeHelper.LSTORE, 2, Kind.STORE),
/** Store float into local variable */
FSTORE(ClassFile.FSTORE, 2, Kind.STORE),
FSTORE(RawBytecodeHelper.FSTORE, 2, Kind.STORE),
/** Store double into local variable */
DSTORE(ClassFile.DSTORE, 2, Kind.STORE),
DSTORE(RawBytecodeHelper.DSTORE, 2, Kind.STORE),
/** Store reference into local variable */
ASTORE(ClassFile.ASTORE, 2, Kind.STORE),
ASTORE(RawBytecodeHelper.ASTORE, 2, Kind.STORE),
/** Store int into local variable 0 */
ISTORE_0(ClassFile.ISTORE_0, 1, Kind.STORE),
ISTORE_0(RawBytecodeHelper.ISTORE_0, 1, Kind.STORE),
/** Store int into local variable 1 */
ISTORE_1(ClassFile.ISTORE_1, 1, Kind.STORE),
ISTORE_1(RawBytecodeHelper.ISTORE_1, 1, Kind.STORE),
/** Store int into local variable 2 */
ISTORE_2(ClassFile.ISTORE_2, 1, Kind.STORE),
ISTORE_2(RawBytecodeHelper.ISTORE_2, 1, Kind.STORE),
/** Store int into local variable 3 */
ISTORE_3(ClassFile.ISTORE_3, 1, Kind.STORE),
ISTORE_3(RawBytecodeHelper.ISTORE_3, 1, Kind.STORE),
/** Store long into local variable 0 */
LSTORE_0(ClassFile.LSTORE_0, 1, Kind.STORE),
LSTORE_0(RawBytecodeHelper.LSTORE_0, 1, Kind.STORE),
/** Store long into local variable 1 */
LSTORE_1(ClassFile.LSTORE_1, 1, Kind.STORE),
LSTORE_1(RawBytecodeHelper.LSTORE_1, 1, Kind.STORE),
/** Store long into local variable 2 */
LSTORE_2(ClassFile.LSTORE_2, 1, Kind.STORE),
LSTORE_2(RawBytecodeHelper.LSTORE_2, 1, Kind.STORE),
/** Store long into local variable 3 */
LSTORE_3(ClassFile.LSTORE_3, 1, Kind.STORE),
LSTORE_3(RawBytecodeHelper.LSTORE_3, 1, Kind.STORE),
/** Store float into local variable 0 */
FSTORE_0(ClassFile.FSTORE_0, 1, Kind.STORE),
FSTORE_0(RawBytecodeHelper.FSTORE_0, 1, Kind.STORE),
/** Store float into local variable 1 */
FSTORE_1(ClassFile.FSTORE_1, 1, Kind.STORE),
FSTORE_1(RawBytecodeHelper.FSTORE_1, 1, Kind.STORE),
/** Store float into local variable 2 */
FSTORE_2(ClassFile.FSTORE_2, 1, Kind.STORE),
FSTORE_2(RawBytecodeHelper.FSTORE_2, 1, Kind.STORE),
/** Store float into local variable 3 */
FSTORE_3(ClassFile.FSTORE_3, 1, Kind.STORE),
FSTORE_3(RawBytecodeHelper.FSTORE_3, 1, Kind.STORE),
/** Store double into local variable 0 */
DSTORE_0(ClassFile.DSTORE_0, 1, Kind.STORE),
DSTORE_0(RawBytecodeHelper.DSTORE_0, 1, Kind.STORE),
/** Store double into local variable 1 */
DSTORE_1(ClassFile.DSTORE_1, 1, Kind.STORE),
DSTORE_1(RawBytecodeHelper.DSTORE_1, 1, Kind.STORE),
/** Store double into local variable 2 */
DSTORE_2(ClassFile.DSTORE_2, 1, Kind.STORE),
DSTORE_2(RawBytecodeHelper.DSTORE_2, 1, Kind.STORE),
/** Store double into local variable 3 */
DSTORE_3(ClassFile.DSTORE_3, 1, Kind.STORE),
DSTORE_3(RawBytecodeHelper.DSTORE_3, 1, Kind.STORE),
/** Store reference into local variable 0 */
ASTORE_0(ClassFile.ASTORE_0, 1, Kind.STORE),
ASTORE_0(RawBytecodeHelper.ASTORE_0, 1, Kind.STORE),
/** Store reference into local variable 1 */
ASTORE_1(ClassFile.ASTORE_1, 1, Kind.STORE),
ASTORE_1(RawBytecodeHelper.ASTORE_1, 1, Kind.STORE),
/** Store reference into local variable 2 */
ASTORE_2(ClassFile.ASTORE_2, 1, Kind.STORE),
ASTORE_2(RawBytecodeHelper.ASTORE_2, 1, Kind.STORE),
/** Store reference into local variable 3 */
ASTORE_3(ClassFile.ASTORE_3, 1, Kind.STORE),
ASTORE_3(RawBytecodeHelper.ASTORE_3, 1, Kind.STORE),
/** Store into int array */
IASTORE(ClassFile.IASTORE, 1, Kind.ARRAY_STORE),
IASTORE(RawBytecodeHelper.IASTORE, 1, Kind.ARRAY_STORE),
/** Store into long array */
LASTORE(ClassFile.LASTORE, 1, Kind.ARRAY_STORE),
LASTORE(RawBytecodeHelper.LASTORE, 1, Kind.ARRAY_STORE),
/** Store into float array */
FASTORE(ClassFile.FASTORE, 1, Kind.ARRAY_STORE),
FASTORE(RawBytecodeHelper.FASTORE, 1, Kind.ARRAY_STORE),
/** Store into double array */
DASTORE(ClassFile.DASTORE, 1, Kind.ARRAY_STORE),
DASTORE(RawBytecodeHelper.DASTORE, 1, Kind.ARRAY_STORE),
/** Store into reference array */
AASTORE(ClassFile.AASTORE, 1, Kind.ARRAY_STORE),
AASTORE(RawBytecodeHelper.AASTORE, 1, Kind.ARRAY_STORE),
/** Store into byte array */
BASTORE(ClassFile.BASTORE, 1, Kind.ARRAY_STORE),
BASTORE(RawBytecodeHelper.BASTORE, 1, Kind.ARRAY_STORE),
/** Store into char array */
CASTORE(ClassFile.CASTORE, 1, Kind.ARRAY_STORE),
CASTORE(RawBytecodeHelper.CASTORE, 1, Kind.ARRAY_STORE),
/** Store into short array */
SASTORE(ClassFile.SASTORE, 1, Kind.ARRAY_STORE),
SASTORE(RawBytecodeHelper.SASTORE, 1, Kind.ARRAY_STORE),
/** Pop the top operand stack value */
POP(ClassFile.POP, 1, Kind.STACK),
POP(RawBytecodeHelper.POP, 1, Kind.STACK),
/** Pop the top one or two operand stack values */
POP2(ClassFile.POP2, 1, Kind.STACK),
POP2(RawBytecodeHelper.POP2, 1, Kind.STACK),
/** Duplicate the top operand stack value */
DUP(ClassFile.DUP, 1, Kind.STACK),
DUP(RawBytecodeHelper.DUP, 1, Kind.STACK),
/** Duplicate the top operand stack value and insert two values down */
DUP_X1(ClassFile.DUP_X1, 1, Kind.STACK),
DUP_X1(RawBytecodeHelper.DUP_X1, 1, Kind.STACK),
/** Duplicate the top operand stack value and insert two or three values down */
DUP_X2(ClassFile.DUP_X2, 1, Kind.STACK),
DUP_X2(RawBytecodeHelper.DUP_X2, 1, Kind.STACK),
/** Duplicate the top one or two operand stack values */
DUP2(ClassFile.DUP2, 1, Kind.STACK),
DUP2(RawBytecodeHelper.DUP2, 1, Kind.STACK),
/** Duplicate the top one or two operand stack values and insert two or three values down */
DUP2_X1(ClassFile.DUP2_X1, 1, Kind.STACK),
DUP2_X1(RawBytecodeHelper.DUP2_X1, 1, Kind.STACK),
/** Duplicate the top one or two operand stack values and insert two, three, or four values down */
DUP2_X2(ClassFile.DUP2_X2, 1, Kind.STACK),
DUP2_X2(RawBytecodeHelper.DUP2_X2, 1, Kind.STACK),
/** Swap the top two operand stack values */
SWAP(ClassFile.SWAP, 1, Kind.STACK),
SWAP(RawBytecodeHelper.SWAP, 1, Kind.STACK),
/** Add int */
IADD(ClassFile.IADD, 1, Kind.OPERATOR),
IADD(RawBytecodeHelper.IADD, 1, Kind.OPERATOR),
/** Add long */
LADD(ClassFile.LADD, 1, Kind.OPERATOR),
LADD(RawBytecodeHelper.LADD, 1, Kind.OPERATOR),
/** Add float */
FADD(ClassFile.FADD, 1, Kind.OPERATOR),
FADD(RawBytecodeHelper.FADD, 1, Kind.OPERATOR),
/** Add double */
DADD(ClassFile.DADD, 1, Kind.OPERATOR),
DADD(RawBytecodeHelper.DADD, 1, Kind.OPERATOR),
/** Subtract int */
ISUB(ClassFile.ISUB, 1, Kind.OPERATOR),
ISUB(RawBytecodeHelper.ISUB, 1, Kind.OPERATOR),
/** Subtract long */
LSUB(ClassFile.LSUB, 1, Kind.OPERATOR),
LSUB(RawBytecodeHelper.LSUB, 1, Kind.OPERATOR),
/** Subtract float */
FSUB(ClassFile.FSUB, 1, Kind.OPERATOR),
FSUB(RawBytecodeHelper.FSUB, 1, Kind.OPERATOR),
/** Subtract double */
DSUB(ClassFile.DSUB, 1, Kind.OPERATOR),
DSUB(RawBytecodeHelper.DSUB, 1, Kind.OPERATOR),
/** Multiply int */
IMUL(ClassFile.IMUL, 1, Kind.OPERATOR),
IMUL(RawBytecodeHelper.IMUL, 1, Kind.OPERATOR),
/** Multiply long */
LMUL(ClassFile.LMUL, 1, Kind.OPERATOR),
LMUL(RawBytecodeHelper.LMUL, 1, Kind.OPERATOR),
/** Multiply float */
FMUL(ClassFile.FMUL, 1, Kind.OPERATOR),
FMUL(RawBytecodeHelper.FMUL, 1, Kind.OPERATOR),
/** Multiply double */
DMUL(ClassFile.DMUL, 1, Kind.OPERATOR),
DMUL(RawBytecodeHelper.DMUL, 1, Kind.OPERATOR),
/** Divide int */
IDIV(ClassFile.IDIV, 1, Kind.OPERATOR),
IDIV(RawBytecodeHelper.IDIV, 1, Kind.OPERATOR),
/** Divide long */
LDIV(ClassFile.LDIV, 1, Kind.OPERATOR),
LDIV(RawBytecodeHelper.LDIV, 1, Kind.OPERATOR),
/** Divide float */
FDIV(ClassFile.FDIV, 1, Kind.OPERATOR),
FDIV(RawBytecodeHelper.FDIV, 1, Kind.OPERATOR),
/** Divide double */
DDIV(ClassFile.DDIV, 1, Kind.OPERATOR),
DDIV(RawBytecodeHelper.DDIV, 1, Kind.OPERATOR),
/** Remainder int */
IREM(ClassFile.IREM, 1, Kind.OPERATOR),
IREM(RawBytecodeHelper.IREM, 1, Kind.OPERATOR),
/** Remainder long */
LREM(ClassFile.LREM, 1, Kind.OPERATOR),
LREM(RawBytecodeHelper.LREM, 1, Kind.OPERATOR),
/** Remainder float */
FREM(ClassFile.FREM, 1, Kind.OPERATOR),
FREM(RawBytecodeHelper.FREM, 1, Kind.OPERATOR),
/** Remainder double */
DREM(ClassFile.DREM, 1, Kind.OPERATOR),
DREM(RawBytecodeHelper.DREM, 1, Kind.OPERATOR),
/** Negate int */
INEG(ClassFile.INEG, 1, Kind.OPERATOR),
INEG(RawBytecodeHelper.INEG, 1, Kind.OPERATOR),
/** Negate long */
LNEG(ClassFile.LNEG, 1, Kind.OPERATOR),
LNEG(RawBytecodeHelper.LNEG, 1, Kind.OPERATOR),
/** Negate float */
FNEG(ClassFile.FNEG, 1, Kind.OPERATOR),
FNEG(RawBytecodeHelper.FNEG, 1, Kind.OPERATOR),
/** Negate double */
DNEG(ClassFile.DNEG, 1, Kind.OPERATOR),
DNEG(RawBytecodeHelper.DNEG, 1, Kind.OPERATOR),
/** Shift left int */
ISHL(ClassFile.ISHL, 1, Kind.OPERATOR),
ISHL(RawBytecodeHelper.ISHL, 1, Kind.OPERATOR),
/** Shift left long */
LSHL(ClassFile.LSHL, 1, Kind.OPERATOR),
LSHL(RawBytecodeHelper.LSHL, 1, Kind.OPERATOR),
/** Shift right int */
ISHR(ClassFile.ISHR, 1, Kind.OPERATOR),
ISHR(RawBytecodeHelper.ISHR, 1, Kind.OPERATOR),
/** Shift right long */
LSHR(ClassFile.LSHR, 1, Kind.OPERATOR),
LSHR(RawBytecodeHelper.LSHR, 1, Kind.OPERATOR),
/** Logical shift right int */
IUSHR(ClassFile.IUSHR, 1, Kind.OPERATOR),
IUSHR(RawBytecodeHelper.IUSHR, 1, Kind.OPERATOR),
/** Logical shift right long */
LUSHR(ClassFile.LUSHR, 1, Kind.OPERATOR),
LUSHR(RawBytecodeHelper.LUSHR, 1, Kind.OPERATOR),
/** Boolean AND int */
IAND(ClassFile.IAND, 1, Kind.OPERATOR),
IAND(RawBytecodeHelper.IAND, 1, Kind.OPERATOR),
/** Boolean AND long */
LAND(ClassFile.LAND, 1, Kind.OPERATOR),
LAND(RawBytecodeHelper.LAND, 1, Kind.OPERATOR),
/** Boolean OR int */
IOR(ClassFile.IOR, 1, Kind.OPERATOR),
IOR(RawBytecodeHelper.IOR, 1, Kind.OPERATOR),
/** Boolean OR long */
LOR(ClassFile.LOR, 1, Kind.OPERATOR),
LOR(RawBytecodeHelper.LOR, 1, Kind.OPERATOR),
/** Boolean XOR int */
IXOR(ClassFile.IXOR, 1, Kind.OPERATOR),
IXOR(RawBytecodeHelper.IXOR, 1, Kind.OPERATOR),
/** Boolean XOR long */
LXOR(ClassFile.LXOR, 1, Kind.OPERATOR),
LXOR(RawBytecodeHelper.LXOR, 1, Kind.OPERATOR),
/** Increment local variable by constant */
IINC(ClassFile.IINC, 3, Kind.INCREMENT),
IINC(RawBytecodeHelper.IINC, 3, Kind.INCREMENT),
/** Convert int to long */
I2L(ClassFile.I2L, 1, Kind.CONVERT),
I2L(RawBytecodeHelper.I2L, 1, Kind.CONVERT),
/** Convert int to float */
I2F(ClassFile.I2F, 1, Kind.CONVERT),
I2F(RawBytecodeHelper.I2F, 1, Kind.CONVERT),
/** Convert int to double */
I2D(ClassFile.I2D, 1, Kind.CONVERT),
I2D(RawBytecodeHelper.I2D, 1, Kind.CONVERT),
/** Convert long to int */
L2I(ClassFile.L2I, 1, Kind.CONVERT),
L2I(RawBytecodeHelper.L2I, 1, Kind.CONVERT),
/** Convert long to float */
L2F(ClassFile.L2F, 1, Kind.CONVERT),
L2F(RawBytecodeHelper.L2F, 1, Kind.CONVERT),
/** Convert long to double */
L2D(ClassFile.L2D, 1, Kind.CONVERT),
L2D(RawBytecodeHelper.L2D, 1, Kind.CONVERT),
/** Convert float to int */
F2I(ClassFile.F2I, 1, Kind.CONVERT),
F2I(RawBytecodeHelper.F2I, 1, Kind.CONVERT),
/** Convert float to long */
F2L(ClassFile.F2L, 1, Kind.CONVERT),
F2L(RawBytecodeHelper.F2L, 1, Kind.CONVERT),
/** Convert float to double */
F2D(ClassFile.F2D, 1, Kind.CONVERT),
F2D(RawBytecodeHelper.F2D, 1, Kind.CONVERT),
/** Convert double to int */
D2I(ClassFile.D2I, 1, Kind.CONVERT),
D2I(RawBytecodeHelper.D2I, 1, Kind.CONVERT),
/** Convert double to long */
D2L(ClassFile.D2L, 1, Kind.CONVERT),
D2L(RawBytecodeHelper.D2L, 1, Kind.CONVERT),
/** Convert double to float */
D2F(ClassFile.D2F, 1, Kind.CONVERT),
D2F(RawBytecodeHelper.D2F, 1, Kind.CONVERT),
/** Convert int to byte */
I2B(ClassFile.I2B, 1, Kind.CONVERT),
I2B(RawBytecodeHelper.I2B, 1, Kind.CONVERT),
/** Convert int to char */
I2C(ClassFile.I2C, 1, Kind.CONVERT),
I2C(RawBytecodeHelper.I2C, 1, Kind.CONVERT),
/** Convert int to short */
I2S(ClassFile.I2S, 1, Kind.CONVERT),
I2S(RawBytecodeHelper.I2S, 1, Kind.CONVERT),
/** Compare long */
LCMP(ClassFile.LCMP, 1, Kind.OPERATOR),
LCMP(RawBytecodeHelper.LCMP, 1, Kind.OPERATOR),
/** Compare float */
FCMPL(ClassFile.FCMPL, 1, Kind.OPERATOR),
FCMPL(RawBytecodeHelper.FCMPL, 1, Kind.OPERATOR),
/** Compare float */
FCMPG(ClassFile.FCMPG, 1, Kind.OPERATOR),
FCMPG(RawBytecodeHelper.FCMPG, 1, Kind.OPERATOR),
/** Compare double */
DCMPL(ClassFile.DCMPL, 1, Kind.OPERATOR),
DCMPL(RawBytecodeHelper.DCMPL, 1, Kind.OPERATOR),
/** Compare double */
DCMPG(ClassFile.DCMPG, 1, Kind.OPERATOR),
DCMPG(RawBytecodeHelper.DCMPG, 1, Kind.OPERATOR),
/** Branch if int comparison with zero succeeds */
IFEQ(ClassFile.IFEQ, 3, Kind.BRANCH),
IFEQ(RawBytecodeHelper.IFEQ, 3, Kind.BRANCH),
/** Branch if int comparison with zero succeeds */
IFNE(ClassFile.IFNE, 3, Kind.BRANCH),
IFNE(RawBytecodeHelper.IFNE, 3, Kind.BRANCH),
/** Branch if int comparison with zero succeeds */
IFLT(ClassFile.IFLT, 3, Kind.BRANCH),
IFLT(RawBytecodeHelper.IFLT, 3, Kind.BRANCH),
/** Branch if int comparison with zero succeeds */
IFGE(ClassFile.IFGE, 3, Kind.BRANCH),
IFGE(RawBytecodeHelper.IFGE, 3, Kind.BRANCH),
/** Branch if int comparison with zero succeeds */
IFGT(ClassFile.IFGT, 3, Kind.BRANCH),
IFGT(RawBytecodeHelper.IFGT, 3, Kind.BRANCH),
/** Branch if int comparison with zero succeeds */
IFLE(ClassFile.IFLE, 3, Kind.BRANCH),
IFLE(RawBytecodeHelper.IFLE, 3, Kind.BRANCH),
/** Branch if int comparison succeeds */
IF_ICMPEQ(ClassFile.IF_ICMPEQ, 3, Kind.BRANCH),
IF_ICMPEQ(RawBytecodeHelper.IF_ICMPEQ, 3, Kind.BRANCH),
/** Branch if int comparison succeeds */
IF_ICMPNE(ClassFile.IF_ICMPNE, 3, Kind.BRANCH),
IF_ICMPNE(RawBytecodeHelper.IF_ICMPNE, 3, Kind.BRANCH),
/** Branch if int comparison succeeds */
IF_ICMPLT(ClassFile.IF_ICMPLT, 3, Kind.BRANCH),
IF_ICMPLT(RawBytecodeHelper.IF_ICMPLT, 3, Kind.BRANCH),
/** Branch if int comparison succeeds */
IF_ICMPGE(ClassFile.IF_ICMPGE, 3, Kind.BRANCH),
IF_ICMPGE(RawBytecodeHelper.IF_ICMPGE, 3, Kind.BRANCH),
/** Branch if int comparison succeeds */
IF_ICMPGT(ClassFile.IF_ICMPGT, 3, Kind.BRANCH),
IF_ICMPGT(RawBytecodeHelper.IF_ICMPGT, 3, Kind.BRANCH),
/** Branch if int comparison succeeds */
IF_ICMPLE(ClassFile.IF_ICMPLE, 3, Kind.BRANCH),
IF_ICMPLE(RawBytecodeHelper.IF_ICMPLE, 3, Kind.BRANCH),
/** Branch if reference comparison succeeds */
IF_ACMPEQ(ClassFile.IF_ACMPEQ, 3, Kind.BRANCH),
IF_ACMPEQ(RawBytecodeHelper.IF_ACMPEQ, 3, Kind.BRANCH),
/** Branch if reference comparison succeeds */
IF_ACMPNE(ClassFile.IF_ACMPNE, 3, Kind.BRANCH),
IF_ACMPNE(RawBytecodeHelper.IF_ACMPNE, 3, Kind.BRANCH),
/** Branch always */
GOTO(ClassFile.GOTO, 3, Kind.BRANCH),
GOTO(RawBytecodeHelper.GOTO, 3, Kind.BRANCH),
/**
* Jump subroutine is discontinued opcode
* @see java.lang.classfile.instruction.DiscontinuedInstruction
*/
JSR(ClassFile.JSR, 3, Kind.DISCONTINUED_JSR),
JSR(RawBytecodeHelper.JSR, 3, Kind.DISCONTINUED_JSR),
/**
* Return from subroutine is discontinued opcode
* @see java.lang.classfile.instruction.DiscontinuedInstruction
*/
RET(ClassFile.RET, 2, Kind.DISCONTINUED_RET),
RET(RawBytecodeHelper.RET, 2, Kind.DISCONTINUED_RET),
/** Access jump table by index and jump */
TABLESWITCH(ClassFile.TABLESWITCH, -1, Kind.TABLE_SWITCH),
TABLESWITCH(RawBytecodeHelper.TABLESWITCH, -1, Kind.TABLE_SWITCH),
/** Access jump table by key match and jump */
LOOKUPSWITCH(ClassFile.LOOKUPSWITCH, -1, Kind.LOOKUP_SWITCH),
LOOKUPSWITCH(RawBytecodeHelper.LOOKUPSWITCH, -1, Kind.LOOKUP_SWITCH),
/** Return int from method */
IRETURN(ClassFile.IRETURN, 1, Kind.RETURN),
IRETURN(RawBytecodeHelper.IRETURN, 1, Kind.RETURN),
/** Return long from method */
LRETURN(ClassFile.LRETURN, 1, Kind.RETURN),
LRETURN(RawBytecodeHelper.LRETURN, 1, Kind.RETURN),
/** Return float from method */
FRETURN(ClassFile.FRETURN, 1, Kind.RETURN),
FRETURN(RawBytecodeHelper.FRETURN, 1, Kind.RETURN),
/** Return double from method */
DRETURN(ClassFile.DRETURN, 1, Kind.RETURN),
DRETURN(RawBytecodeHelper.DRETURN, 1, Kind.RETURN),
/** Return reference from method */
ARETURN(ClassFile.ARETURN, 1, Kind.RETURN),
ARETURN(RawBytecodeHelper.ARETURN, 1, Kind.RETURN),
/** Return void from method */
RETURN(ClassFile.RETURN, 1, Kind.RETURN),
RETURN(RawBytecodeHelper.RETURN, 1, Kind.RETURN),
/** Get static field from class */
GETSTATIC(ClassFile.GETSTATIC, 3, Kind.FIELD_ACCESS),
GETSTATIC(RawBytecodeHelper.GETSTATIC, 3, Kind.FIELD_ACCESS),
/** Set static field in class */
PUTSTATIC(ClassFile.PUTSTATIC, 3, Kind.FIELD_ACCESS),
PUTSTATIC(RawBytecodeHelper.PUTSTATIC, 3, Kind.FIELD_ACCESS),
/** Fetch field from object */
GETFIELD(ClassFile.GETFIELD, 3, Kind.FIELD_ACCESS),
GETFIELD(RawBytecodeHelper.GETFIELD, 3, Kind.FIELD_ACCESS),
/** Set field in object */
PUTFIELD(ClassFile.PUTFIELD, 3, Kind.FIELD_ACCESS),
PUTFIELD(RawBytecodeHelper.PUTFIELD, 3, Kind.FIELD_ACCESS),
/** Invoke instance method; dispatch based on class */
INVOKEVIRTUAL(ClassFile.INVOKEVIRTUAL, 3, Kind.INVOKE),
INVOKEVIRTUAL(RawBytecodeHelper.INVOKEVIRTUAL, 3, Kind.INVOKE),
/**
* Invoke instance method; direct invocation of instance initialization
* methods and methods of the current class and its supertypes
*/
INVOKESPECIAL(ClassFile.INVOKESPECIAL, 3, Kind.INVOKE),
INVOKESPECIAL(RawBytecodeHelper.INVOKESPECIAL, 3, Kind.INVOKE),
/** Invoke a class (static) method */
INVOKESTATIC(ClassFile.INVOKESTATIC, 3, Kind.INVOKE),
INVOKESTATIC(RawBytecodeHelper.INVOKESTATIC, 3, Kind.INVOKE),
/** Invoke interface method */
INVOKEINTERFACE(ClassFile.INVOKEINTERFACE, 5, Kind.INVOKE),
INVOKEINTERFACE(RawBytecodeHelper.INVOKEINTERFACE, 5, Kind.INVOKE),
/** Invoke a dynamically-computed call site */
INVOKEDYNAMIC(ClassFile.INVOKEDYNAMIC, 5, Kind.INVOKE_DYNAMIC),
INVOKEDYNAMIC(RawBytecodeHelper.INVOKEDYNAMIC, 5, Kind.INVOKE_DYNAMIC),
/** Create new object */
NEW(ClassFile.NEW, 3, Kind.NEW_OBJECT),
NEW(RawBytecodeHelper.NEW, 3, Kind.NEW_OBJECT),
/** Create new array */
NEWARRAY(ClassFile.NEWARRAY, 2, Kind.NEW_PRIMITIVE_ARRAY),
NEWARRAY(RawBytecodeHelper.NEWARRAY, 2, Kind.NEW_PRIMITIVE_ARRAY),
/** Create new array of reference */
ANEWARRAY(ClassFile.ANEWARRAY, 3, Kind.NEW_REF_ARRAY),
ANEWARRAY(RawBytecodeHelper.ANEWARRAY, 3, Kind.NEW_REF_ARRAY),
/** Get length of array */
ARRAYLENGTH(ClassFile.ARRAYLENGTH, 1, Kind.OPERATOR),
ARRAYLENGTH(RawBytecodeHelper.ARRAYLENGTH, 1, Kind.OPERATOR),
/** Throw exception or error */
ATHROW(ClassFile.ATHROW, 1, Kind.THROW_EXCEPTION),
ATHROW(RawBytecodeHelper.ATHROW, 1, Kind.THROW_EXCEPTION),
/** Check whether object is of given type */
CHECKCAST(ClassFile.CHECKCAST, 3, Kind.TYPE_CHECK),
CHECKCAST(RawBytecodeHelper.CHECKCAST, 3, Kind.TYPE_CHECK),
/** Determine if object is of given type */
INSTANCEOF(ClassFile.INSTANCEOF, 3, Kind.TYPE_CHECK),
INSTANCEOF(RawBytecodeHelper.INSTANCEOF, 3, Kind.TYPE_CHECK),
/** Enter monitor for object */
MONITORENTER(ClassFile.MONITORENTER, 1, Kind.MONITOR),
MONITORENTER(RawBytecodeHelper.MONITORENTER, 1, Kind.MONITOR),
/** Exit monitor for object */
MONITOREXIT(ClassFile.MONITOREXIT, 1, Kind.MONITOR),
MONITOREXIT(RawBytecodeHelper.MONITOREXIT, 1, Kind.MONITOR),
/** Create new multidimensional array */
MULTIANEWARRAY(ClassFile.MULTIANEWARRAY, 4, Kind.NEW_MULTI_ARRAY),
MULTIANEWARRAY(RawBytecodeHelper.MULTIANEWARRAY, 4, Kind.NEW_MULTI_ARRAY),
/** Branch if reference is null */
IFNULL(ClassFile.IFNULL, 3, Kind.BRANCH),
IFNULL(RawBytecodeHelper.IFNULL, 3, Kind.BRANCH),
/** Branch if reference not null */
IFNONNULL(ClassFile.IFNONNULL, 3, Kind.BRANCH),
IFNONNULL(RawBytecodeHelper.IFNONNULL, 3, Kind.BRANCH),
/** Branch always (wide index) */
GOTO_W(ClassFile.GOTO_W, 5, Kind.BRANCH),
GOTO_W(RawBytecodeHelper.GOTO_W, 5, Kind.BRANCH),
/**
* Jump subroutine (wide index) is discontinued opcode
* @see java.lang.classfile.instruction.DiscontinuedInstruction
*/
JSR_W(ClassFile.JSR_W, 5, Kind.DISCONTINUED_JSR),
JSR_W(RawBytecodeHelper.JSR_W, 5, Kind.DISCONTINUED_JSR),
/** Load int from local variable (wide index) */
ILOAD_W((ClassFile.WIDE << 8) | ClassFile.ILOAD, 4, Kind.LOAD),
ILOAD_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.ILOAD, 4, Kind.LOAD),
/** Load long from local variable (wide index) */
LLOAD_W((ClassFile.WIDE << 8) | ClassFile.LLOAD, 4, Kind.LOAD),
LLOAD_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.LLOAD, 4, Kind.LOAD),
/** Load float from local variable (wide index) */
FLOAD_W((ClassFile.WIDE << 8) | ClassFile.FLOAD, 4, Kind.LOAD),
FLOAD_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.FLOAD, 4, Kind.LOAD),
/** Load double from local variable (wide index) */
DLOAD_W((ClassFile.WIDE << 8) | ClassFile.DLOAD, 4, Kind.LOAD),
DLOAD_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.DLOAD, 4, Kind.LOAD),
/** Load reference from local variable (wide index) */
ALOAD_W((ClassFile.WIDE << 8) | ClassFile.ALOAD, 4, Kind.LOAD),
ALOAD_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.ALOAD, 4, Kind.LOAD),
/** Store int into local variable (wide index) */
ISTORE_W((ClassFile.WIDE << 8) | ClassFile.ISTORE, 4, Kind.STORE),
ISTORE_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.ISTORE, 4, Kind.STORE),
/** Store long into local variable (wide index) */
LSTORE_W((ClassFile.WIDE << 8) | ClassFile.LSTORE, 4, Kind.STORE),
LSTORE_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.LSTORE, 4, Kind.STORE),
/** Store float into local variable (wide index) */
FSTORE_W((ClassFile.WIDE << 8) | ClassFile.FSTORE, 4, Kind.STORE),
FSTORE_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.FSTORE, 4, Kind.STORE),
/** Store double into local variable (wide index) */
DSTORE_W((ClassFile.WIDE << 8) | ClassFile.DSTORE, 4, Kind.STORE),
DSTORE_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.DSTORE, 4, Kind.STORE),
/** Store reference into local variable (wide index) */
ASTORE_W((ClassFile.WIDE << 8) | ClassFile.ASTORE, 4, Kind.STORE),
ASTORE_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.ASTORE, 4, Kind.STORE),
/**
* Return from subroutine (wide index) is discontinued opcode
* @see java.lang.classfile.instruction.DiscontinuedInstruction
*/
RET_W((ClassFile.WIDE << 8) | ClassFile.RET, 4, Kind.DISCONTINUED_RET),
RET_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.RET, 4, Kind.DISCONTINUED_RET),
/** Increment local variable by constant (wide index) */
IINC_W((ClassFile.WIDE << 8) | ClassFile.IINC, 6, Kind.INCREMENT);
IINC_W((RawBytecodeHelper.WIDE << 8) | RawBytecodeHelper.IINC, 6, Kind.INCREMENT);
/**
* Kinds of opcodes.
@ -1085,13 +1086,13 @@ public enum Opcode {
/**
* {@return the opcode value} For {@linkplain #isWide() wide} pseudo-opcodes, returns the
* first 2 bytes of the instruction, which are the {@code wide} opcode and the functional
* local variable opcode, as a U2 value.
* first 2 bytes of the instruction, which are the wide opcode {@code 196} ({@code 0xC4})
* and the functional opcode, as a U2 value.
*/
public int bytecode() { return bytecode; }
/**
* {@return true if this is a pseudo-opcode modified by {@code wide}}
* {@return true if this is a pseudo-opcode modified by wide opcode}
*
* @see #ILOAD_W
* @see #LLOAD_W

View File

@ -31,31 +31,10 @@ import java.lang.classfile.attribute.RuntimeInvisibleTypeAnnotationsAttribute;
import java.lang.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute;
import jdk.internal.classfile.impl.TargetInfoImpl;
import jdk.internal.classfile.impl.UnboundAttribute;
import static java.lang.classfile.ClassFile.TAT_CAST;
import static java.lang.classfile.ClassFile.TAT_CLASS_EXTENDS;
import static java.lang.classfile.ClassFile.TAT_CLASS_TYPE_PARAMETER;
import static java.lang.classfile.ClassFile.TAT_CLASS_TYPE_PARAMETER_BOUND;
import static java.lang.classfile.ClassFile.TAT_CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT;
import static java.lang.classfile.ClassFile.TAT_CONSTRUCTOR_REFERENCE;
import static java.lang.classfile.ClassFile.TAT_CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT;
import static java.lang.classfile.ClassFile.TAT_EXCEPTION_PARAMETER;
import static java.lang.classfile.ClassFile.TAT_FIELD;
import static java.lang.classfile.ClassFile.TAT_INSTANCEOF;
import static java.lang.classfile.ClassFile.TAT_LOCAL_VARIABLE;
import static java.lang.classfile.ClassFile.TAT_METHOD_FORMAL_PARAMETER;
import static java.lang.classfile.ClassFile.TAT_METHOD_INVOCATION_TYPE_ARGUMENT;
import static java.lang.classfile.ClassFile.TAT_METHOD_RECEIVER;
import static java.lang.classfile.ClassFile.TAT_METHOD_REFERENCE;
import static java.lang.classfile.ClassFile.TAT_METHOD_REFERENCE_TYPE_ARGUMENT;
import static java.lang.classfile.ClassFile.TAT_METHOD_RETURN;
import static java.lang.classfile.ClassFile.TAT_METHOD_TYPE_PARAMETER;
import static java.lang.classfile.ClassFile.TAT_METHOD_TYPE_PARAMETER_BOUND;
import static java.lang.classfile.ClassFile.TAT_NEW;
import static java.lang.classfile.ClassFile.TAT_RESOURCE_VARIABLE;
import static java.lang.classfile.ClassFile.TAT_THROWS;
import jdk.internal.javac.PreviewFeature;
import static java.lang.classfile.TypeAnnotation.TargetInfo.*;
/**
* Models a {@code type_annotation} structure (JVMS {@jvms 4.7.20}). This model
* indicates the annotated type within a declaration or expression and the part
@ -87,70 +66,70 @@ public sealed interface TypeAnnotation
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public enum TargetType {
/** For annotations on a class type parameter declaration. */
CLASS_TYPE_PARAMETER(TAT_CLASS_TYPE_PARAMETER, 1),
CLASS_TYPE_PARAMETER(TARGET_CLASS_TYPE_PARAMETER, 1),
/** For annotations on a method type parameter declaration. */
METHOD_TYPE_PARAMETER(TAT_METHOD_TYPE_PARAMETER, 1),
METHOD_TYPE_PARAMETER(TARGET_METHOD_TYPE_PARAMETER, 1),
/** For annotations on the type of an "extends" or "implements" clause. */
CLASS_EXTENDS(TAT_CLASS_EXTENDS, 2),
CLASS_EXTENDS(TARGET_CLASS_EXTENDS, 2),
/** For annotations on a bound of a type parameter of a class. */
CLASS_TYPE_PARAMETER_BOUND(TAT_CLASS_TYPE_PARAMETER_BOUND, 2),
CLASS_TYPE_PARAMETER_BOUND(TARGET_CLASS_TYPE_PARAMETER_BOUND, 2),
/** For annotations on a bound of a type parameter of a method. */
METHOD_TYPE_PARAMETER_BOUND(TAT_METHOD_TYPE_PARAMETER_BOUND, 2),
METHOD_TYPE_PARAMETER_BOUND(TARGET_METHOD_TYPE_PARAMETER_BOUND, 2),
/** For annotations on a field. */
FIELD(TAT_FIELD, 0),
FIELD(TARGET_FIELD, 0),
/** For annotations on a method return type. */
METHOD_RETURN(TAT_METHOD_RETURN, 0),
METHOD_RETURN(TARGET_METHOD_RETURN, 0),
/** For annotations on the method receiver. */
METHOD_RECEIVER(TAT_METHOD_RECEIVER, 0),
METHOD_RECEIVER(TARGET_METHOD_RECEIVER, 0),
/** For annotations on a method parameter. */
METHOD_FORMAL_PARAMETER(TAT_METHOD_FORMAL_PARAMETER, 1),
METHOD_FORMAL_PARAMETER(TARGET_METHOD_FORMAL_PARAMETER, 1),
/** For annotations on a throws clause in a method declaration. */
THROWS(TAT_THROWS, 2),
THROWS(TARGET_THROWS, 2),
/** For annotations on a local variable. */
LOCAL_VARIABLE(TAT_LOCAL_VARIABLE, -1),
LOCAL_VARIABLE(TARGET_LOCAL_VARIABLE, -1),
/** For annotations on a resource variable. */
RESOURCE_VARIABLE(TAT_RESOURCE_VARIABLE, -1),
RESOURCE_VARIABLE(TARGET_RESOURCE_VARIABLE, -1),
/** For annotations on an exception parameter. */
EXCEPTION_PARAMETER(TAT_EXCEPTION_PARAMETER, 2),
EXCEPTION_PARAMETER(TARGET_EXCEPTION_PARAMETER, 2),
/** For annotations on a type test. */
INSTANCEOF(TAT_INSTANCEOF, 2),
INSTANCEOF(TARGET_INSTANCEOF, 2),
/** For annotations on an object creation expression. */
NEW(TAT_NEW, 2),
NEW(TARGET_NEW, 2),
/** For annotations on a constructor reference receiver. */
CONSTRUCTOR_REFERENCE(TAT_CONSTRUCTOR_REFERENCE, 2),
CONSTRUCTOR_REFERENCE(TARGET_CONSTRUCTOR_REFERENCE, 2),
/** For annotations on a method reference receiver. */
METHOD_REFERENCE(TAT_METHOD_REFERENCE, 2),
METHOD_REFERENCE(TARGET_METHOD_REFERENCE, 2),
/** For annotations on a typecast. */
CAST(TAT_CAST, 3),
CAST(TARGET_CAST, 3),
/** For annotations on a type argument of an object creation expression. */
CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT(TAT_CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT, 3),
CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT(TARGET_CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT, 3),
/** For annotations on a type argument of a method call. */
METHOD_INVOCATION_TYPE_ARGUMENT(TAT_METHOD_INVOCATION_TYPE_ARGUMENT, 3),
METHOD_INVOCATION_TYPE_ARGUMENT(TARGET_METHOD_INVOCATION_TYPE_ARGUMENT, 3),
/** For annotations on a type argument of a constructor reference. */
CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT(TAT_CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT, 3),
CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT(TARGET_CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT, 3),
/** For annotations on a type argument of a method reference. */
METHOD_REFERENCE_TYPE_ARGUMENT(TAT_METHOD_REFERENCE_TYPE_ARGUMENT, 3);
METHOD_REFERENCE_TYPE_ARGUMENT(TARGET_METHOD_REFERENCE_TYPE_ARGUMENT, 3);
private final int targetTypeValue;
private final int sizeIfFixed;
@ -162,6 +141,11 @@ public sealed interface TypeAnnotation
/**
* {@return the target type value}
*
* @apiNote
* {@code TARGET_}-prefixed constants in {@link TargetInfo}, such as {@link
* TargetInfo#TARGET_CLASS_TYPE_PARAMETER}, describe the possible return
* values of this method.
*/
public int targetTypeValue() {
return targetTypeValue;
@ -214,6 +198,146 @@ public sealed interface TypeAnnotation
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface TargetInfo {
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#CLASS_TYPE_PARAMETER CLASS_TYPE_PARAMETER}.
*/
int TARGET_CLASS_TYPE_PARAMETER = 0x00;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#METHOD_TYPE_PARAMETER METHOD_TYPE_PARAMETER}.
*/
int TARGET_METHOD_TYPE_PARAMETER = 0x01;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#CLASS_EXTENDS CLASS_EXTENDS}.
*/
int TARGET_CLASS_EXTENDS = 0x10;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#CLASS_TYPE_PARAMETER_BOUND
* CLASS_TYPE_PARAMETER_BOUND}.
*/
int TARGET_CLASS_TYPE_PARAMETER_BOUND = 0x11;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#METHOD_TYPE_PARAMETER_BOUND
* METHOD_TYPE_PARAMETER_BOUND}.
*/
int TARGET_METHOD_TYPE_PARAMETER_BOUND = 0x12;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#FIELD FIELD}.
*/
int TARGET_FIELD = 0x13;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#METHOD_RETURN METHOD_RETURN}.
*/
int TARGET_METHOD_RETURN = 0x14;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#METHOD_RECEIVER METHOD_RECEIVER}.
*/
int TARGET_METHOD_RECEIVER = 0x15;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#METHOD_FORMAL_PARAMETER
* METHOD_FORMAL_PARAMETER}.
*/
int TARGET_METHOD_FORMAL_PARAMETER = 0x16;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#THROWS THROWS}.
*/
int TARGET_THROWS = 0x17;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#LOCAL_VARIABLE LOCAL_VARIABLE}.
*/
int TARGET_LOCAL_VARIABLE = 0x40;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#RESOURCE_VARIABLE RESOURCE_VARIABLE}.
*/
int TARGET_RESOURCE_VARIABLE = 0x41;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#EXCEPTION_PARAMETER EXCEPTION_PARAMETER}.
*/
int TARGET_EXCEPTION_PARAMETER = 0x42;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#INSTANCEOF INSTANCEOF}.
*/
int TARGET_INSTANCEOF = 0x43;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#NEW NEW}.
*/
int TARGET_NEW = 0x44;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#CONSTRUCTOR_REFERENCE
* CONSTRUCTOR_REFERENCE}.
*/
int TARGET_CONSTRUCTOR_REFERENCE = 0x45;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#METHOD_REFERENCE METHOD_REFERENCE}.
*/
int TARGET_METHOD_REFERENCE = 0x46;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#CAST CAST}.
*/
int TARGET_CAST = 0x47;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
* CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT}.
*/
int TARGET_CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT = 0x48;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#METHOD_INVOCATION_TYPE_ARGUMENT
* METHOD_INVOCATION_TYPE_ARGUMENT}.
*/
int TARGET_METHOD_INVOCATION_TYPE_ARGUMENT = 0x49;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
* CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT}.
*/
int TARGET_CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT = 0x4A;
/**
* The {@linkplain TargetType#targetTypeValue() value} of type annotation {@linkplain
* #targetType target type} {@link TargetType#METHOD_REFERENCE_TYPE_ARGUMENT
* METHOD_REFERENCE_TYPE_ARGUMENT}.
*/
int TARGET_METHOD_REFERENCE_TYPE_ARGUMENT = 0x4B;
/**
* {@return the type of the target}
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,8 @@
*/
package java.lang.classfile.attribute;
import java.lang.classfile.instruction.CharacterRange;
import jdk.internal.classfile.impl.UnboundAttribute;
import jdk.internal.javac.PreviewFeature;
@ -70,17 +72,17 @@ public sealed interface CharacterRangeInfo
* The value of the flags item describes the kind of range. Multiple flags
* may be set within flags.
* <ul>
* <li>{@link java.lang.classfile.ClassFile#CRT_STATEMENT} Range is a Statement
* <li>{@link CharacterRange#FLAG_STATEMENT} Range is a Statement
* (except ExpressionStatement), StatementExpression {@jls 14.8}, as well as each
* VariableDeclaratorId = VariableInitializer of
* LocalVariableDeclarationStatement {@jls 14.4} or FieldDeclaration {@jls 8.3} in the
* grammar.
* <li>{@link java.lang.classfile.ClassFile#CRT_BLOCK} Range is a Block in the
* <li>{@link CharacterRange#FLAG_BLOCK} Range is a Block in the
* grammar.
* <li>{@link java.lang.classfile.ClassFile#CRT_ASSIGNMENT} Range is an assignment
* <li>{@link CharacterRange#FLAG_ASSIGNMENT} Range is an assignment
* expression - Expression1 AssignmentOperator Expression1 in the grammar as
* well as increment and decrement expressions (both prefix and postfix).
* <li>{@link java.lang.classfile.ClassFile#CRT_FLOW_CONTROLLER} An expression
* <li>{@link CharacterRange#FLAG_FLOW_CONTROLLER} An expression
* whose value will effect control flow. {@code Flowcon} in the following:
* <pre>
* if ( Flowcon ) Statement [else Statement]
@ -92,7 +94,7 @@ public sealed interface CharacterRangeInfo
* Flowcon &amp;&amp; Expression3
* Flowcon ? Expression : Expression1
* </pre>
* <li>{@link java.lang.classfile.ClassFile#CRT_FLOW_TARGET} Statement or
* <li>{@link CharacterRange#FLAG_FLOW_TARGET} Statement or
* expression effected by a CRT_FLOW_CONTROLLER. {@code Flowtarg} in the following:
* <pre>
* if ( Flowcon ) Flowtarg [else Flowtarg]
@ -103,11 +105,11 @@ public sealed interface CharacterRangeInfo
* Flowcon &amp;&amp; Flowtarg
* Flowcon ? Flowtarg : Flowtarg
* </pre>
* <li>{@link java.lang.classfile.ClassFile#CRT_INVOKE} Method invocation. For
* <li>{@link CharacterRange#FLAG_INVOKE} Method invocation. For
* example: Identifier Arguments.
* <li>{@link java.lang.classfile.ClassFile#CRT_CREATE} New object creation. For
* <li>{@link CharacterRange#FLAG_CREATE} New object creation. For
* example: new Creator.
* <li>{@link java.lang.classfile.ClassFile#CRT_BRANCH_TRUE} A condition encoded
* <li>{@link CharacterRange#FLAG_BRANCH_TRUE} A condition encoded
* in the branch instruction immediately contained in the code range for
* this item is not inverted towards the corresponding branch condition in
* the source code. I.e. actual jump occurs if and only if the the source
@ -119,7 +121,7 @@ public sealed interface CharacterRangeInfo
* if&lt;cond&gt;, ifnonull, ifnull or goto. CRT_BRANCH_TRUE and
* CRT_BRANCH_FALSE are special kinds of entries that can be used to
* determine what branch of a condition was chosen during the runtime.
* <li>{@link java.lang.classfile.ClassFile#CRT_BRANCH_FALSE} A condition encoded
* <li>{@link CharacterRange#FLAG_BRANCH_FALSE} A condition encoded
* in the branch instruction immediately contained in the code range for
* this item is inverted towards the corresponding branch condition in the
* source code. I.e. actual jump occurs if and only if the the source code
@ -134,6 +136,7 @@ public sealed interface CharacterRangeInfo
* All bits of the flags item not assigned above are reserved for future use. They should be set to zero in generated class files and should be ignored by Java virtual machine implementations.
*
* @return the flags
* @see CharacterRange#flags()
*/
int flags();

View File

@ -32,7 +32,6 @@ import java.lang.classfile.Label;
import java.lang.classfile.constantpool.ClassEntry;
import jdk.internal.classfile.impl.StackMapDecoder;
import jdk.internal.classfile.impl.TemporaryConstantPool;
import static java.lang.classfile.ClassFile.*;
import jdk.internal.javac.PreviewFeature;
/**
@ -85,8 +84,39 @@ public sealed interface StackMapFrameInfo
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface VerificationTypeInfo {
/** The {@link #tag() tag} for verification type info {@link SimpleVerificationTypeInfo#TOP TOP}. */
int ITEM_TOP = 0;
/** The {@link #tag() tag} for verification type info {@link SimpleVerificationTypeInfo#INTEGER INTEGER}. */
int ITEM_INTEGER = 1;
/** The {@link #tag() tag} for verification type info {@link SimpleVerificationTypeInfo#FLOAT FLOAT}. */
int ITEM_FLOAT = 2;
/** The {@link #tag() tag} for verification type info {@link SimpleVerificationTypeInfo#DOUBLE DOUBLE}. */
int ITEM_DOUBLE = 3;
/** The {@link #tag() tag} for verification type info {@link SimpleVerificationTypeInfo#LONG LONG}. */
int ITEM_LONG = 4;
/** The {@link #tag() tag} for verification type info {@link SimpleVerificationTypeInfo#NULL NULL}. */
int ITEM_NULL = 5;
/** The {@link #tag() tag} for verification type info {@link SimpleVerificationTypeInfo#UNINITIALIZED_THIS UNINITIALIZED_THIS}. */
int ITEM_UNINITIALIZED_THIS = 6;
/** The {@link #tag() tag} for verification type info {@link ObjectVerificationTypeInfo OBJECT}. */
int ITEM_OBJECT = 7;
/** The {@link #tag() tag} for verification type info {@link UninitializedVerificationTypeInfo UNINITIALIZED}. */
int ITEM_UNINITIALIZED = 8;
/**
* {@return the tag of the type info}
*
* @apiNote
* {@code ITEM_}-prefixed constants in this class, such as {@link #ITEM_TOP}, describe the
* possible return values of this method.
*/
int tag();
}
@ -100,25 +130,25 @@ public sealed interface StackMapFrameInfo
public enum SimpleVerificationTypeInfo implements VerificationTypeInfo {
/** verification type top */
ITEM_TOP(VT_TOP),
TOP(ITEM_TOP),
/** verification type int */
ITEM_INTEGER(VT_INTEGER),
INTEGER(ITEM_INTEGER),
/** verification type float */
ITEM_FLOAT(VT_FLOAT),
FLOAT(ITEM_FLOAT),
/** verification type double */
ITEM_DOUBLE(VT_DOUBLE),
DOUBLE(ITEM_DOUBLE),
/** verification type long */
ITEM_LONG(VT_LONG),
LONG(ITEM_LONG),
/** verification type null */
ITEM_NULL(VT_NULL),
NULL(ITEM_NULL),
/** verification type uninitializedThis */
ITEM_UNINITIALIZED_THIS(VT_UNINITIALIZED_THIS);
UNINITIALIZED_THIS(ITEM_UNINITIALIZED_THIS);
private final int tag;
@ -134,7 +164,7 @@ public sealed interface StackMapFrameInfo
}
/**
* A stack value for an object type.
* A stack value for an object type. Its {@link #tag() tag} is {@value #ITEM_OBJECT}.
*
* @since 22
*/
@ -173,7 +203,7 @@ public sealed interface StackMapFrameInfo
}
/**
* An uninitialized stack value.
* An uninitialized stack value. Its {@link #tag() tag} is {@value #ITEM_UNINITIALIZED}.
*
* @since 22
*/

View File

@ -38,6 +38,57 @@ public sealed interface PoolEntry
LoadableConstantEntry, MemberRefEntry, ModuleEntry, NameAndTypeEntry,
PackageEntry {
/** The {@linkplain #tag tag} for {@link ClassEntry CONSTANT_Class} constant kind. */
int TAG_CLASS = 7;
/** The {@linkplain #tag tag} for {@link DoubleEntry CONSTANT_Double} constant kind. */
int TAG_DOUBLE = 6;
/** The {@linkplain #tag tag} for {@link ConstantDynamicEntry CONSTANT_Dynamic} constant kind. */
int TAG_DYNAMIC = 17;
/** The {@linkplain #tag tag} for {@link FieldRefEntry CONSTANT_Fieldref} constant kind. */
int TAG_FIELDREF = 9;
/** The {@linkplain #tag tag} for {@link FloatEntry CONSTANT_Float} constant kind. */
int TAG_FLOAT = 4;
/** The {@linkplain #tag tag} for {@link IntegerEntry CONSTANT_Integer} constant kind. */
int TAG_INTEGER = 3;
/** The {@linkplain #tag tag} for {@link InterfaceMethodRefEntry CONSTANT_InterfaceMethodref} constant kind. */
int TAG_INTERFACE_METHODREF = 11;
/** The {@linkplain #tag tag} for {@link InvokeDynamicEntry CONSTANT_InvokeDynamic} constant kind. */
int TAG_INVOKE_DYNAMIC = 18;
/** The {@linkplain #tag tag} for {@link LongEntry CONSTANT_Long} constant kind. */
int TAG_LONG = 5;
/** The {@linkplain #tag tag} for {@link MethodHandleEntry CONSTANT_MethodHandle} constant kind. */
int TAG_METHOD_HANDLE = 15;
/** The {@linkplain #tag tag} for {@link MethodRefEntry CONSTANT_Methodref} constant kind. */
int TAG_METHODREF = 10;
/** The {@linkplain #tag tag} for {@link MethodTypeEntry CONSTANT_MethodType} constant kind. */
int TAG_METHOD_TYPE = 16;
/** The {@linkplain #tag tag} for {@link ModuleEntry CONSTANT_Module} constant kind. */
int TAG_MODULE = 19;
/** The {@linkplain #tag tag} for {@link NameAndTypeEntry CONSTANT_NameAndType} constant kind. */
int TAG_NAME_AND_TYPE = 12;
/** The {@linkplain #tag tag} for {@link PackageEntry CONSTANT_Package} constant kind. */
int TAG_PACKAGE = 20;
/** The {@linkplain #tag tag} for {@link StringEntry CONSTANT_String} constant kind. */
int TAG_STRING = 8;
/** The {@linkplain #tag tag} for {@link Utf8Entry CONSTANT_Utf8} constant kind. */
int TAG_UTF8 = 1;
/**
* {@return the constant pool this entry is from}
*/
@ -45,6 +96,10 @@ public sealed interface PoolEntry
/**
* {@return the constant pool tag that describes the type of this entry}
*
* @apiNote
* {@code TAG_}-prefixed constants in this class, such as {@link #TAG_UTF8},
* describe the possible return values of this method.
*/
byte tag();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,7 @@ import java.lang.classfile.CodeElement;
import java.lang.classfile.CodeModel;
import java.lang.classfile.Label;
import java.lang.classfile.PseudoInstruction;
import java.lang.classfile.attribute.CharacterRangeInfo;
import java.lang.classfile.attribute.CharacterRangeTableAttribute;
import jdk.internal.classfile.impl.AbstractPseudoInstruction;
import jdk.internal.classfile.impl.BoundCharacterRange;
@ -45,6 +46,34 @@ import jdk.internal.javac.PreviewFeature;
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface CharacterRange extends PseudoInstruction
permits AbstractPseudoInstruction.UnboundCharacterRange, BoundCharacterRange {
/** The bit mask of STATEMENT {@link CharacterRangeInfo} kind. */
int FLAG_STATEMENT = 0x0001;
/** The bit mask of BLOCK {@link CharacterRangeInfo} kind. */
int FLAG_BLOCK = 0x0002;
/** The bit mask of ASSIGNMENT {@link CharacterRangeInfo} kind. */
int FLAG_ASSIGNMENT = 0x0004;
/** The bit mask of FLOW_CONTROLLER {@link CharacterRangeInfo} kind. */
int FLAG_FLOW_CONTROLLER = 0x0008;
/** The bit mask of FLOW_TARGET {@link CharacterRangeInfo} kind. */
int FLAG_FLOW_TARGET = 0x0010;
/** The bit mask of INVOKE {@link CharacterRangeInfo} kind. */
int FLAG_INVOKE = 0x0020;
/** The bit mask of CREATE {@link CharacterRangeInfo} kind. */
int FLAG_CREATE = 0x0040;
/** The bit mask of BRANCH_TRUE {@link CharacterRangeInfo} kind. */
int FLAG_BRANCH_TRUE = 0x0080;
/** The bit mask of BRANCH_FALSE {@link CharacterRangeInfo} kind. */
int FLAG_BRANCH_FALSE = 0x0100;
/**
* {@return the start of the instruction range}
*/
@ -75,15 +104,15 @@ public sealed interface CharacterRange extends PseudoInstruction
* A flags word, indicating the kind of range. Multiple flag bits
* may be set. Valid flags include:
* <ul>
* <li>{@link java.lang.classfile.ClassFile#CRT_STATEMENT}
* <li>{@link java.lang.classfile.ClassFile#CRT_BLOCK}
* <li>{@link java.lang.classfile.ClassFile#CRT_ASSIGNMENT}
* <li>{@link java.lang.classfile.ClassFile#CRT_FLOW_CONTROLLER}
* <li>{@link java.lang.classfile.ClassFile#CRT_FLOW_TARGET}
* <li>{@link java.lang.classfile.ClassFile#CRT_INVOKE}
* <li>{@link java.lang.classfile.ClassFile#CRT_CREATE}
* <li>{@link java.lang.classfile.ClassFile#CRT_BRANCH_TRUE}
* <li>{@link java.lang.classfile.ClassFile#CRT_BRANCH_FALSE}
* <li>{@link #FLAG_STATEMENT}
* <li>{@link #FLAG_BLOCK}
* <li>{@link #FLAG_ASSIGNMENT}
* <li>{@link #FLAG_FLOW_CONTROLLER}
* <li>{@link #FLAG_FLOW_TARGET}
* <li>{@link #FLAG_INVOKE}
* <li>{@link #FLAG_CREATE}
* <li>{@link #FLAG_BRANCH_TRUE}
* <li>{@link #FLAG_BRANCH_FALSE}
* </ul>
*
* @see java.lang.classfile.attribute.CharacterRangeInfo#flags()

View File

@ -24,11 +24,11 @@
*/
package jdk.internal.classfile.impl;
import java.lang.classfile.constantpool.PoolEntry;
import java.lang.constant.ConstantDesc;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.lang.classfile.ClassFile;
import java.lang.classfile.Instruction;
import java.lang.classfile.constantpool.ClassEntry;
import java.lang.classfile.instruction.SwitchCase;
@ -421,7 +421,7 @@ public abstract sealed class AbstractInstruction
@Override
public boolean isInterface() {
return method().tag() == ClassFile.TAG_INTERFACEMETHODREF;
return method().tag() == PoolEntry.TAG_INTERFACE_METHODREF;
}
@Override

View File

@ -30,7 +30,6 @@ import java.lang.invoke.TypeDescriptor;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.lang.classfile.ClassFile;
import java.lang.classfile.constantpool.ClassEntry;
import java.lang.classfile.constantpool.ConstantDynamicEntry;
import java.lang.classfile.constantpool.ConstantPool;
@ -57,8 +56,6 @@ import jdk.internal.access.SharedSecrets;
import jdk.internal.util.ArraysSupport;
import jdk.internal.vm.annotation.Stable;
import static java.lang.classfile.ClassFile.*;
public abstract sealed class AbstractPoolEntry {
/*
Invariant: a {CP,BSM} entry for pool P refer only to {CP,BSM} entries
@ -92,7 +89,7 @@ public abstract sealed class AbstractPoolEntry {
}
static int hashClassFromDescriptor(int descriptorHash) {
return hash1(ClassFile.TAG_CLASS, descriptorHash);
return hash1(PoolEntry.TAG_CLASS, descriptorHash);
}
static boolean isArrayDescriptor(Utf8EntryImpl cs) {
@ -570,17 +567,17 @@ public abstract sealed class AbstractPoolEntry {
super(cpm, TAG_CLASS, index, name);
}
ClassEntryImpl(ConstantPool cpm, int index, Utf8EntryImpl name, int hash, ClassDesc sym) {
super(cpm, TAG_CLASS, index, name);
this.hash = hash;
this.sym = sym;
}
@Override
public byte tag() {
return TAG_CLASS;
}
ClassEntryImpl(ConstantPool cpm, int index, Utf8EntryImpl name, int hash, ClassDesc sym) {
super(cpm, ClassFile.TAG_CLASS, index, name);
this.hash = hash;
this.sym = sym;
}
@Override
public ClassEntry clone(ConstantPoolBuilder cp) {
return ((SplitConstantPool) cp).cloneClassEntry(this);
@ -696,12 +693,12 @@ public abstract sealed class AbstractPoolEntry {
implements NameAndTypeEntry {
NameAndTypeEntryImpl(ConstantPool cpm, int index, Utf8EntryImpl name, Utf8EntryImpl type) {
super(cpm, TAG_NAMEANDTYPE, index, name, type);
super(cpm, TAG_NAME_AND_TYPE, index, name, type);
}
@Override
public byte tag() {
return TAG_NAMEANDTYPE;
return TAG_NAME_AND_TYPE;
}
@Override
@ -788,7 +785,7 @@ public abstract sealed class AbstractPoolEntry {
MethodRefEntryImpl(ConstantPool cpm, int index,
ClassEntryImpl owner, NameAndTypeEntryImpl nameAndType) {
super(cpm, ClassFile.TAG_METHODREF, index, owner, nameAndType);
super(cpm, TAG_METHODREF, index, owner, nameAndType);
}
@Override
@ -806,12 +803,12 @@ public abstract sealed class AbstractPoolEntry {
InterfaceMethodRefEntryImpl(ConstantPool cpm, int index, ClassEntryImpl owner,
NameAndTypeEntryImpl nameAndType) {
super(cpm, ClassFile.TAG_INTERFACEMETHODREF, index, owner, nameAndType);
super(cpm, TAG_INTERFACE_METHODREF, index, owner, nameAndType);
}
@Override
public byte tag() {
return TAG_INTERFACEMETHODREF;
return TAG_INTERFACE_METHODREF;
}
@Override
@ -901,13 +898,13 @@ public abstract sealed class AbstractPoolEntry {
InvokeDynamicEntryImpl(ConstantPool cpm, int index, int bsmIndex,
NameAndTypeEntryImpl nameAndType) {
super(cpm, index, hash2(TAG_INVOKEDYNAMIC, bsmIndex, nameAndType.index()),
super(cpm, index, hash2(TAG_INVOKE_DYNAMIC, bsmIndex, nameAndType.index()),
bsmIndex, nameAndType);
}
@Override
public byte tag() {
return TAG_INVOKEDYNAMIC;
return TAG_INVOKE_DYNAMIC;
}
@Override
@ -926,13 +923,13 @@ public abstract sealed class AbstractPoolEntry {
ConstantDynamicEntryImpl(ConstantPool cpm, int index, int bsmIndex,
NameAndTypeEntryImpl nameAndType) {
super(cpm, index, hash2(TAG_CONSTANTDYNAMIC, bsmIndex, nameAndType.index()),
super(cpm, index, hash2(TAG_DYNAMIC, bsmIndex, nameAndType.index()),
bsmIndex, nameAndType);
}
@Override
public byte tag() {
return TAG_CONSTANTDYNAMIC;
return TAG_DYNAMIC;
}
@Override
@ -956,14 +953,14 @@ public abstract sealed class AbstractPoolEntry {
MethodHandleEntryImpl(ConstantPool cpm, int index, int refKind, AbstractPoolEntry.AbstractMemberRefEntry
reference) {
super(cpm, index, hash2(ClassFile.TAG_METHODHANDLE, refKind, reference.index()));
super(cpm, index, hash2(TAG_METHOD_HANDLE, refKind, reference.index()));
this.refKind = refKind;
this.reference = reference;
}
@Override
public byte tag() {
return TAG_METHODHANDLE;
return TAG_METHOD_HANDLE;
}
@Override
@ -987,7 +984,7 @@ public abstract sealed class AbstractPoolEntry {
@Override
void writeTo(BufWriterImpl pool) {
pool.writeU1(TAG_METHODHANDLE);
pool.writeU1(TAG_METHOD_HANDLE);
pool.writeU1(refKind);
pool.writeU2(reference.index());
}
@ -1019,12 +1016,12 @@ public abstract sealed class AbstractPoolEntry {
implements MethodTypeEntry {
MethodTypeEntryImpl(ConstantPool cpm, int index, Utf8EntryImpl descriptor) {
super(cpm, TAG_METHODTYPE, index, descriptor);
super(cpm, TAG_METHOD_TYPE, index, descriptor);
}
@Override
public byte tag() {
return TAG_METHODTYPE;
return TAG_METHOD_TYPE;
}
@Override
@ -1108,7 +1105,7 @@ public abstract sealed class AbstractPoolEntry {
private final int val;
IntegerEntryImpl(ConstantPool cpm, int index, int i) {
super(cpm, index, hash1(ClassFile.TAG_INTEGER, Integer.hashCode(i)));
super(cpm, index, hash1(TAG_INTEGER, Integer.hashCode(i)));
val = i;
}
@ -1154,7 +1151,7 @@ public abstract sealed class AbstractPoolEntry {
private final float val;
FloatEntryImpl(ConstantPool cpm, int index, float f) {
super(cpm, index, hash1(ClassFile.TAG_FLOAT, Float.hashCode(f)));
super(cpm, index, hash1(TAG_FLOAT, Float.hashCode(f)));
val = f;
}
@ -1199,7 +1196,7 @@ public abstract sealed class AbstractPoolEntry {
private final long val;
LongEntryImpl(ConstantPool cpm, int index, long l) {
super(cpm, index, hash1(ClassFile.TAG_LONG, Long.hashCode(l)));
super(cpm, index, hash1(TAG_LONG, Long.hashCode(l)));
val = l;
}
@ -1249,7 +1246,7 @@ public abstract sealed class AbstractPoolEntry {
private final double val;
DoubleEntryImpl(ConstantPool cpm, int index, double d) {
super(cpm, index, hash1(ClassFile.TAG_DOUBLE, Double.hashCode(d)));
super(cpm, index, hash1(TAG_DOUBLE, Double.hashCode(d)));
val = d;
}

View File

@ -29,8 +29,6 @@ import java.lang.classfile.constantpool.*;
import java.util.List;
import static java.lang.classfile.ClassFile.*;
public record AnnotationImpl(Utf8Entry className, List<AnnotationElement> elements)
implements Annotation {
public AnnotationImpl {
@ -62,7 +60,7 @@ public record AnnotationImpl(Utf8Entry className, List<AnnotationElement> elemen
implements AnnotationValue.OfString {
@Override
public char tag() {
return AEV_STRING;
return TAG_STRING;
}
@Override
@ -75,7 +73,7 @@ public record AnnotationImpl(Utf8Entry className, List<AnnotationElement> elemen
implements AnnotationValue.OfDouble {
@Override
public char tag() {
return AEV_DOUBLE;
return TAG_DOUBLE;
}
@Override
@ -88,7 +86,7 @@ public record AnnotationImpl(Utf8Entry className, List<AnnotationElement> elemen
implements AnnotationValue.OfFloat {
@Override
public char tag() {
return AEV_FLOAT;
return TAG_FLOAT;
}
@Override
@ -101,7 +99,7 @@ public record AnnotationImpl(Utf8Entry className, List<AnnotationElement> elemen
implements AnnotationValue.OfLong {
@Override
public char tag() {
return AEV_LONG;
return TAG_LONG;
}
@Override
@ -114,7 +112,7 @@ public record AnnotationImpl(Utf8Entry className, List<AnnotationElement> elemen
implements AnnotationValue.OfInt {
@Override
public char tag() {
return AEV_INT;
return TAG_INT;
}
@Override
@ -127,7 +125,7 @@ public record AnnotationImpl(Utf8Entry className, List<AnnotationElement> elemen
implements AnnotationValue.OfShort {
@Override
public char tag() {
return AEV_SHORT;
return TAG_SHORT;
}
@Override
@ -140,7 +138,7 @@ public record AnnotationImpl(Utf8Entry className, List<AnnotationElement> elemen
implements AnnotationValue.OfChar {
@Override
public char tag() {
return AEV_CHAR;
return TAG_CHAR;
}
@Override
@ -153,7 +151,7 @@ public record AnnotationImpl(Utf8Entry className, List<AnnotationElement> elemen
implements AnnotationValue.OfByte {
@Override
public char tag() {
return AEV_BYTE;
return TAG_BYTE;
}
@Override
@ -166,7 +164,7 @@ public record AnnotationImpl(Utf8Entry className, List<AnnotationElement> elemen
implements AnnotationValue.OfBoolean {
@Override
public char tag() {
return AEV_BOOLEAN;
return TAG_BOOLEAN;
}
@Override
@ -183,7 +181,7 @@ public record AnnotationImpl(Utf8Entry className, List<AnnotationElement> elemen
@Override
public char tag() {
return AEV_ARRAY;
return TAG_ARRAY;
}
}
@ -191,7 +189,7 @@ public record AnnotationImpl(Utf8Entry className, List<AnnotationElement> elemen
implements AnnotationValue.OfEnum {
@Override
public char tag() {
return AEV_ENUM;
return TAG_ENUM;
}
}
@ -199,7 +197,7 @@ public record AnnotationImpl(Utf8Entry className, List<AnnotationElement> elemen
implements AnnotationValue.OfAnnotation {
@Override
public char tag() {
return AEV_ANNOTATION;
return TAG_ANNOTATION;
}
}
@ -207,7 +205,7 @@ public record AnnotationImpl(Utf8Entry className, List<AnnotationElement> elemen
implements AnnotationValue.OfClass {
@Override
public char tag() {
return AEV_CLASS;
return TAG_CLASS;
}
}
}

View File

@ -32,7 +32,8 @@ import java.lang.classfile.BufWriter;
import java.lang.classfile.ClassReader;
import java.lang.classfile.constantpool.*;
import java.lang.classfile.TypeAnnotation;
import static java.lang.classfile.ClassFile.*;
import static java.lang.classfile.AnnotationValue.*;
import static java.lang.classfile.TypeAnnotation.TargetInfo.*;
import java.util.List;
@ -59,20 +60,20 @@ public final class AnnotationReader {
char tag = (char) classReader.readU1(p);
++p;
return switch (tag) {
case AEV_BYTE -> new AnnotationImpl.OfByteImpl(classReader.readEntry(p, IntegerEntry.class));
case AEV_CHAR -> new AnnotationImpl.OfCharImpl(classReader.readEntry(p, IntegerEntry.class));
case AEV_DOUBLE -> new AnnotationImpl.OfDoubleImpl(classReader.readEntry(p, DoubleEntry.class));
case AEV_FLOAT -> new AnnotationImpl.OfFloatImpl(classReader.readEntry(p, FloatEntry.class));
case AEV_INT -> new AnnotationImpl.OfIntImpl(classReader.readEntry(p, IntegerEntry.class));
case AEV_LONG -> new AnnotationImpl.OfLongImpl(classReader.readEntry(p, LongEntry.class));
case AEV_SHORT -> new AnnotationImpl.OfShortImpl(classReader.readEntry(p, IntegerEntry.class));
case AEV_BOOLEAN -> new AnnotationImpl.OfBooleanImpl(classReader.readEntry(p, IntegerEntry.class));
case AEV_STRING -> new AnnotationImpl.OfStringImpl(classReader.readEntry(p, Utf8Entry.class));
case AEV_ENUM -> new AnnotationImpl.OfEnumImpl(classReader.readEntry(p, Utf8Entry.class),
case TAG_BYTE -> new AnnotationImpl.OfByteImpl(classReader.readEntry(p, IntegerEntry.class));
case TAG_CHAR -> new AnnotationImpl.OfCharImpl(classReader.readEntry(p, IntegerEntry.class));
case TAG_DOUBLE -> new AnnotationImpl.OfDoubleImpl(classReader.readEntry(p, DoubleEntry.class));
case TAG_FLOAT -> new AnnotationImpl.OfFloatImpl(classReader.readEntry(p, FloatEntry.class));
case TAG_INT -> new AnnotationImpl.OfIntImpl(classReader.readEntry(p, IntegerEntry.class));
case TAG_LONG -> new AnnotationImpl.OfLongImpl(classReader.readEntry(p, LongEntry.class));
case TAG_SHORT -> new AnnotationImpl.OfShortImpl(classReader.readEntry(p, IntegerEntry.class));
case TAG_BOOLEAN -> new AnnotationImpl.OfBooleanImpl(classReader.readEntry(p, IntegerEntry.class));
case TAG_STRING -> new AnnotationImpl.OfStringImpl(classReader.readEntry(p, Utf8Entry.class));
case TAG_ENUM -> new AnnotationImpl.OfEnumImpl(classReader.readEntry(p, Utf8Entry.class),
classReader.readEntry(p + 2, Utf8Entry.class));
case AEV_CLASS -> new AnnotationImpl.OfClassImpl(classReader.readEntry(p, Utf8Entry.class));
case AEV_ANNOTATION -> new AnnotationImpl.OfAnnotationImpl(readAnnotation(classReader, p));
case AEV_ARRAY -> {
case TAG_CLASS -> new AnnotationImpl.OfClassImpl(classReader.readEntry(p, Utf8Entry.class));
case TAG_ANNOTATION -> new AnnotationImpl.OfAnnotationImpl(readAnnotation(classReader, p));
case TAG_ARRAY -> {
int numValues = classReader.readU2(p);
p += 2;
var values = new Object[numValues];
@ -179,49 +180,49 @@ public final class AnnotationReader {
private static TypeAnnotation readTypeAnnotation(ClassReader classReader, int p, LabelContext lc) {
int targetType = classReader.readU1(p++);
var targetInfo = switch (targetType) {
case TAT_CLASS_TYPE_PARAMETER ->
case TARGET_CLASS_TYPE_PARAMETER ->
ofClassTypeParameter(classReader.readU1(p));
case TAT_METHOD_TYPE_PARAMETER ->
case TARGET_METHOD_TYPE_PARAMETER ->
ofMethodTypeParameter(classReader.readU1(p));
case TAT_CLASS_EXTENDS ->
case TARGET_CLASS_EXTENDS ->
ofClassExtends(classReader.readU2(p));
case TAT_CLASS_TYPE_PARAMETER_BOUND ->
case TARGET_CLASS_TYPE_PARAMETER_BOUND ->
ofClassTypeParameterBound(classReader.readU1(p), classReader.readU1(p + 1));
case TAT_METHOD_TYPE_PARAMETER_BOUND ->
case TARGET_METHOD_TYPE_PARAMETER_BOUND ->
ofMethodTypeParameterBound(classReader.readU1(p), classReader.readU1(p + 1));
case TAT_FIELD ->
case TARGET_FIELD ->
ofField();
case TAT_METHOD_RETURN ->
case TARGET_METHOD_RETURN ->
ofMethodReturn();
case TAT_METHOD_RECEIVER ->
case TARGET_METHOD_RECEIVER ->
ofMethodReceiver();
case TAT_METHOD_FORMAL_PARAMETER ->
case TARGET_METHOD_FORMAL_PARAMETER ->
ofMethodFormalParameter(classReader.readU1(p));
case TAT_THROWS ->
case TARGET_THROWS ->
ofThrows(classReader.readU2(p));
case TAT_LOCAL_VARIABLE ->
case TARGET_LOCAL_VARIABLE ->
ofLocalVariable(readLocalVarEntries(classReader, p, lc, targetType));
case TAT_RESOURCE_VARIABLE ->
case TARGET_RESOURCE_VARIABLE ->
ofResourceVariable(readLocalVarEntries(classReader, p, lc, targetType));
case TAT_EXCEPTION_PARAMETER ->
case TARGET_EXCEPTION_PARAMETER ->
ofExceptionParameter(classReader.readU2(p));
case TAT_INSTANCEOF ->
case TARGET_INSTANCEOF ->
ofInstanceofExpr(getLabel(lc, classReader.readU2(p), targetType, p));
case TAT_NEW ->
case TARGET_NEW ->
ofNewExpr(getLabel(lc, classReader.readU2(p), targetType, p));
case TAT_CONSTRUCTOR_REFERENCE ->
case TARGET_CONSTRUCTOR_REFERENCE ->
ofConstructorReference(getLabel(lc, classReader.readU2(p), targetType, p));
case TAT_METHOD_REFERENCE ->
case TARGET_METHOD_REFERENCE ->
ofMethodReference(getLabel(lc, classReader.readU2(p), targetType, p));
case TAT_CAST ->
case TARGET_CAST ->
ofCastExpr(getLabel(lc, classReader.readU2(p), targetType, p), classReader.readU1(p + 2));
case TAT_CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT ->
case TARGET_CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT ->
ofConstructorInvocationTypeArgument(getLabel(lc, classReader.readU2(p), targetType, p), classReader.readU1(p + 2));
case TAT_METHOD_INVOCATION_TYPE_ARGUMENT ->
case TARGET_METHOD_INVOCATION_TYPE_ARGUMENT ->
ofMethodInvocationTypeArgument(getLabel(lc, classReader.readU2(p), targetType, p), classReader.readU1(p + 2));
case TAT_CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT ->
case TARGET_CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT ->
ofConstructorReferenceTypeArgument(getLabel(lc, classReader.readU2(p), targetType, p), classReader.readU1(p + 2));
case TAT_METHOD_REFERENCE_TYPE_ARGUMENT ->
case TARGET_METHOD_REFERENCE_TYPE_ARGUMENT ->
ofMethodReferenceTypeArgument(getLabel(lc, classReader.readU2(p), targetType, p), classReader.readU1(p + 2));
default ->
throw new IllegalArgumentException("Unexpected targetType '%d' in TypeAnnotation, pos = %d".formatted(targetType, p - 1));
@ -362,16 +363,16 @@ public final class AnnotationReader {
var tag = value.tag();
buf.writeU1(tag);
switch (value.tag()) {
case AEV_BOOLEAN, AEV_BYTE, AEV_CHAR, AEV_DOUBLE, AEV_FLOAT, AEV_INT, AEV_LONG, AEV_SHORT, AEV_STRING ->
case TAG_BOOLEAN, TAG_BYTE, TAG_CHAR, TAG_DOUBLE, TAG_FLOAT, TAG_INT, TAG_LONG, TAG_SHORT, TAG_STRING ->
buf.writeIndex(((AnnotationValue.OfConstant) value).constant());
case AEV_CLASS -> buf.writeIndex(((AnnotationValue.OfClass) value).className());
case AEV_ENUM -> {
case TAG_CLASS -> buf.writeIndex(((AnnotationValue.OfClass) value).className());
case TAG_ENUM -> {
var enumValue = (AnnotationValue.OfEnum) value;
buf.writeIndex(enumValue.className());
buf.writeIndex(enumValue.constantName());
}
case AEV_ANNOTATION -> writeAnnotation(buf, ((AnnotationValue.OfAnnotation) value).annotation());
case AEV_ARRAY -> {
case TAG_ANNOTATION -> writeAnnotation(buf, ((AnnotationValue.OfAnnotation) value).annotation());
case TAG_ARRAY -> {
var array = ((AnnotationValue.OfArray) value).values();
buf.writeU2(array.size());
for (var e : array) {

View File

@ -46,7 +46,7 @@ import java.lang.classfile.constantpool.MemberRefEntry;
import java.lang.classfile.constantpool.MethodHandleEntry;
import java.lang.classfile.constantpool.NameAndTypeEntry;
import static java.lang.classfile.ClassFile.*;
import static jdk.internal.classfile.impl.RawBytecodeHelper.*;
/**
* Note: This class switches on opcode.bytecode for code size

View File

@ -40,6 +40,7 @@ import java.lang.classfile.ClassHierarchyResolver;
import static java.lang.constant.ConstantDescs.CD_Object;
import static java.lang.classfile.ClassFile.*;
import static java.lang.classfile.constantpool.PoolEntry.*;
import static java.util.Objects.requireNonNull;
import static jdk.internal.constant.ConstantUtils.referenceClassDesc;
@ -174,10 +175,10 @@ public final class ClassHierarchyImpl {
switch (tag = in.readUnsignedByte()) {
case TAG_UTF8 -> cpStrings[i] = in.readUTF();
case TAG_CLASS -> cpClasses[i] = in.readUnsignedShort();
case TAG_STRING, TAG_METHODTYPE, TAG_MODULE, TAG_PACKAGE -> in.skipBytes(2);
case TAG_METHODHANDLE -> in.skipBytes(3);
case TAG_INTEGER, TAG_FLOAT, TAG_FIELDREF, TAG_METHODREF, TAG_INTERFACEMETHODREF,
TAG_NAMEANDTYPE, TAG_CONSTANTDYNAMIC, TAG_INVOKEDYNAMIC -> in.skipBytes(4);
case TAG_STRING, TAG_METHOD_TYPE, TAG_MODULE, TAG_PACKAGE -> in.skipBytes(2);
case TAG_METHOD_HANDLE -> in.skipBytes(3);
case TAG_INTEGER, TAG_FLOAT, TAG_FIELDREF, TAG_METHODREF, TAG_INTERFACE_METHODREF,
TAG_NAME_AND_TYPE, TAG_DYNAMIC, TAG_INVOKE_DYNAMIC -> in.skipBytes(4);
case TAG_LONG, TAG_DOUBLE -> {
in.skipBytes(8);
i++;

View File

@ -58,9 +58,9 @@ import java.lang.classfile.attribute.StackMapFrameInfo.*;
import java.lang.classfile.constantpool.*;
import java.lang.classfile.instruction.*;
import static java.lang.classfile.ClassFile.*;
import java.lang.classfile.CompoundElement;
import java.lang.classfile.FieldModel;
import static java.lang.classfile.constantpool.PoolEntry.*;
import static jdk.internal.classfile.impl.ClassPrinterImpl.Style.*;
public final class ClassPrinterImpl {
@ -536,21 +536,21 @@ public final class ClassPrinterImpl {
switch (vti) {
case SimpleVerificationTypeInfo s -> {
switch (s) {
case ITEM_DOUBLE -> {
case DOUBLE -> {
ret.accept("double");
ret.accept("double2");
}
case ITEM_FLOAT ->
case FLOAT ->
ret.accept("float");
case ITEM_INTEGER ->
case INTEGER ->
ret.accept("int");
case ITEM_LONG -> {
case LONG -> {
ret.accept("long");
ret.accept("long2");
}
case ITEM_NULL -> ret.accept("null");
case ITEM_TOP -> ret.accept("?");
case ITEM_UNINITIALIZED_THIS -> ret.accept("THIS");
case NULL -> ret.accept("null");
case TOP -> ret.accept("?");
case UNINITIALIZED_THIS -> ret.accept("THIS");
}
}
case ObjectVerificationTypeInfo o ->
@ -603,12 +603,12 @@ public final class ClassPrinterImpl {
case TAG_STRING -> "String";
case TAG_FIELDREF -> "Fieldref";
case TAG_METHODREF -> "Methodref";
case TAG_INTERFACEMETHODREF -> "InterfaceMethodref";
case TAG_NAMEANDTYPE -> "NameAndType";
case TAG_METHODHANDLE -> "MethodHandle";
case TAG_METHODTYPE -> "MethodType";
case TAG_CONSTANTDYNAMIC -> "Dynamic";
case TAG_INVOKEDYNAMIC -> "InvokeDynamic";
case TAG_INTERFACE_METHODREF -> "InterfaceMethodref";
case TAG_NAME_AND_TYPE -> "NameAndType";
case TAG_METHOD_HANDLE -> "MethodHandle";
case TAG_METHOD_TYPE -> "MethodType";
case TAG_DYNAMIC -> "Dynamic";
case TAG_INVOKE_DYNAMIC -> "InvokeDynamic";
case TAG_MODULE -> "Module";
case TAG_PACKAGE -> "Package";
default -> throw new AssertionError("Unknown CP tag: " + e.tag());

View File

@ -36,23 +36,7 @@ import java.lang.classfile.*;
import java.lang.classfile.attribute.BootstrapMethodsAttribute;
import java.lang.classfile.constantpool.*;
import static java.lang.classfile.ClassFile.TAG_CLASS;
import static java.lang.classfile.ClassFile.TAG_CONSTANTDYNAMIC;
import static java.lang.classfile.ClassFile.TAG_DOUBLE;
import static java.lang.classfile.ClassFile.TAG_FIELDREF;
import static java.lang.classfile.ClassFile.TAG_FLOAT;
import static java.lang.classfile.ClassFile.TAG_INTEGER;
import static java.lang.classfile.ClassFile.TAG_INTERFACEMETHODREF;
import static java.lang.classfile.ClassFile.TAG_INVOKEDYNAMIC;
import static java.lang.classfile.ClassFile.TAG_LONG;
import static java.lang.classfile.ClassFile.TAG_METHODHANDLE;
import static java.lang.classfile.ClassFile.TAG_METHODREF;
import static java.lang.classfile.ClassFile.TAG_METHODTYPE;
import static java.lang.classfile.ClassFile.TAG_MODULE;
import static java.lang.classfile.ClassFile.TAG_NAMEANDTYPE;
import static java.lang.classfile.ClassFile.TAG_PACKAGE;
import static java.lang.classfile.ClassFile.TAG_STRING;
import static java.lang.classfile.ClassFile.TAG_UTF8;
import static java.lang.classfile.constantpool.PoolEntry.*;
public final class ClassReaderImpl
implements ClassReader {
@ -98,15 +82,15 @@ public final class ClassReaderImpl
++p;
switch (tag) {
// 2
case TAG_CLASS, TAG_METHODTYPE, TAG_MODULE, TAG_STRING, TAG_PACKAGE -> p += 2;
case TAG_CLASS, TAG_METHOD_TYPE, TAG_MODULE, TAG_STRING, TAG_PACKAGE -> p += 2;
// 3
case TAG_METHODHANDLE -> p += 3;
case TAG_METHOD_HANDLE -> p += 3;
// 4
case TAG_CONSTANTDYNAMIC, TAG_FIELDREF, TAG_FLOAT, TAG_INTEGER,
TAG_INTERFACEMETHODREF, TAG_INVOKEDYNAMIC, TAG_METHODREF,
TAG_NAMEANDTYPE -> p += 4;
case TAG_DYNAMIC, TAG_FIELDREF, TAG_FLOAT, TAG_INTEGER,
TAG_INTERFACE_METHODREF, TAG_INVOKE_DYNAMIC, TAG_METHODREF,
TAG_NAME_AND_TYPE -> p += 4;
// 8
case TAG_DOUBLE, TAG_LONG -> {
@ -354,12 +338,12 @@ public final class ClassReaderImpl
case TAG_STRING -> AbstractPoolEntry.StringEntryImpl.class;
case TAG_FIELDREF -> AbstractPoolEntry.FieldRefEntryImpl.class;
case TAG_METHODREF -> AbstractPoolEntry.MethodRefEntryImpl.class;
case TAG_INTERFACEMETHODREF -> AbstractPoolEntry.InterfaceMethodRefEntryImpl.class;
case TAG_NAMEANDTYPE -> AbstractPoolEntry.NameAndTypeEntryImpl.class;
case TAG_METHODHANDLE -> AbstractPoolEntry.MethodHandleEntryImpl.class;
case TAG_METHODTYPE -> AbstractPoolEntry.MethodTypeEntryImpl.class;
case TAG_CONSTANTDYNAMIC -> AbstractPoolEntry.ConstantDynamicEntryImpl.class;
case TAG_INVOKEDYNAMIC -> AbstractPoolEntry.InvokeDynamicEntryImpl.class;
case TAG_INTERFACE_METHODREF -> AbstractPoolEntry.InterfaceMethodRefEntryImpl.class;
case TAG_NAME_AND_TYPE -> AbstractPoolEntry.NameAndTypeEntryImpl.class;
case TAG_METHOD_HANDLE -> AbstractPoolEntry.MethodHandleEntryImpl.class;
case TAG_METHOD_TYPE -> AbstractPoolEntry.MethodTypeEntryImpl.class;
case TAG_DYNAMIC -> AbstractPoolEntry.ConstantDynamicEntryImpl.class;
case TAG_INVOKE_DYNAMIC -> AbstractPoolEntry.InvokeDynamicEntryImpl.class;
case TAG_MODULE -> AbstractPoolEntry.ModuleEntryImpl.class;
case TAG_PACKAGE -> AbstractPoolEntry.PackageEntryImpl.class;
default -> null;
@ -402,15 +386,15 @@ public final class ClassReaderImpl
readEntry(q + 2, AbstractPoolEntry.NameAndTypeEntryImpl.class));
case TAG_METHODREF -> new AbstractPoolEntry.MethodRefEntryImpl(this, index, readEntry(q, AbstractPoolEntry.ClassEntryImpl.class),
readEntry(q + 2, AbstractPoolEntry.NameAndTypeEntryImpl.class));
case TAG_INTERFACEMETHODREF -> new AbstractPoolEntry.InterfaceMethodRefEntryImpl(this, index, readEntry(q, AbstractPoolEntry.ClassEntryImpl.class),
case TAG_INTERFACE_METHODREF -> new AbstractPoolEntry.InterfaceMethodRefEntryImpl(this, index, readEntry(q, AbstractPoolEntry.ClassEntryImpl.class),
readEntry(q + 2, AbstractPoolEntry.NameAndTypeEntryImpl.class));
case TAG_NAMEANDTYPE -> new AbstractPoolEntry.NameAndTypeEntryImpl(this, index, readEntry(q, AbstractPoolEntry.Utf8EntryImpl.class),
case TAG_NAME_AND_TYPE -> new AbstractPoolEntry.NameAndTypeEntryImpl(this, index, readEntry(q, AbstractPoolEntry.Utf8EntryImpl.class),
readEntry(q + 2, AbstractPoolEntry.Utf8EntryImpl.class));
case TAG_METHODHANDLE -> new AbstractPoolEntry.MethodHandleEntryImpl(this, index, readU1(q),
case TAG_METHOD_HANDLE -> new AbstractPoolEntry.MethodHandleEntryImpl(this, index, readU1(q),
readEntry(q + 1, AbstractPoolEntry.AbstractMemberRefEntry.class));
case TAG_METHODTYPE -> new AbstractPoolEntry.MethodTypeEntryImpl(this, index, readEntry(q, AbstractPoolEntry.Utf8EntryImpl.class));
case TAG_CONSTANTDYNAMIC -> new AbstractPoolEntry.ConstantDynamicEntryImpl(this, index, readU2(q), readEntry(q + 2, AbstractPoolEntry.NameAndTypeEntryImpl.class));
case TAG_INVOKEDYNAMIC -> new AbstractPoolEntry.InvokeDynamicEntryImpl(this, index, readU2(q), readEntry(q + 2, AbstractPoolEntry.NameAndTypeEntryImpl.class));
case TAG_METHOD_TYPE -> new AbstractPoolEntry.MethodTypeEntryImpl(this, index, readEntry(q, AbstractPoolEntry.Utf8EntryImpl.class));
case TAG_DYNAMIC -> new AbstractPoolEntry.ConstantDynamicEntryImpl(this, index, readU2(q), readEntry(q + 2, AbstractPoolEntry.NameAndTypeEntryImpl.class));
case TAG_INVOKE_DYNAMIC -> new AbstractPoolEntry.InvokeDynamicEntryImpl(this, index, readU2(q), readEntry(q + 2, AbstractPoolEntry.NameAndTypeEntryImpl.class));
case TAG_MODULE -> new AbstractPoolEntry.ModuleEntryImpl(this, index, readEntry(q, AbstractPoolEntry.Utf8EntryImpl.class));
case TAG_PACKAGE -> new AbstractPoolEntry.PackageEntryImpl(this, index, readEntry(q, AbstractPoolEntry.Utf8EntryImpl.class));
default -> throw new ConstantPoolException(

View File

@ -39,7 +39,7 @@ import java.lang.classfile.attribute.StackMapTableAttribute;
import java.lang.classfile.constantpool.ClassEntry;
import java.lang.classfile.instruction.*;
import static java.lang.classfile.ClassFile.*;
import static jdk.internal.classfile.impl.RawBytecodeHelper.*;
public final class CodeImpl
extends BoundAttribute.BoundCodeAttribute

View File

@ -52,6 +52,8 @@ public final class DirectClassBuilder
extends AbstractDirectBuilder<ClassModel>
implements ClassBuilder {
/** The value of default class access flags */
static final int DEFAULT_CLASS_FLAGS = ClassFile.ACC_PUBLIC;
final ClassEntry thisClassEntry;
private final List<Util.Writable> fields = new ArrayList<>();
private final List<Util.Writable> methods = new ArrayList<>();
@ -67,7 +69,7 @@ public final class DirectClassBuilder
ClassEntry thisClass) {
super(constantPool, context);
this.thisClassEntry = AbstractPoolEntry.maybeClone(constantPool, thisClass);
this.flags = ClassFile.DEFAULT_CLASS_FLAGS;
this.flags = DEFAULT_CLASS_FLAGS;
this.superclassEntry = null;
this.interfaceEntries = Collections.emptyList();
this.majorVersion = ClassFile.latestMajorVersion();

View File

@ -489,9 +489,11 @@ public final class DirectCodeBuilder
// Instruction writing
public void writeBytecode(Opcode opcode) {
if (opcode.isWide())
bytecodesBufWriter.writeU1(ClassFile.WIDE);
bytecodesBufWriter.writeU1(opcode.bytecode() & 0xFF);
if (opcode.isWide()) {
bytecodesBufWriter.writeU2(opcode.bytecode());
} else {
bytecodesBufWriter.writeU1(opcode.bytecode());
}
}
public void writeLocalVar(Opcode opcode, int localVar) {

View File

@ -32,8 +32,6 @@ import jdk.internal.misc.Unsafe;
import jdk.internal.util.Preconditions;
import jdk.internal.vm.annotation.Stable;
import static java.lang.classfile.ClassFile.*;
public final class RawBytecodeHelper {
public static final BiFunction<String, List<Number>, IllegalArgumentException>
@ -43,6 +41,210 @@ public final class RawBytecodeHelper {
return new IllegalArgumentException(s);
}
});
public static final int
ILLEGAL = -1,
NOP = 0,
ACONST_NULL = 1,
ICONST_M1 = 2,
ICONST_0 = 3,
ICONST_1 = 4,
ICONST_2 = 5,
ICONST_3 = 6,
ICONST_4 = 7,
ICONST_5 = 8,
LCONST_0 = 9,
LCONST_1 = 10,
FCONST_0 = 11,
FCONST_1 = 12,
FCONST_2 = 13,
DCONST_0 = 14,
DCONST_1 = 15,
BIPUSH = 16,
SIPUSH = 17,
LDC = 18,
LDC_W = 19,
LDC2_W = 20,
ILOAD = 21,
LLOAD = 22,
FLOAD = 23,
DLOAD = 24,
ALOAD = 25,
ILOAD_0 = 26,
ILOAD_1 = 27,
ILOAD_2 = 28,
ILOAD_3 = 29,
LLOAD_0 = 30,
LLOAD_1 = 31,
LLOAD_2 = 32,
LLOAD_3 = 33,
FLOAD_0 = 34,
FLOAD_1 = 35,
FLOAD_2 = 36,
FLOAD_3 = 37,
DLOAD_0 = 38,
DLOAD_1 = 39,
DLOAD_2 = 40,
DLOAD_3 = 41,
ALOAD_0 = 42,
ALOAD_1 = 43,
ALOAD_2 = 44,
ALOAD_3 = 45,
IALOAD = 46,
LALOAD = 47,
FALOAD = 48,
DALOAD = 49,
AALOAD = 50,
BALOAD = 51,
CALOAD = 52,
SALOAD = 53,
ISTORE = 54,
LSTORE = 55,
FSTORE = 56,
DSTORE = 57,
ASTORE = 58,
ISTORE_0 = 59,
ISTORE_1 = 60,
ISTORE_2 = 61,
ISTORE_3 = 62,
LSTORE_0 = 63,
LSTORE_1 = 64,
LSTORE_2 = 65,
LSTORE_3 = 66,
FSTORE_0 = 67,
FSTORE_1 = 68,
FSTORE_2 = 69,
FSTORE_3 = 70,
DSTORE_0 = 71,
DSTORE_1 = 72,
DSTORE_2 = 73,
DSTORE_3 = 74,
ASTORE_0 = 75,
ASTORE_1 = 76,
ASTORE_2 = 77,
ASTORE_3 = 78,
IASTORE = 79,
LASTORE = 80,
FASTORE = 81,
DASTORE = 82,
AASTORE = 83,
BASTORE = 84,
CASTORE = 85,
SASTORE = 86,
POP = 87,
POP2 = 88,
DUP = 89,
DUP_X1 = 90,
DUP_X2 = 91,
DUP2 = 92,
DUP2_X1 = 93,
DUP2_X2 = 94,
SWAP = 95,
IADD = 96,
LADD = 97,
FADD = 98,
DADD = 99,
ISUB = 100,
LSUB = 101,
FSUB = 102,
DSUB = 103,
IMUL = 104,
LMUL = 105,
FMUL = 106,
DMUL = 107,
IDIV = 108,
LDIV = 109,
FDIV = 110,
DDIV = 111,
IREM = 112,
LREM = 113,
FREM = 114,
DREM = 115,
INEG = 116,
LNEG = 117,
FNEG = 118,
DNEG = 119,
ISHL = 120,
LSHL = 121,
ISHR = 122,
LSHR = 123,
IUSHR = 124,
LUSHR = 125,
IAND = 126,
LAND = 127,
IOR = 128,
LOR = 129,
IXOR = 130,
LXOR = 131,
IINC = 132,
I2L = 133,
I2F = 134,
I2D = 135,
L2I = 136,
L2F = 137,
L2D = 138,
F2I = 139,
F2L = 140,
F2D = 141,
D2I = 142,
D2L = 143,
D2F = 144,
I2B = 145,
I2C = 146,
I2S = 147,
LCMP = 148,
FCMPL = 149,
FCMPG = 150,
DCMPL = 151,
DCMPG = 152,
IFEQ = 153,
IFNE = 154,
IFLT = 155,
IFGE = 156,
IFGT = 157,
IFLE = 158,
IF_ICMPEQ = 159,
IF_ICMPNE = 160,
IF_ICMPLT = 161,
IF_ICMPGE = 162,
IF_ICMPGT = 163,
IF_ICMPLE = 164,
IF_ACMPEQ = 165,
IF_ACMPNE = 166,
GOTO = 167,
JSR = 168,
RET = 169,
TABLESWITCH = 170,
LOOKUPSWITCH = 171,
IRETURN = 172,
LRETURN = 173,
FRETURN = 174,
DRETURN = 175,
ARETURN = 176,
RETURN = 177,
GETSTATIC = 178,
PUTSTATIC = 179,
GETFIELD = 180,
PUTFIELD = 181,
INVOKEVIRTUAL = 182,
INVOKESPECIAL = 183,
INVOKESTATIC = 184,
INVOKEINTERFACE = 185,
INVOKEDYNAMIC = 186,
NEW = 187,
NEWARRAY = 188,
ANEWARRAY = 189,
ARRAYLENGTH = 190,
ATHROW = 191,
CHECKCAST = 192,
INSTANCEOF = 193,
MONITORENTER = 194,
MONITOREXIT = 195,
WIDE = 196,
MULTIANEWARRAY = 197,
IFNULL = 198,
IFNONNULL = 199,
GOTO_W = 200,
JSR_W = 201;
public record CodeRange(byte[] array, int length) {
public RawBytecodeHelper start() {
@ -50,8 +252,6 @@ public final class RawBytecodeHelper {
}
}
public static final int ILLEGAL = -1;
/**
* The length of opcodes, or -1 for no fixed length.
* This is generated as if:

View File

@ -31,7 +31,6 @@ import java.util.List;
import java.lang.classfile.Attributes;
import java.lang.classfile.ClassReader;
import java.lang.classfile.ClassFile;
import java.lang.classfile.BootstrapMethodEntry;
import java.lang.classfile.attribute.BootstrapMethodsAttribute;
import java.lang.classfile.constantpool.*;
@ -39,22 +38,7 @@ import java.util.Objects;
import jdk.internal.constant.ConstantUtils;
import static java.lang.classfile.ClassFile.TAG_CLASS;
import static java.lang.classfile.ClassFile.TAG_CONSTANTDYNAMIC;
import static java.lang.classfile.ClassFile.TAG_DOUBLE;
import static java.lang.classfile.ClassFile.TAG_FIELDREF;
import static java.lang.classfile.ClassFile.TAG_FLOAT;
import static java.lang.classfile.ClassFile.TAG_INTEGER;
import static java.lang.classfile.ClassFile.TAG_INTERFACEMETHODREF;
import static java.lang.classfile.ClassFile.TAG_INVOKEDYNAMIC;
import static java.lang.classfile.ClassFile.TAG_LONG;
import static java.lang.classfile.ClassFile.TAG_METHODHANDLE;
import static java.lang.classfile.ClassFile.TAG_METHODREF;
import static java.lang.classfile.ClassFile.TAG_METHODTYPE;
import static java.lang.classfile.ClassFile.TAG_MODULE;
import static java.lang.classfile.ClassFile.TAG_NAMEANDTYPE;
import static java.lang.classfile.ClassFile.TAG_PACKAGE;
import static java.lang.classfile.ClassFile.TAG_STRING;
import static java.lang.classfile.constantpool.PoolEntry.*;
public final class SplitConstantPool implements ConstantPoolBuilder {
@ -371,7 +355,7 @@ public final class SplitConstantPool implements ConstantPoolBuilder {
for (int token = map.firstToken(hash); token != -1;
token = map.nextToken(hash, token)) {
PoolEntry e = entryByIndex(map.getIndexByToken(token));
if (e.tag() == ClassFile.TAG_UTF8
if (e.tag() == TAG_UTF8
&& e instanceof AbstractPoolEntry.Utf8EntryImpl ce
&& target.equals(ce.stringValue()))
return ce;
@ -387,7 +371,7 @@ public final class SplitConstantPool implements ConstantPoolBuilder {
EntryMap map = map();
for (int token = map.firstToken(hash); token != -1; token = map.nextToken(hash, token)) {
PoolEntry e = entryByIndex(map.getIndexByToken(token));
if (e.tag() == ClassFile.TAG_UTF8
if (e.tag() == TAG_UTF8
&& e instanceof AbstractPoolEntry.Utf8EntryImpl ce
&& target.equalsUtf8(ce))
return ce;
@ -404,7 +388,7 @@ public final class SplitConstantPool implements ConstantPoolBuilder {
while (true) {
for (int token = map.firstToken(hash); token != -1; token = map.nextToken(hash, token)) {
PoolEntry e = entryByIndex(map.getIndexByToken(token));
if (e.tag() == ClassFile.TAG_UTF8
if (e.tag() == TAG_UTF8
&& e instanceof AbstractPoolEntry.Utf8EntryImpl ce
&& ce.equalsRegion(target, start, end))
return ce;
@ -471,7 +455,7 @@ public final class SplitConstantPool implements ConstantPoolBuilder {
EntryMap map = map();
for (int token = map.firstToken(hash); token != -1; token = map.nextToken(hash, token)) {
PoolEntry e = entryByIndex(map.getIndexByToken(token));
if (e.tag() == ClassFile.TAG_CLASS
if (e.tag() == TAG_CLASS
&& e instanceof AbstractPoolEntry.ClassEntryImpl ce
&& ce.ref1.equalsUtf8(utf8))
return ce;
@ -567,7 +551,7 @@ public final class SplitConstantPool implements ConstantPoolBuilder {
public AbstractPoolEntry.NameAndTypeEntryImpl nameAndTypeEntry(Utf8Entry nameEntry, Utf8Entry typeEntry) {
AbstractPoolEntry.Utf8EntryImpl ne = maybeCloneUtf8Entry(nameEntry);
AbstractPoolEntry.Utf8EntryImpl te = maybeCloneUtf8Entry(typeEntry);
var e = (AbstractPoolEntry.NameAndTypeEntryImpl) findEntry(TAG_NAMEANDTYPE, ne, te);
var e = (AbstractPoolEntry.NameAndTypeEntryImpl) findEntry(TAG_NAME_AND_TYPE, ne, te);
return e == null ? internalAdd(new AbstractPoolEntry.NameAndTypeEntryImpl(this, size, ne, te)) : e;
}
@ -591,7 +575,7 @@ public final class SplitConstantPool implements ConstantPoolBuilder {
public InterfaceMethodRefEntry interfaceMethodRefEntry(ClassEntry owner, NameAndTypeEntry nameAndType) {
var oe = AbstractPoolEntry.maybeClone(this, (AbstractPoolEntry.ClassEntryImpl) owner);
var ne = AbstractPoolEntry.maybeClone(this, (AbstractPoolEntry.NameAndTypeEntryImpl) nameAndType);
var e = (AbstractPoolEntry.InterfaceMethodRefEntryImpl) findEntry(TAG_INTERFACEMETHODREF, oe, ne);
var e = (AbstractPoolEntry.InterfaceMethodRefEntryImpl) findEntry(TAG_INTERFACE_METHODREF, oe, ne);
return e == null ? internalAdd(new AbstractPoolEntry.InterfaceMethodRefEntryImpl(this, size, oe, ne)) : e;
}
@ -603,18 +587,18 @@ public final class SplitConstantPool implements ConstantPoolBuilder {
@Override
public MethodTypeEntry methodTypeEntry(Utf8Entry descriptor) {
AbstractPoolEntry.Utf8EntryImpl de = maybeCloneUtf8Entry(descriptor);
var e = (AbstractPoolEntry.MethodTypeEntryImpl) findEntry(TAG_METHODTYPE, de);
var e = (AbstractPoolEntry.MethodTypeEntryImpl) findEntry(TAG_METHOD_TYPE, de);
return e == null ? internalAdd(new AbstractPoolEntry.MethodTypeEntryImpl(this, size, de)) : e;
}
@Override
public MethodHandleEntry methodHandleEntry(int refKind, MemberRefEntry reference) {
reference = AbstractPoolEntry.maybeClone(this, reference);
int hash = AbstractPoolEntry.hash2(TAG_METHODHANDLE, refKind, reference.index());
int hash = AbstractPoolEntry.hash2(TAG_METHOD_HANDLE, refKind, reference.index());
EntryMap map1 = map();
for (int token = map1.firstToken(hash); token != -1; token = map1.nextToken(hash, token)) {
PoolEntry e = entryByIndex(map1.getIndexByToken(token));
if (e.tag() == TAG_METHODHANDLE
if (e.tag() == TAG_METHOD_HANDLE
&& e instanceof AbstractPoolEntry.MethodHandleEntryImpl ce
&& ce.kind() == refKind && ce.reference() == reference)
return ce;
@ -634,12 +618,12 @@ public final class SplitConstantPool implements ConstantPoolBuilder {
bootstrapMethodEntry = bsmEntry(bootstrapMethodEntry.bootstrapMethod(),
bootstrapMethodEntry.arguments());
nameAndType = AbstractPoolEntry.maybeClone(this, nameAndType);
int hash = AbstractPoolEntry.hash2(TAG_INVOKEDYNAMIC,
int hash = AbstractPoolEntry.hash2(TAG_INVOKE_DYNAMIC,
bootstrapMethodEntry.bsmIndex(), nameAndType.index());
EntryMap map1 = map();
for (int token = map1.firstToken(hash); token != -1; token = map1.nextToken(hash, token)) {
PoolEntry e = entryByIndex(map1.getIndexByToken(token));
if (e.tag() == TAG_INVOKEDYNAMIC
if (e.tag() == TAG_INVOKE_DYNAMIC
&& e instanceof AbstractPoolEntry.InvokeDynamicEntryImpl ce
&& ce.bootstrap() == bootstrapMethodEntry && ce.nameAndType() == nameAndType)
return ce;
@ -664,12 +648,12 @@ public final class SplitConstantPool implements ConstantPoolBuilder {
bootstrapMethodEntry = bsmEntry(bootstrapMethodEntry.bootstrapMethod(),
bootstrapMethodEntry.arguments());
nameAndType = AbstractPoolEntry.maybeClone(this, nameAndType);
int hash = AbstractPoolEntry.hash2(TAG_CONSTANTDYNAMIC,
int hash = AbstractPoolEntry.hash2(TAG_DYNAMIC,
bootstrapMethodEntry.bsmIndex(), nameAndType.index());
EntryMap map1 = map();
for (int token = map1.firstToken(hash); token != -1; token = map1.nextToken(hash, token)) {
PoolEntry e = entryByIndex(map1.getIndexByToken(token));
if (e.tag() == TAG_CONSTANTDYNAMIC
if (e.tag() == TAG_DYNAMIC
&& e instanceof AbstractPoolEntry.ConstantDynamicEntryImpl ce
&& ce.bootstrap() == bootstrapMethodEntry && ce.nameAndType() == nameAndType)
return ce;

View File

@ -41,6 +41,8 @@ import java.util.Queue;
import java.util.stream.Collectors;
import static java.lang.classfile.ClassFile.*;
import static java.lang.classfile.constantpool.PoolEntry.*;
import static jdk.internal.classfile.impl.RawBytecodeHelper.*;
public final class StackCounter {
@ -120,8 +122,8 @@ public final class StackCounter {
for (var smfi : smta.entries()) {
int frameStack = smfi.stack().size();
for (var vti : smfi.stack()) {
if (vti == StackMapFrameInfo.SimpleVerificationTypeInfo.ITEM_LONG
|| vti == StackMapFrameInfo.SimpleVerificationTypeInfo.ITEM_DOUBLE) frameStack++;
if (vti == StackMapFrameInfo.SimpleVerificationTypeInfo.LONG
|| vti == StackMapFrameInfo.SimpleVerificationTypeInfo.DOUBLE) frameStack++;
}
if (maxStack < frameStack) maxStack = frameStack;
targets.add(new Target(labelContext.labelToBci(smfi.target()), frameStack));
@ -376,11 +378,11 @@ public final class StackCounter {
private void processLdc(int index) {
switch (cp.entryByIndex(index).tag()) {
case TAG_UTF8, TAG_STRING, TAG_CLASS, TAG_INTEGER, TAG_FLOAT, TAG_METHODHANDLE, TAG_METHODTYPE ->
case TAG_UTF8, TAG_STRING, TAG_CLASS, TAG_INTEGER, TAG_FLOAT, TAG_METHOD_HANDLE, TAG_METHOD_TYPE ->
addStackSlot(+1);
case TAG_DOUBLE, TAG_LONG ->
addStackSlot(+2);
case TAG_CONSTANTDYNAMIC ->
case TAG_DYNAMIC ->
addStackSlot(cp.entryByIndex(index, ConstantDynamicEntry.class).typeKind().slotSize());
default ->
throw error("CP entry #%d %s is not loadable constant".formatted(index, cp.entryByIndex(index).tag()));

View File

@ -41,6 +41,7 @@ import java.util.List;
import java.util.Objects;
import static java.lang.classfile.ClassFile.*;
import static java.lang.classfile.attribute.StackMapFrameInfo.VerificationTypeInfo.*;
public class StackMapDecoder {
@ -75,7 +76,7 @@ public class StackMapDecoder {
if (!isStatic) {
vtis = new VerificationTypeInfo[methodType.parameterCount() + 1];
if ("<init>".equals(methodName) && !ConstantDescs.CD_Object.equals(thisClass.asSymbol())) {
vtis[i++] = SimpleVerificationTypeInfo.ITEM_UNINITIALIZED_THIS;
vtis[i++] = SimpleVerificationTypeInfo.UNINITIALIZED_THIS;
} else {
vtis[i++] = new StackMapDecoder.ObjectVerificationTypeInfoImpl(thisClass);
}
@ -85,10 +86,10 @@ public class StackMapDecoder {
for (int pi = 0; pi < methodType.parameterCount(); pi++) {
var arg = methodType.parameterType(pi);
vtis[i++] = switch (arg.descriptorString().charAt(0)) {
case 'I', 'S', 'C' ,'B', 'Z' -> SimpleVerificationTypeInfo.ITEM_INTEGER;
case 'J' -> SimpleVerificationTypeInfo.ITEM_LONG;
case 'F' -> SimpleVerificationTypeInfo.ITEM_FLOAT;
case 'D' -> SimpleVerificationTypeInfo.ITEM_DOUBLE;
case 'I', 'S', 'C' ,'B', 'Z' -> SimpleVerificationTypeInfo.INTEGER;
case 'J' -> SimpleVerificationTypeInfo.LONG;
case 'F' -> SimpleVerificationTypeInfo.FLOAT;
case 'D' -> SimpleVerificationTypeInfo.DOUBLE;
case 'V' -> throw new IllegalArgumentException("Illegal method argument type: " + arg);
default -> new StackMapDecoder.ObjectVerificationTypeInfoImpl(TemporaryConstantPool.INSTANCE.classEntry(arg));
};
@ -169,11 +170,12 @@ public class StackMapDecoder {
private static void writeTypeInfo(BufWriterImpl bw, VerificationTypeInfo vti) {
bw.writeU1(vti.tag());
switch (vti.tag()) {
case VT_TOP, VT_INTEGER, VT_FLOAT, VT_DOUBLE, VT_LONG, VT_NULL, VT_UNINITIALIZED_THIS ->
case ITEM_TOP, ITEM_INTEGER, ITEM_FLOAT, ITEM_DOUBLE, ITEM_LONG, ITEM_NULL,
ITEM_UNINITIALIZED_THIS ->
{}
case VT_OBJECT ->
case ITEM_OBJECT ->
bw.writeIndex(((ObjectVerificationTypeInfo)vti).className());
case VT_UNINITIALIZED ->
case ITEM_UNINITIALIZED ->
bw.writeU2(bw.labelContext().labelToBci(((UninitializedVerificationTypeInfo)vti).newTarget()));
default -> throw new IllegalArgumentException("Invalid verification type tag: " + vti.tag());
}
@ -232,15 +234,15 @@ public class StackMapDecoder {
private VerificationTypeInfo readVerificationTypeInfo() {
int tag = classReader.readU1(p++);
return switch (tag) {
case VT_TOP -> SimpleVerificationTypeInfo.ITEM_TOP;
case VT_INTEGER -> SimpleVerificationTypeInfo.ITEM_INTEGER;
case VT_FLOAT -> SimpleVerificationTypeInfo.ITEM_FLOAT;
case VT_DOUBLE -> SimpleVerificationTypeInfo.ITEM_DOUBLE;
case VT_LONG -> SimpleVerificationTypeInfo.ITEM_LONG;
case VT_NULL -> SimpleVerificationTypeInfo.ITEM_NULL;
case VT_UNINITIALIZED_THIS -> SimpleVerificationTypeInfo.ITEM_UNINITIALIZED_THIS;
case VT_OBJECT -> new ObjectVerificationTypeInfoImpl(classReader.entryByIndex(u2(), ClassEntry.class));
case VT_UNINITIALIZED -> new UninitializedVerificationTypeInfoImpl(ctx.getLabel(u2()));
case ITEM_TOP -> SimpleVerificationTypeInfo.TOP;
case ITEM_INTEGER -> SimpleVerificationTypeInfo.INTEGER;
case ITEM_FLOAT -> SimpleVerificationTypeInfo.FLOAT;
case ITEM_DOUBLE -> SimpleVerificationTypeInfo.DOUBLE;
case ITEM_LONG -> SimpleVerificationTypeInfo.LONG;
case ITEM_NULL -> SimpleVerificationTypeInfo.NULL;
case ITEM_UNINITIALIZED_THIS -> SimpleVerificationTypeInfo.UNINITIALIZED_THIS;
case ITEM_OBJECT -> new ObjectVerificationTypeInfoImpl(classReader.entryByIndex(u2(), ClassEntry.class));
case ITEM_UNINITIALIZED -> new UninitializedVerificationTypeInfoImpl(ctx.getLabel(u2()));
default -> throw new IllegalArgumentException("Invalid verification type tag: " + tag);
};
}
@ -249,7 +251,7 @@ public class StackMapDecoder {
ClassEntry className) implements ObjectVerificationTypeInfo {
@Override
public int tag() { return VT_OBJECT; }
public int tag() { return ITEM_OBJECT; }
@Override
public boolean equals(Object o) {
@ -274,7 +276,7 @@ public class StackMapDecoder {
public static record UninitializedVerificationTypeInfoImpl(Label newTarget) implements UninitializedVerificationTypeInfo {
@Override
public int tag() { return VT_UNINITIALIZED; }
public int tag() { return ITEM_UNINITIALIZED; }
@Override
public String toString() {

View File

@ -28,7 +28,6 @@ package jdk.internal.classfile.impl;
import java.lang.classfile.Attribute;
import java.lang.classfile.Attributes;
import java.lang.classfile.BufWriter;
import java.lang.classfile.ClassFile;
import java.lang.classfile.Label;
import java.lang.classfile.attribute.StackMapTableAttribute;
import java.lang.classfile.constantpool.ClassEntry;
@ -48,7 +47,9 @@ import jdk.internal.constant.ReferenceClassDescImpl;
import jdk.internal.util.Preconditions;
import static java.lang.classfile.ClassFile.*;
import static java.lang.classfile.constantpool.PoolEntry.*;
import static java.lang.constant.ConstantDescs.*;
import static jdk.internal.classfile.impl.RawBytecodeHelper.*;
/**
* StackMapGenerator is responsible for stack map frames generation.
@ -696,11 +697,11 @@ public final class StackMapGenerator {
currentFrame.pushStack(Type.DOUBLE_TYPE, Type.DOUBLE2_TYPE);
case TAG_LONG ->
currentFrame.pushStack(Type.LONG_TYPE, Type.LONG2_TYPE);
case TAG_METHODHANDLE ->
case TAG_METHOD_HANDLE ->
currentFrame.pushStack(Type.METHOD_HANDLE_TYPE);
case TAG_METHODTYPE ->
case TAG_METHOD_TYPE ->
currentFrame.pushStack(Type.METHOD_TYPE);
case TAG_CONSTANTDYNAMIC ->
case TAG_DYNAMIC ->
currentFrame.pushStack(cp.entryByIndex(index, ConstantDynamicEntry.class).asSymbol().constantType());
default ->
throw generatorError("CP entry #%d %s is not loadable constant".formatted(index, cp.entryByIndex(index).tag()));

View File

@ -28,7 +28,7 @@ import java.util.List;
import java.util.Objects;
import java.lang.classfile.Label;
import java.lang.classfile.TypeAnnotation.*;
import static java.lang.classfile.ClassFile.*;
import static java.util.Objects.requireNonNull;
public final class TargetInfoImpl {
@ -47,7 +47,7 @@ public final class TargetInfoImpl {
implements TypeParameterTarget {
public TypeParameterTargetImpl(TargetType targetType, int typeParameterIndex) {
this.targetType = checkValid(targetType, TAT_CLASS_TYPE_PARAMETER, TAT_METHOD_TYPE_PARAMETER);
this.targetType = checkValid(targetType, TARGET_CLASS_TYPE_PARAMETER, TARGET_METHOD_TYPE_PARAMETER);
this.typeParameterIndex = typeParameterIndex;
}
}
@ -63,7 +63,7 @@ public final class TargetInfoImpl {
implements TypeParameterBoundTarget {
public TypeParameterBoundTargetImpl(TargetType targetType, int typeParameterIndex, int boundIndex) {
this.targetType = checkValid(targetType, TAT_CLASS_TYPE_PARAMETER_BOUND, TAT_METHOD_TYPE_PARAMETER_BOUND);
this.targetType = checkValid(targetType, TARGET_CLASS_TYPE_PARAMETER_BOUND, TARGET_METHOD_TYPE_PARAMETER_BOUND);
this.typeParameterIndex = typeParameterIndex;
this.boundIndex = boundIndex;
}
@ -72,7 +72,7 @@ public final class TargetInfoImpl {
public record EmptyTargetImpl(TargetType targetType) implements EmptyTarget {
public EmptyTargetImpl(TargetType targetType) {
this.targetType = checkValid(targetType, TAT_FIELD, TAT_METHOD_RECEIVER);
this.targetType = checkValid(targetType, TARGET_FIELD, TARGET_METHOD_RECEIVER);
}
}
@ -94,7 +94,7 @@ public final class TargetInfoImpl {
implements LocalVarTarget {
public LocalVarTargetImpl(TargetType targetType, List<LocalVarTargetInfo> table) {
this.targetType = checkValid(targetType, TAT_LOCAL_VARIABLE, TAT_RESOURCE_VARIABLE);
this.targetType = checkValid(targetType, TARGET_LOCAL_VARIABLE, TARGET_RESOURCE_VARIABLE);
this.table = List.copyOf(table);
}
@Override
@ -122,7 +122,7 @@ public final class TargetInfoImpl {
public record OffsetTargetImpl(TargetType targetType, Label target) implements OffsetTarget {
public OffsetTargetImpl(TargetType targetType, Label target) {
this.targetType = checkValid(targetType, TAT_INSTANCEOF, TAT_METHOD_REFERENCE);
this.targetType = checkValid(targetType, TARGET_INSTANCEOF, TARGET_METHOD_REFERENCE);
this.target = requireNonNull(target);
}
}
@ -131,7 +131,7 @@ public final class TargetInfoImpl {
implements TypeArgumentTarget {
public TypeArgumentTargetImpl(TargetType targetType, Label target, int typeArgumentIndex) {
this.targetType = checkValid(targetType, TAT_CAST, TAT_METHOD_REFERENCE_TYPE_ARGUMENT);
this.targetType = checkValid(targetType, TARGET_CAST, TARGET_METHOD_REFERENCE_TYPE_ARGUMENT);
this.target = requireNonNull(target);
this.typeArgumentIndex = typeArgumentIndex;
}

View File

@ -24,7 +24,7 @@
*/
package jdk.internal.classfile.impl.verifier;
import java.lang.classfile.ClassFile;
import static jdk.internal.classfile.impl.RawBytecodeHelper.*;
import jdk.internal.classfile.impl.verifier.VerificationSignature.BasicType;
import static jdk.internal.classfile.impl.verifier.VerificationSignature.BasicType.*;
@ -83,7 +83,7 @@ final class VerificationBytecodes {
}
static boolean is_store_into_local(int code) {
return (ClassFile.ISTORE <= code && code <= ClassFile.ASTORE_3);
return (ISTORE <= code && code <= ASTORE_3);
}
static final int _lengths[] = new int[number_of_codes];
@ -104,244 +104,244 @@ final class VerificationBytecodes {
}
static {
def(ClassFile.NOP, "nop", "b", null, T_VOID, 0);
def(ClassFile.ACONST_NULL, "aconst_null", "b", null, T_OBJECT, 1);
def(ClassFile.ICONST_M1, "iconst_m1", "b", null, T_INT, 1);
def(ClassFile.ICONST_0, "iconst_0", "b", null, T_INT, 1);
def(ClassFile.ICONST_1, "iconst_1", "b", null, T_INT, 1);
def(ClassFile.ICONST_2, "iconst_2", "b", null, T_INT, 1);
def(ClassFile.ICONST_3, "iconst_3", "b", null, T_INT, 1);
def(ClassFile.ICONST_4, "iconst_4", "b", null, T_INT, 1);
def(ClassFile.ICONST_5, "iconst_5", "b", null, T_INT, 1);
def(ClassFile.LCONST_0, "lconst_0", "b", null, T_LONG, 2);
def(ClassFile.LCONST_1, "lconst_1", "b", null, T_LONG, 2);
def(ClassFile.FCONST_0, "fconst_0", "b", null, T_FLOAT, 1);
def(ClassFile.FCONST_1, "fconst_1", "b", null, T_FLOAT, 1);
def(ClassFile.FCONST_2, "fconst_2", "b", null, T_FLOAT, 1);
def(ClassFile.DCONST_0, "dconst_0", "b", null, T_DOUBLE, 2);
def(ClassFile.DCONST_1, "dconst_1", "b", null, T_DOUBLE, 2);
def(ClassFile.BIPUSH, "bipush", "bc", null, T_INT, 1);
def(ClassFile.SIPUSH, "sipush", "bcc", null, T_INT, 1);
def(ClassFile.LDC, "ldc", "bk", null, T_ILLEGAL, 1);
def(ClassFile.LDC_W, "ldc_w", "bkk", null, T_ILLEGAL, 1);
def(ClassFile.LDC2_W, "ldc2_w", "bkk", null, T_ILLEGAL, 2);
def(ClassFile.ILOAD, "iload", "bi", "wbii", T_INT, 1);
def(ClassFile.LLOAD, "lload", "bi", "wbii", T_LONG, 2);
def(ClassFile.FLOAD, "fload", "bi", "wbii", T_FLOAT, 1);
def(ClassFile.DLOAD, "dload", "bi", "wbii", T_DOUBLE, 2);
def(ClassFile.ALOAD, "aload", "bi", "wbii", T_OBJECT, 1);
def(ClassFile.ILOAD_0, "iload_0", "b", null, T_INT, 1);
def(ClassFile.ILOAD_1, "iload_1", "b", null, T_INT, 1);
def(ClassFile.ILOAD_2, "iload_2", "b", null, T_INT, 1);
def(ClassFile.ILOAD_3, "iload_3", "b", null, T_INT, 1);
def(ClassFile.LLOAD_0, "lload_0", "b", null, T_LONG, 2);
def(ClassFile.LLOAD_1, "lload_1", "b", null, T_LONG, 2);
def(ClassFile.LLOAD_2, "lload_2", "b", null, T_LONG, 2);
def(ClassFile.LLOAD_3, "lload_3", "b", null, T_LONG, 2);
def(ClassFile.FLOAD_0, "fload_0", "b", null, T_FLOAT, 1);
def(ClassFile.FLOAD_1, "fload_1", "b", null, T_FLOAT, 1);
def(ClassFile.FLOAD_2, "fload_2", "b", null, T_FLOAT, 1);
def(ClassFile.FLOAD_3, "fload_3", "b", null, T_FLOAT, 1);
def(ClassFile.DLOAD_0, "dload_0", "b", null, T_DOUBLE, 2);
def(ClassFile.DLOAD_1, "dload_1", "b", null, T_DOUBLE, 2);
def(ClassFile.DLOAD_2, "dload_2", "b", null, T_DOUBLE, 2);
def(ClassFile.DLOAD_3, "dload_3", "b", null, T_DOUBLE, 2);
def(ClassFile.ALOAD_0, "aload_0", "b", null, T_OBJECT, 1);
def(ClassFile.ALOAD_1, "aload_1", "b", null, T_OBJECT, 1);
def(ClassFile.ALOAD_2, "aload_2", "b", null, T_OBJECT, 1);
def(ClassFile.ALOAD_3, "aload_3", "b", null, T_OBJECT, 1);
def(ClassFile.IALOAD, "iaload", "b", null, T_INT, -1);
def(ClassFile.LALOAD, "laload", "b", null, T_LONG, 0);
def(ClassFile.FALOAD, "faload", "b", null, T_FLOAT, -1);
def(ClassFile.DALOAD, "daload", "b", null, T_DOUBLE, 0);
def(ClassFile.AALOAD, "aaload", "b", null, T_OBJECT, -1);
def(ClassFile.BALOAD, "baload", "b", null, T_INT, -1);
def(ClassFile.CALOAD, "caload", "b", null, T_INT, -1);
def(ClassFile.SALOAD, "saload", "b", null, T_INT, -1);
def(ClassFile.ISTORE, "istore", "bi", "wbii", T_VOID, -1);
def(ClassFile.LSTORE, "lstore", "bi", "wbii", T_VOID, -2);
def(ClassFile.FSTORE, "fstore", "bi", "wbii", T_VOID, -1);
def(ClassFile.DSTORE, "dstore", "bi", "wbii", T_VOID, -2);
def(ClassFile.ASTORE, "astore", "bi", "wbii", T_VOID, -1);
def(ClassFile.ISTORE_0, "istore_0", "b", null, T_VOID, -1);
def(ClassFile.ISTORE_1, "istore_1", "b", null, T_VOID, -1);
def(ClassFile.ISTORE_2, "istore_2", "b", null, T_VOID, -1);
def(ClassFile.ISTORE_3, "istore_3", "b", null, T_VOID, -1);
def(ClassFile.LSTORE_0, "lstore_0", "b", null, T_VOID, -2);
def(ClassFile.LSTORE_1, "lstore_1", "b", null, T_VOID, -2);
def(ClassFile.LSTORE_2, "lstore_2", "b", null, T_VOID, -2);
def(ClassFile.LSTORE_3, "lstore_3", "b", null, T_VOID, -2);
def(ClassFile.FSTORE_0, "fstore_0", "b", null, T_VOID, -1);
def(ClassFile.FSTORE_1, "fstore_1", "b", null, T_VOID, -1);
def(ClassFile.FSTORE_2, "fstore_2", "b", null, T_VOID, -1);
def(ClassFile.FSTORE_3, "fstore_3", "b", null, T_VOID, -1);
def(ClassFile.DSTORE_0, "dstore_0", "b", null, T_VOID, -2);
def(ClassFile.DSTORE_1, "dstore_1", "b", null, T_VOID, -2);
def(ClassFile.DSTORE_2, "dstore_2", "b", null, T_VOID, -2);
def(ClassFile.DSTORE_3, "dstore_3", "b", null, T_VOID, -2);
def(ClassFile.ASTORE_0, "astore_0", "b", null, T_VOID, -1);
def(ClassFile.ASTORE_1, "astore_1", "b", null, T_VOID, -1);
def(ClassFile.ASTORE_2, "astore_2", "b", null, T_VOID, -1);
def(ClassFile.ASTORE_3, "astore_3", "b", null, T_VOID, -1);
def(ClassFile.IASTORE, "iastore", "b", null, T_VOID, -3);
def(ClassFile.LASTORE, "lastore", "b", null, T_VOID, -4);
def(ClassFile.FASTORE, "fastore", "b", null, T_VOID, -3);
def(ClassFile.DASTORE, "dastore", "b", null, T_VOID, -4);
def(ClassFile.AASTORE, "aastore", "b", null, T_VOID, -3);
def(ClassFile.BASTORE, "bastore", "b", null, T_VOID, -3);
def(ClassFile.CASTORE, "castore", "b", null, T_VOID, -3);
def(ClassFile.SASTORE, "sastore", "b", null, T_VOID, -3);
def(ClassFile.POP, "pop", "b", null, T_VOID, -1);
def(ClassFile.POP2, "pop2", "b", null, T_VOID, -2);
def(ClassFile.DUP, "dup", "b", null, T_VOID, 1);
def(ClassFile.DUP_X1, "dup_x1", "b", null, T_VOID, 1);
def(ClassFile.DUP_X2, "dup_x2", "b", null, T_VOID, 1);
def(ClassFile.DUP2, "dup2", "b", null, T_VOID, 2);
def(ClassFile.DUP2_X1, "dup2_x1", "b", null, T_VOID, 2);
def(ClassFile.DUP2_X2, "dup2_x2", "b", null, T_VOID, 2);
def(ClassFile.SWAP, "swap", "b", null, T_VOID, 0);
def(ClassFile.IADD, "iadd", "b", null, T_INT, -1);
def(ClassFile.LADD, "ladd", "b", null, T_LONG, -2);
def(ClassFile.FADD, "fadd", "b", null, T_FLOAT, -1);
def(ClassFile.DADD, "dadd", "b", null, T_DOUBLE, -2);
def(ClassFile.ISUB, "isub", "b", null, T_INT, -1);
def(ClassFile.LSUB, "lsub", "b", null, T_LONG, -2);
def(ClassFile.FSUB, "fsub", "b", null, T_FLOAT, -1);
def(ClassFile.DSUB, "dsub", "b", null, T_DOUBLE, -2);
def(ClassFile.IMUL, "imul", "b", null, T_INT, -1);
def(ClassFile.LMUL, "lmul", "b", null, T_LONG, -2);
def(ClassFile.FMUL, "fmul", "b", null, T_FLOAT, -1);
def(ClassFile.DMUL, "dmul", "b", null, T_DOUBLE, -2);
def(ClassFile.IDIV, "idiv", "b", null, T_INT, -1);
def(ClassFile.LDIV, "ldiv", "b", null, T_LONG, -2);
def(ClassFile.FDIV, "fdiv", "b", null, T_FLOAT, -1);
def(ClassFile.DDIV, "ddiv", "b", null, T_DOUBLE, -2);
def(ClassFile.IREM, "irem", "b", null, T_INT, -1);
def(ClassFile.LREM, "lrem", "b", null, T_LONG, -2);
def(ClassFile.FREM, "frem", "b", null, T_FLOAT, -1);
def(ClassFile.DREM, "drem", "b", null, T_DOUBLE, -2);
def(ClassFile.INEG, "ineg", "b", null, T_INT, 0);
def(ClassFile.LNEG, "lneg", "b", null, T_LONG, 0);
def(ClassFile.FNEG, "fneg", "b", null, T_FLOAT, 0);
def(ClassFile.DNEG, "dneg", "b", null, T_DOUBLE, 0);
def(ClassFile.ISHL, "ishl", "b", null, T_INT, -1);
def(ClassFile.LSHL, "lshl", "b", null, T_LONG, -1);
def(ClassFile.ISHR, "ishr", "b", null, T_INT, -1);
def(ClassFile.LSHR, "lshr", "b", null, T_LONG, -1);
def(ClassFile.IUSHR, "iushr", "b", null, T_INT, -1);
def(ClassFile.LUSHR, "lushr", "b", null, T_LONG, -1);
def(ClassFile.IAND, "iand", "b", null, T_INT, -1);
def(ClassFile.LAND, "land", "b", null, T_LONG, -2);
def(ClassFile.IOR, "ior", "b", null, T_INT, -1);
def(ClassFile.LOR, "lor", "b", null, T_LONG, -2);
def(ClassFile.IXOR, "ixor", "b", null, T_INT, -1);
def(ClassFile.LXOR, "lxor", "b", null, T_LONG, -2);
def(ClassFile.IINC, "iinc", "bic", "wbiicc", T_VOID, 0);
def(ClassFile.I2L, "i2l", "b", null, T_LONG, 1);
def(ClassFile.I2F, "i2f", "b", null, T_FLOAT, 0);
def(ClassFile.I2D, "i2d", "b", null, T_DOUBLE, 1);
def(ClassFile.L2I, "l2i", "b", null, T_INT, -1);
def(ClassFile.L2F, "l2f", "b", null, T_FLOAT, -1);
def(ClassFile.L2D, "l2d", "b", null, T_DOUBLE, 0);
def(ClassFile.F2I, "f2i", "b", null, T_INT, 0);
def(ClassFile.F2L, "f2l", "b", null, T_LONG, 1);
def(ClassFile.F2D, "f2d", "b", null, T_DOUBLE, 1);
def(ClassFile.D2I, "d2i", "b", null, T_INT, -1);
def(ClassFile.D2L, "d2l", "b", null, T_LONG, 0);
def(ClassFile.D2F, "d2f", "b", null, T_FLOAT, -1);
def(ClassFile.I2B, "i2b", "b", null, T_BYTE, 0);
def(ClassFile.I2C, "i2c", "b", null, T_CHAR, 0);
def(ClassFile.I2S, "i2s", "b", null, T_SHORT, 0);
def(ClassFile.LCMP, "lcmp", "b", null, T_VOID, -3);
def(ClassFile.FCMPL, "fcmpl", "b", null, T_VOID, -1);
def(ClassFile.FCMPG, "fcmpg", "b", null, T_VOID, -1);
def(ClassFile.DCMPL, "dcmpl", "b", null, T_VOID, -3);
def(ClassFile.DCMPG, "dcmpg", "b", null, T_VOID, -3);
def(ClassFile.IFEQ, "ifeq", "boo", null, T_VOID, -1);
def(ClassFile.IFNE, "ifne", "boo", null, T_VOID, -1);
def(ClassFile.IFLT, "iflt", "boo", null, T_VOID, -1);
def(ClassFile.IFGE, "ifge", "boo", null, T_VOID, -1);
def(ClassFile.IFGT, "ifgt", "boo", null, T_VOID, -1);
def(ClassFile.IFLE, "ifle", "boo", null, T_VOID, -1);
def(ClassFile.IF_ICMPEQ, "if_icmpeq", "boo", null, T_VOID, -2);
def(ClassFile.IF_ICMPNE, "if_icmpne", "boo", null, T_VOID, -2);
def(ClassFile.IF_ICMPLT, "if_icmplt", "boo", null, T_VOID, -2);
def(ClassFile.IF_ICMPGE, "if_icmpge", "boo", null, T_VOID, -2);
def(ClassFile.IF_ICMPGT, "if_icmpgt", "boo", null, T_VOID, -2);
def(ClassFile.IF_ICMPLE, "if_icmple", "boo", null, T_VOID, -2);
def(ClassFile.IF_ACMPEQ, "if_acmpeq", "boo", null, T_VOID, -2);
def(ClassFile.IF_ACMPNE, "if_acmpne", "boo", null, T_VOID, -2);
def(ClassFile.GOTO, "goto", "boo", null, T_VOID, 0);
def(ClassFile.JSR, "jsr", "boo", null, T_INT, 0);
def(ClassFile.RET, "ret", "bi", "wbii", T_VOID, 0);
def(ClassFile.TABLESWITCH, "tableswitch", "", null, T_VOID, -1); // may have backward branches
def(ClassFile.LOOKUPSWITCH, "lookupswitch", "", null, T_VOID, -1); // rewriting in interpreter
def(ClassFile.IRETURN, "ireturn", "b", null, T_INT, -1);
def(ClassFile.LRETURN, "lreturn", "b", null, T_LONG, -2);
def(ClassFile.FRETURN, "freturn", "b", null, T_FLOAT, -1);
def(ClassFile.DRETURN, "dreturn", "b", null, T_DOUBLE, -2);
def(ClassFile.ARETURN, "areturn", "b", null, T_OBJECT, -1);
def(ClassFile.RETURN, "return", "b", null, T_VOID, 0);
def(ClassFile.GETSTATIC, "getstatic", "bJJ", null, T_ILLEGAL, 1);
def(ClassFile.PUTSTATIC, "putstatic", "bJJ", null, T_ILLEGAL, -1);
def(ClassFile.GETFIELD, "getfield", "bJJ", null, T_ILLEGAL, 0);
def(ClassFile.PUTFIELD, "putfield", "bJJ", null, T_ILLEGAL, -2);
def(ClassFile.INVOKEVIRTUAL, "invokevirtual", "bJJ", null, T_ILLEGAL, -1);
def(ClassFile.INVOKESPECIAL, "invokespecial", "bJJ", null, T_ILLEGAL, -1);
def(ClassFile.INVOKESTATIC, "invokestatic", "bJJ", null, T_ILLEGAL, 0);
def(ClassFile.INVOKEINTERFACE, "invokeinterface", "bJJ__", null, T_ILLEGAL, -1);
def(ClassFile.INVOKEDYNAMIC, "invokedynamic", "bJJJJ", null, T_ILLEGAL, 0);
def(ClassFile.NEW, "new", "bkk", null, T_OBJECT, 1);
def(ClassFile.NEWARRAY, "newarray", "bc", null, T_OBJECT, 0);
def(ClassFile.ANEWARRAY, "anewarray", "bkk", null, T_OBJECT, 0);
def(ClassFile.ARRAYLENGTH, "arraylength", "b", null, T_VOID, 0);
def(ClassFile.ATHROW, "athrow", "b", null, T_VOID, -1);
def(ClassFile.CHECKCAST, "checkcast", "bkk", null, T_OBJECT, 0);
def(ClassFile.INSTANCEOF, "instanceof", "bkk", null, T_INT, 0);
def(ClassFile.MONITORENTER, "monitorenter", "b", null, T_VOID, -1);
def(ClassFile.MONITOREXIT, "monitorexit", "b", null, T_VOID, -1);
def(ClassFile.WIDE, "wide", "", null, T_VOID, 0);
def(ClassFile.MULTIANEWARRAY, "multianewarray", "bkkc", null, T_OBJECT, 1);
def(ClassFile.IFNULL, "ifnull", "boo", null, T_VOID, -1);
def(ClassFile.IFNONNULL, "ifnonnull", "boo", null, T_VOID, -1);
def(ClassFile.GOTO_W, "goto_w", "boooo", null, T_VOID, 0);
def(ClassFile.JSR_W, "jsr_w", "boooo", null, T_INT, 0);
def(NOP, "nop", "b", null, T_VOID, 0);
def(ACONST_NULL, "aconst_null", "b", null, T_OBJECT, 1);
def(ICONST_M1, "iconst_m1", "b", null, T_INT, 1);
def(ICONST_0, "iconst_0", "b", null, T_INT, 1);
def(ICONST_1, "iconst_1", "b", null, T_INT, 1);
def(ICONST_2, "iconst_2", "b", null, T_INT, 1);
def(ICONST_3, "iconst_3", "b", null, T_INT, 1);
def(ICONST_4, "iconst_4", "b", null, T_INT, 1);
def(ICONST_5, "iconst_5", "b", null, T_INT, 1);
def(LCONST_0, "lconst_0", "b", null, T_LONG, 2);
def(LCONST_1, "lconst_1", "b", null, T_LONG, 2);
def(FCONST_0, "fconst_0", "b", null, T_FLOAT, 1);
def(FCONST_1, "fconst_1", "b", null, T_FLOAT, 1);
def(FCONST_2, "fconst_2", "b", null, T_FLOAT, 1);
def(DCONST_0, "dconst_0", "b", null, T_DOUBLE, 2);
def(DCONST_1, "dconst_1", "b", null, T_DOUBLE, 2);
def(BIPUSH, "bipush", "bc", null, T_INT, 1);
def(SIPUSH, "sipush", "bcc", null, T_INT, 1);
def(LDC, "ldc", "bk", null, T_ILLEGAL, 1);
def(LDC_W, "ldc_w", "bkk", null, T_ILLEGAL, 1);
def(LDC2_W, "ldc2_w", "bkk", null, T_ILLEGAL, 2);
def(ILOAD, "iload", "bi", "wbii", T_INT, 1);
def(LLOAD, "lload", "bi", "wbii", T_LONG, 2);
def(FLOAD, "fload", "bi", "wbii", T_FLOAT, 1);
def(DLOAD, "dload", "bi", "wbii", T_DOUBLE, 2);
def(ALOAD, "aload", "bi", "wbii", T_OBJECT, 1);
def(ILOAD_0, "iload_0", "b", null, T_INT, 1);
def(ILOAD_1, "iload_1", "b", null, T_INT, 1);
def(ILOAD_2, "iload_2", "b", null, T_INT, 1);
def(ILOAD_3, "iload_3", "b", null, T_INT, 1);
def(LLOAD_0, "lload_0", "b", null, T_LONG, 2);
def(LLOAD_1, "lload_1", "b", null, T_LONG, 2);
def(LLOAD_2, "lload_2", "b", null, T_LONG, 2);
def(LLOAD_3, "lload_3", "b", null, T_LONG, 2);
def(FLOAD_0, "fload_0", "b", null, T_FLOAT, 1);
def(FLOAD_1, "fload_1", "b", null, T_FLOAT, 1);
def(FLOAD_2, "fload_2", "b", null, T_FLOAT, 1);
def(FLOAD_3, "fload_3", "b", null, T_FLOAT, 1);
def(DLOAD_0, "dload_0", "b", null, T_DOUBLE, 2);
def(DLOAD_1, "dload_1", "b", null, T_DOUBLE, 2);
def(DLOAD_2, "dload_2", "b", null, T_DOUBLE, 2);
def(DLOAD_3, "dload_3", "b", null, T_DOUBLE, 2);
def(ALOAD_0, "aload_0", "b", null, T_OBJECT, 1);
def(ALOAD_1, "aload_1", "b", null, T_OBJECT, 1);
def(ALOAD_2, "aload_2", "b", null, T_OBJECT, 1);
def(ALOAD_3, "aload_3", "b", null, T_OBJECT, 1);
def(IALOAD, "iaload", "b", null, T_INT, -1);
def(LALOAD, "laload", "b", null, T_LONG, 0);
def(FALOAD, "faload", "b", null, T_FLOAT, -1);
def(DALOAD, "daload", "b", null, T_DOUBLE, 0);
def(AALOAD, "aaload", "b", null, T_OBJECT, -1);
def(BALOAD, "baload", "b", null, T_INT, -1);
def(CALOAD, "caload", "b", null, T_INT, -1);
def(SALOAD, "saload", "b", null, T_INT, -1);
def(ISTORE, "istore", "bi", "wbii", T_VOID, -1);
def(LSTORE, "lstore", "bi", "wbii", T_VOID, -2);
def(FSTORE, "fstore", "bi", "wbii", T_VOID, -1);
def(DSTORE, "dstore", "bi", "wbii", T_VOID, -2);
def(ASTORE, "astore", "bi", "wbii", T_VOID, -1);
def(ISTORE_0, "istore_0", "b", null, T_VOID, -1);
def(ISTORE_1, "istore_1", "b", null, T_VOID, -1);
def(ISTORE_2, "istore_2", "b", null, T_VOID, -1);
def(ISTORE_3, "istore_3", "b", null, T_VOID, -1);
def(LSTORE_0, "lstore_0", "b", null, T_VOID, -2);
def(LSTORE_1, "lstore_1", "b", null, T_VOID, -2);
def(LSTORE_2, "lstore_2", "b", null, T_VOID, -2);
def(LSTORE_3, "lstore_3", "b", null, T_VOID, -2);
def(FSTORE_0, "fstore_0", "b", null, T_VOID, -1);
def(FSTORE_1, "fstore_1", "b", null, T_VOID, -1);
def(FSTORE_2, "fstore_2", "b", null, T_VOID, -1);
def(FSTORE_3, "fstore_3", "b", null, T_VOID, -1);
def(DSTORE_0, "dstore_0", "b", null, T_VOID, -2);
def(DSTORE_1, "dstore_1", "b", null, T_VOID, -2);
def(DSTORE_2, "dstore_2", "b", null, T_VOID, -2);
def(DSTORE_3, "dstore_3", "b", null, T_VOID, -2);
def(ASTORE_0, "astore_0", "b", null, T_VOID, -1);
def(ASTORE_1, "astore_1", "b", null, T_VOID, -1);
def(ASTORE_2, "astore_2", "b", null, T_VOID, -1);
def(ASTORE_3, "astore_3", "b", null, T_VOID, -1);
def(IASTORE, "iastore", "b", null, T_VOID, -3);
def(LASTORE, "lastore", "b", null, T_VOID, -4);
def(FASTORE, "fastore", "b", null, T_VOID, -3);
def(DASTORE, "dastore", "b", null, T_VOID, -4);
def(AASTORE, "aastore", "b", null, T_VOID, -3);
def(BASTORE, "bastore", "b", null, T_VOID, -3);
def(CASTORE, "castore", "b", null, T_VOID, -3);
def(SASTORE, "sastore", "b", null, T_VOID, -3);
def(POP, "pop", "b", null, T_VOID, -1);
def(POP2, "pop2", "b", null, T_VOID, -2);
def(DUP, "dup", "b", null, T_VOID, 1);
def(DUP_X1, "dup_x1", "b", null, T_VOID, 1);
def(DUP_X2, "dup_x2", "b", null, T_VOID, 1);
def(DUP2, "dup2", "b", null, T_VOID, 2);
def(DUP2_X1, "dup2_x1", "b", null, T_VOID, 2);
def(DUP2_X2, "dup2_x2", "b", null, T_VOID, 2);
def(SWAP, "swap", "b", null, T_VOID, 0);
def(IADD, "iadd", "b", null, T_INT, -1);
def(LADD, "ladd", "b", null, T_LONG, -2);
def(FADD, "fadd", "b", null, T_FLOAT, -1);
def(DADD, "dadd", "b", null, T_DOUBLE, -2);
def(ISUB, "isub", "b", null, T_INT, -1);
def(LSUB, "lsub", "b", null, T_LONG, -2);
def(FSUB, "fsub", "b", null, T_FLOAT, -1);
def(DSUB, "dsub", "b", null, T_DOUBLE, -2);
def(IMUL, "imul", "b", null, T_INT, -1);
def(LMUL, "lmul", "b", null, T_LONG, -2);
def(FMUL, "fmul", "b", null, T_FLOAT, -1);
def(DMUL, "dmul", "b", null, T_DOUBLE, -2);
def(IDIV, "idiv", "b", null, T_INT, -1);
def(LDIV, "ldiv", "b", null, T_LONG, -2);
def(FDIV, "fdiv", "b", null, T_FLOAT, -1);
def(DDIV, "ddiv", "b", null, T_DOUBLE, -2);
def(IREM, "irem", "b", null, T_INT, -1);
def(LREM, "lrem", "b", null, T_LONG, -2);
def(FREM, "frem", "b", null, T_FLOAT, -1);
def(DREM, "drem", "b", null, T_DOUBLE, -2);
def(INEG, "ineg", "b", null, T_INT, 0);
def(LNEG, "lneg", "b", null, T_LONG, 0);
def(FNEG, "fneg", "b", null, T_FLOAT, 0);
def(DNEG, "dneg", "b", null, T_DOUBLE, 0);
def(ISHL, "ishl", "b", null, T_INT, -1);
def(LSHL, "lshl", "b", null, T_LONG, -1);
def(ISHR, "ishr", "b", null, T_INT, -1);
def(LSHR, "lshr", "b", null, T_LONG, -1);
def(IUSHR, "iushr", "b", null, T_INT, -1);
def(LUSHR, "lushr", "b", null, T_LONG, -1);
def(IAND, "iand", "b", null, T_INT, -1);
def(LAND, "land", "b", null, T_LONG, -2);
def(IOR, "ior", "b", null, T_INT, -1);
def(LOR, "lor", "b", null, T_LONG, -2);
def(IXOR, "ixor", "b", null, T_INT, -1);
def(LXOR, "lxor", "b", null, T_LONG, -2);
def(IINC, "iinc", "bic", "wbiicc", T_VOID, 0);
def(I2L, "i2l", "b", null, T_LONG, 1);
def(I2F, "i2f", "b", null, T_FLOAT, 0);
def(I2D, "i2d", "b", null, T_DOUBLE, 1);
def(L2I, "l2i", "b", null, T_INT, -1);
def(L2F, "l2f", "b", null, T_FLOAT, -1);
def(L2D, "l2d", "b", null, T_DOUBLE, 0);
def(F2I, "f2i", "b", null, T_INT, 0);
def(F2L, "f2l", "b", null, T_LONG, 1);
def(F2D, "f2d", "b", null, T_DOUBLE, 1);
def(D2I, "d2i", "b", null, T_INT, -1);
def(D2L, "d2l", "b", null, T_LONG, 0);
def(D2F, "d2f", "b", null, T_FLOAT, -1);
def(I2B, "i2b", "b", null, T_BYTE, 0);
def(I2C, "i2c", "b", null, T_CHAR, 0);
def(I2S, "i2s", "b", null, T_SHORT, 0);
def(LCMP, "lcmp", "b", null, T_VOID, -3);
def(FCMPL, "fcmpl", "b", null, T_VOID, -1);
def(FCMPG, "fcmpg", "b", null, T_VOID, -1);
def(DCMPL, "dcmpl", "b", null, T_VOID, -3);
def(DCMPG, "dcmpg", "b", null, T_VOID, -3);
def(IFEQ, "ifeq", "boo", null, T_VOID, -1);
def(IFNE, "ifne", "boo", null, T_VOID, -1);
def(IFLT, "iflt", "boo", null, T_VOID, -1);
def(IFGE, "ifge", "boo", null, T_VOID, -1);
def(IFGT, "ifgt", "boo", null, T_VOID, -1);
def(IFLE, "ifle", "boo", null, T_VOID, -1);
def(IF_ICMPEQ, "if_icmpeq", "boo", null, T_VOID, -2);
def(IF_ICMPNE, "if_icmpne", "boo", null, T_VOID, -2);
def(IF_ICMPLT, "if_icmplt", "boo", null, T_VOID, -2);
def(IF_ICMPGE, "if_icmpge", "boo", null, T_VOID, -2);
def(IF_ICMPGT, "if_icmpgt", "boo", null, T_VOID, -2);
def(IF_ICMPLE, "if_icmple", "boo", null, T_VOID, -2);
def(IF_ACMPEQ, "if_acmpeq", "boo", null, T_VOID, -2);
def(IF_ACMPNE, "if_acmpne", "boo", null, T_VOID, -2);
def(GOTO, "goto", "boo", null, T_VOID, 0);
def(JSR, "jsr", "boo", null, T_INT, 0);
def(RET, "ret", "bi", "wbii", T_VOID, 0);
def(TABLESWITCH, "tableswitch", "", null, T_VOID, -1); // may have backward branches
def(LOOKUPSWITCH, "lookupswitch", "", null, T_VOID, -1); // rewriting in interpreter
def(IRETURN, "ireturn", "b", null, T_INT, -1);
def(LRETURN, "lreturn", "b", null, T_LONG, -2);
def(FRETURN, "freturn", "b", null, T_FLOAT, -1);
def(DRETURN, "dreturn", "b", null, T_DOUBLE, -2);
def(ARETURN, "areturn", "b", null, T_OBJECT, -1);
def(RETURN, "return", "b", null, T_VOID, 0);
def(GETSTATIC, "getstatic", "bJJ", null, T_ILLEGAL, 1);
def(PUTSTATIC, "putstatic", "bJJ", null, T_ILLEGAL, -1);
def(GETFIELD, "getfield", "bJJ", null, T_ILLEGAL, 0);
def(PUTFIELD, "putfield", "bJJ", null, T_ILLEGAL, -2);
def(INVOKEVIRTUAL, "invokevirtual", "bJJ", null, T_ILLEGAL, -1);
def(INVOKESPECIAL, "invokespecial", "bJJ", null, T_ILLEGAL, -1);
def(INVOKESTATIC, "invokestatic", "bJJ", null, T_ILLEGAL, 0);
def(INVOKEINTERFACE, "invokeinterface", "bJJ__", null, T_ILLEGAL, -1);
def(INVOKEDYNAMIC, "invokedynamic", "bJJJJ", null, T_ILLEGAL, 0);
def(NEW, "new", "bkk", null, T_OBJECT, 1);
def(NEWARRAY, "newarray", "bc", null, T_OBJECT, 0);
def(ANEWARRAY, "anewarray", "bkk", null, T_OBJECT, 0);
def(ARRAYLENGTH, "arraylength", "b", null, T_VOID, 0);
def(ATHROW, "athrow", "b", null, T_VOID, -1);
def(CHECKCAST, "checkcast", "bkk", null, T_OBJECT, 0);
def(INSTANCEOF, "instanceof", "bkk", null, T_INT, 0);
def(MONITORENTER, "monitorenter", "b", null, T_VOID, -1);
def(MONITOREXIT, "monitorexit", "b", null, T_VOID, -1);
def(WIDE, "wide", "", null, T_VOID, 0);
def(MULTIANEWARRAY, "multianewarray", "bkkc", null, T_OBJECT, 1);
def(IFNULL, "ifnull", "boo", null, T_VOID, -1);
def(IFNONNULL, "ifnonnull", "boo", null, T_VOID, -1);
def(GOTO_W, "goto_w", "boooo", null, T_VOID, 0);
def(JSR_W, "jsr_w", "boooo", null, T_INT, 0);
def(_breakpoint, "breakpoint", "", null, T_VOID, 0);
def(_fast_agetfield, "fast_agetfield", "bJJ", null, T_OBJECT, 0, ClassFile.GETFIELD);
def(_fast_bgetfield, "fast_bgetfield", "bJJ", null, T_INT, 0, ClassFile.GETFIELD);
def(_fast_cgetfield, "fast_cgetfield", "bJJ", null, T_CHAR, 0, ClassFile.GETFIELD);
def(_fast_dgetfield, "fast_dgetfield", "bJJ", null, T_DOUBLE, 0, ClassFile.GETFIELD);
def(_fast_fgetfield, "fast_fgetfield", "bJJ", null, T_FLOAT, 0, ClassFile.GETFIELD);
def(_fast_igetfield, "fast_igetfield", "bJJ", null, T_INT, 0, ClassFile.GETFIELD);
def(_fast_lgetfield, "fast_lgetfield", "bJJ", null, T_LONG, 0, ClassFile.GETFIELD);
def(_fast_sgetfield, "fast_sgetfield", "bJJ", null, T_SHORT, 0, ClassFile.GETFIELD);
def(_fast_aputfield, "fast_aputfield", "bJJ", null, T_OBJECT, 0, ClassFile.PUTFIELD);
def(_fast_bputfield, "fast_bputfield", "bJJ", null, T_INT, 0, ClassFile.PUTFIELD);
def(_fast_zputfield, "fast_zputfield", "bJJ", null, T_INT, 0, ClassFile.PUTFIELD);
def(_fast_cputfield, "fast_cputfield", "bJJ", null, T_CHAR, 0, ClassFile.PUTFIELD);
def(_fast_dputfield, "fast_dputfield", "bJJ", null, T_DOUBLE, 0, ClassFile.PUTFIELD);
def(_fast_fputfield, "fast_fputfield", "bJJ", null, T_FLOAT, 0, ClassFile.PUTFIELD);
def(_fast_iputfield, "fast_iputfield", "bJJ", null, T_INT, 0, ClassFile.PUTFIELD);
def(_fast_lputfield, "fast_lputfield", "bJJ", null, T_LONG, 0, ClassFile.PUTFIELD);
def(_fast_sputfield, "fast_sputfield", "bJJ", null, T_SHORT, 0, ClassFile.PUTFIELD);
def(_fast_aload_0, "fast_aload_0", "b", null, T_OBJECT, 1, ClassFile.ALOAD_0);
def(_fast_iaccess_0, "fast_iaccess_0", "b_JJ", null, T_INT, 1, ClassFile.ALOAD_0);
def(_fast_aaccess_0, "fast_aaccess_0", "b_JJ", null, T_OBJECT, 1, ClassFile.ALOAD_0);
def(_fast_faccess_0, "fast_faccess_0", "b_JJ", null, T_OBJECT, 1, ClassFile.ALOAD_0);
def(_fast_iload, "fast_iload", "bi", null, T_INT, 1, ClassFile.ILOAD);
def(_fast_iload2, "fast_iload2", "bi_i", null, T_INT, 2, ClassFile.ILOAD);
def(_fast_icaload, "fast_icaload", "bi_", null, T_INT, 0, ClassFile.ILOAD);
def(_fast_invokevfinal, "fast_invokevfinal", "bJJ", null, T_ILLEGAL, -1, ClassFile.INVOKEVIRTUAL);
def(_fast_linearswitch, "fast_linearswitch", "", null, T_VOID, -1, ClassFile.LOOKUPSWITCH);
def(_fast_binaryswitch, "fast_binaryswitch", "", null, T_VOID, -1, ClassFile.LOOKUPSWITCH);
def(_return_register_finalizer, "return_register_finalizer", "b", null, T_VOID, 0, ClassFile.RETURN);
def(_invokehandle, "invokehandle", "bJJ", null, T_ILLEGAL, -1, ClassFile.INVOKEVIRTUAL);
def(_fast_aldc, "fast_aldc", "bj", null, T_OBJECT, 1, ClassFile.LDC);
def(_fast_aldc_w, "fast_aldc_w", "bJJ", null, T_OBJECT, 1, ClassFile.LDC_W);
def(_nofast_getfield, "nofast_getfield", "bJJ", null, T_ILLEGAL, 0, ClassFile.GETFIELD);
def(_nofast_putfield, "nofast PUTFIELD", "bJJ", null, T_ILLEGAL, -2, ClassFile.PUTFIELD);
def(_nofast_aload_0, "nofast_aload_0", "b", null, T_ILLEGAL, 1, ClassFile.ALOAD_0);
def(_nofast_iload, "nofast_iload", "bi", null, T_ILLEGAL, 1, ClassFile.ILOAD);
def(_fast_agetfield, "fast_agetfield", "bJJ", null, T_OBJECT, 0, GETFIELD);
def(_fast_bgetfield, "fast_bgetfield", "bJJ", null, T_INT, 0, GETFIELD);
def(_fast_cgetfield, "fast_cgetfield", "bJJ", null, T_CHAR, 0, GETFIELD);
def(_fast_dgetfield, "fast_dgetfield", "bJJ", null, T_DOUBLE, 0, GETFIELD);
def(_fast_fgetfield, "fast_fgetfield", "bJJ", null, T_FLOAT, 0, GETFIELD);
def(_fast_igetfield, "fast_igetfield", "bJJ", null, T_INT, 0, GETFIELD);
def(_fast_lgetfield, "fast_lgetfield", "bJJ", null, T_LONG, 0, GETFIELD);
def(_fast_sgetfield, "fast_sgetfield", "bJJ", null, T_SHORT, 0, GETFIELD);
def(_fast_aputfield, "fast_aputfield", "bJJ", null, T_OBJECT, 0, PUTFIELD);
def(_fast_bputfield, "fast_bputfield", "bJJ", null, T_INT, 0, PUTFIELD);
def(_fast_zputfield, "fast_zputfield", "bJJ", null, T_INT, 0, PUTFIELD);
def(_fast_cputfield, "fast_cputfield", "bJJ", null, T_CHAR, 0, PUTFIELD);
def(_fast_dputfield, "fast_dputfield", "bJJ", null, T_DOUBLE, 0, PUTFIELD);
def(_fast_fputfield, "fast_fputfield", "bJJ", null, T_FLOAT, 0, PUTFIELD);
def(_fast_iputfield, "fast_iputfield", "bJJ", null, T_INT, 0, PUTFIELD);
def(_fast_lputfield, "fast_lputfield", "bJJ", null, T_LONG, 0, PUTFIELD);
def(_fast_sputfield, "fast_sputfield", "bJJ", null, T_SHORT, 0, PUTFIELD);
def(_fast_aload_0, "fast_aload_0", "b", null, T_OBJECT, 1, ALOAD_0);
def(_fast_iaccess_0, "fast_iaccess_0", "b_JJ", null, T_INT, 1, ALOAD_0);
def(_fast_aaccess_0, "fast_aaccess_0", "b_JJ", null, T_OBJECT, 1, ALOAD_0);
def(_fast_faccess_0, "fast_faccess_0", "b_JJ", null, T_OBJECT, 1, ALOAD_0);
def(_fast_iload, "fast_iload", "bi", null, T_INT, 1, ILOAD);
def(_fast_iload2, "fast_iload2", "bi_i", null, T_INT, 2, ILOAD);
def(_fast_icaload, "fast_icaload", "bi_", null, T_INT, 0, ILOAD);
def(_fast_invokevfinal, "fast_invokevfinal", "bJJ", null, T_ILLEGAL, -1, INVOKEVIRTUAL);
def(_fast_linearswitch, "fast_linearswitch", "", null, T_VOID, -1, LOOKUPSWITCH);
def(_fast_binaryswitch, "fast_binaryswitch", "", null, T_VOID, -1, LOOKUPSWITCH);
def(_return_register_finalizer, "return_register_finalizer", "b", null, T_VOID, 0, RETURN);
def(_invokehandle, "invokehandle", "bJJ", null, T_ILLEGAL, -1, INVOKEVIRTUAL);
def(_fast_aldc, "fast_aldc", "bj", null, T_OBJECT, 1, LDC);
def(_fast_aldc_w, "fast_aldc_w", "bJJ", null, T_OBJECT, 1, LDC_W);
def(_nofast_getfield, "nofast_getfield", "bJJ", null, T_ILLEGAL, 0, GETFIELD);
def(_nofast_putfield, "nofast PUTFIELD", "bJJ", null, T_ILLEGAL, -2, PUTFIELD);
def(_nofast_aload_0, "nofast_aload_0", "b", null, T_ILLEGAL, 1, ALOAD_0);
def(_nofast_iload, "nofast_iload", "bi", null, T_ILLEGAL, 1, ILOAD);
def(_shouldnotreachhere, "_shouldnotreachhere", "b", null, T_VOID, 0);
}
}

View File

@ -35,6 +35,7 @@ import java.lang.classfile.constantpool.*;
import java.lang.classfile.attribute.*;
import static java.lang.classfile.ClassFile.*;
import static java.lang.classfile.attribute.StackMapFrameInfo.*;
import static java.lang.classfile.instruction.CharacterRange.*;
/*
* A writer for writing Attributes as text.
@ -144,23 +145,23 @@ public class AttributeWriter extends BasicWriter {
(e.characterRangeStart() & 0x3ff),
(e.characterRangeEnd() >> 10),
(e.characterRangeEnd() & 0x3ff)));
if ((e.flags() & CRT_STATEMENT) != 0)
if ((e.flags() & FLAG_STATEMENT) != 0)
print(", statement");
if ((e.flags() & CRT_BLOCK) != 0)
if ((e.flags() & FLAG_BLOCK) != 0)
print(", block");
if ((e.flags() & CRT_ASSIGNMENT) != 0)
if ((e.flags() & FLAG_ASSIGNMENT) != 0)
print(", assignment");
if ((e.flags() & CRT_FLOW_CONTROLLER) != 0)
if ((e.flags() & FLAG_FLOW_CONTROLLER) != 0)
print(", flow-controller");
if ((e.flags() & CRT_FLOW_TARGET) != 0)
if ((e.flags() & FLAG_FLOW_TARGET) != 0)
print(", flow-target");
if ((e.flags() & CRT_INVOKE) != 0)
if ((e.flags() & FLAG_INVOKE) != 0)
print(", invoke");
if ((e.flags() & CRT_CREATE) != 0)
if ((e.flags() & FLAG_CREATE) != 0)
print(", create");
if ((e.flags() & CRT_BRANCH_TRUE) != 0)
if ((e.flags() & FLAG_BRANCH_TRUE) != 0)
print(", branch-true");
if ((e.flags() & CRT_BRANCH_FALSE) != 0)
if ((e.flags() & FLAG_BRANCH_FALSE) != 0)
print(", branch-false");
println();
}
@ -705,13 +706,13 @@ public class AttributeWriter extends BasicWriter {
String mapTypeName(SimpleVerificationTypeInfo type) {
return switch (type) {
case ITEM_TOP -> "top";
case ITEM_INTEGER -> "int";
case ITEM_FLOAT -> "float";
case ITEM_LONG -> "long";
case ITEM_DOUBLE -> "double";
case ITEM_NULL -> "null";
case ITEM_UNINITIALIZED_THIS -> "this";
case TOP -> "top";
case INTEGER -> "int";
case FLOAT -> "float";
case LONG -> "long";
case DOUBLE -> "double";
case NULL -> "null";
case UNINITIALIZED_THIS -> "this";
};
}

View File

@ -741,7 +741,7 @@ public class ClassWriter extends BasicWriter {
*/
String getConstantValue(ClassDesc d, ConstantValueEntry cpInfo) {
switch (cpInfo.tag()) {
case ClassFile.TAG_INTEGER: {
case PoolEntry.TAG_INTEGER: {
var val = (Integer)cpInfo.constantValue();
switch (d.descriptorString()) {
case "C":
@ -755,7 +755,7 @@ public class ClassWriter extends BasicWriter {
return String.valueOf(val);
}
}
case ClassFile.TAG_STRING:
case PoolEntry.TAG_STRING:
return getConstantStringValue(cpInfo.constantValue().toString());
default:
return constantWriter.stringValue(cpInfo);

View File

@ -26,7 +26,8 @@
package com.sun.tools.javap;
import java.lang.classfile.constantpool.*;
import static java.lang.classfile.ClassFile.*;
import static java.lang.classfile.constantpool.PoolEntry.*;
/*
* Write a constant pool entry.
@ -156,13 +157,13 @@ public class ConstantWriter extends BasicWriter {
case TAG_CLASS -> "Class";
case TAG_STRING -> "String";
case TAG_FIELDREF -> "Fieldref";
case TAG_METHODHANDLE -> "MethodHandle";
case TAG_METHODTYPE -> "MethodType";
case TAG_METHOD_HANDLE -> "MethodHandle";
case TAG_METHOD_TYPE -> "MethodType";
case TAG_METHODREF -> "Methodref";
case TAG_INTERFACEMETHODREF -> "InterfaceMethodref";
case TAG_INVOKEDYNAMIC -> "InvokeDynamic";
case TAG_CONSTANTDYNAMIC -> "Dynamic";
case TAG_NAMEANDTYPE -> "NameAndType";
case TAG_INTERFACE_METHODREF -> "InterfaceMethodref";
case TAG_INVOKE_DYNAMIC -> "InvokeDynamic";
case TAG_DYNAMIC -> "Dynamic";
case TAG_NAME_AND_TYPE -> "NameAndType";
default -> "Unknown";
};
}
@ -177,13 +178,13 @@ public class ConstantWriter extends BasicWriter {
case TAG_CLASS -> "class";
case TAG_STRING -> "String";
case TAG_FIELDREF -> "Field";
case TAG_METHODHANDLE -> "MethodHandle";
case TAG_METHODTYPE -> "MethodType";
case TAG_METHOD_HANDLE -> "MethodHandle";
case TAG_METHOD_TYPE -> "MethodType";
case TAG_METHODREF -> "Method";
case TAG_INTERFACEMETHODREF -> "InterfaceMethod";
case TAG_INVOKEDYNAMIC -> "InvokeDynamic";
case TAG_CONSTANTDYNAMIC -> "Dynamic";
case TAG_NAMEANDTYPE -> "NameAndType";
case TAG_INTERFACE_METHODREF -> "InterfaceMethod";
case TAG_INVOKE_DYNAMIC -> "InvokeDynamic";
case TAG_DYNAMIC -> "Dynamic";
case TAG_NAME_AND_TYPE -> "NameAndType";
default -> "(unknown tag " + tag + ")";
};
}

View File

@ -122,25 +122,25 @@ public class StackMapWriter extends InstructionDetailWriter {
switch (entry) {
case StackMapFrameInfo.SimpleVerificationTypeInfo s -> {
switch (s) {
case ITEM_TOP ->
case TOP ->
print("top");
case ITEM_INTEGER ->
case INTEGER ->
print("int");
case ITEM_FLOAT ->
case FLOAT ->
print("float");
case ITEM_LONG ->
case LONG ->
print("long");
case ITEM_DOUBLE ->
case DOUBLE ->
print("double");
case ITEM_NULL ->
case NULL ->
print("null");
case ITEM_UNINITIALIZED_THIS ->
case UNINITIALIZED_THIS ->
print("uninit_this");
}
}

View File

@ -33,6 +33,8 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import static java.lang.classfile.constantpool.PoolEntry.*;
import static java.util.ResourceBundle.Control;
import java.util.Set;
import java.util.function.IntUnaryOperator;
@ -41,7 +43,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static java.lang.classfile.ClassFile.*;
import jdk.tools.jlink.internal.ResourcePrevisitor;
import jdk.tools.jlink.internal.StringTable;
import jdk.tools.jlink.plugin.ResourcePoolModule;
@ -300,18 +302,18 @@ public final class IncludeLocalesPlugin extends AbstractPlugin implements Resour
}
case TAG_CLASS,
TAG_STRING,
TAG_METHODTYPE,
TAG_METHOD_TYPE,
TAG_MODULE,
TAG_PACKAGE -> offset += 3;
case TAG_METHODHANDLE -> offset += 4;
case TAG_METHOD_HANDLE -> offset += 4;
case TAG_INTEGER,
TAG_FLOAT,
TAG_FIELDREF,
TAG_METHODREF,
TAG_INTERFACEMETHODREF,
TAG_NAMEANDTYPE,
TAG_CONSTANTDYNAMIC,
TAG_INVOKEDYNAMIC -> offset += 5;
TAG_INTERFACE_METHODREF,
TAG_NAME_AND_TYPE,
TAG_DYNAMIC,
TAG_INVOKE_DYNAMIC -> offset += 5;
case TAG_LONG,
TAG_DOUBLE -> {offset += 9; cpSlot++;} //additional slot for double and long entries
default -> throw new IllegalArgumentException("Unknown constant pool entry: 0x"

View File

@ -51,6 +51,8 @@ import jdk.tools.jlink.internal.ResourcePoolManager;
import jdk.tools.jlink.internal.ResourcePrevisitor;
import jdk.tools.jlink.internal.StringTable;
import static java.lang.classfile.constantpool.PoolEntry.*;
/**
*
* A Plugin that stores the image classes constant pool UTF_8 entries into the
@ -214,7 +216,7 @@ public class StringSharingPlugin extends AbstractPlugin implements ResourcePrevi
int tag = stream.readUnsignedByte();
byte[] arr;
switch (tag) {
case ClassFile.TAG_UTF8: {
case TAG_UTF8: {
String original = stream.readUTF();
// 2 cases, a Descriptor or a simple String
if (descriptorIndexes.contains(i)) {
@ -238,8 +240,8 @@ public class StringSharingPlugin extends AbstractPlugin implements ResourcePrevi
break;
}
case ClassFile.TAG_LONG:
case ClassFile.TAG_DOUBLE:
case TAG_LONG:
case TAG_DOUBLE:
i++;
default: {
out.write(tag);

View File

@ -28,6 +28,7 @@
* @run junit LimitsTest
*/
import java.lang.classfile.Attributes;
import java.lang.classfile.constantpool.PoolEntry;
import java.lang.constant.ClassDesc;
import java.lang.constant.ConstantDescs;
import java.lang.constant.MethodTypeDesc;
@ -36,12 +37,10 @@ import java.lang.classfile.Opcode;
import java.lang.classfile.attribute.CodeAttribute;
import java.lang.classfile.attribute.LineNumberInfo;
import java.lang.classfile.attribute.LineNumberTableAttribute;
import java.lang.classfile.attribute.LocalVariableInfo;
import java.lang.classfile.attribute.LocalVariableTableAttribute;
import java.lang.classfile.constantpool.ConstantPoolBuilder;
import java.lang.classfile.constantpool.ConstantPoolException;
import java.lang.classfile.constantpool.IntegerEntry;
import java.lang.classfile.instruction.LocalVariable;
import java.util.List;
import jdk.internal.classfile.impl.BufWriterImpl;
@ -113,13 +112,13 @@ class LimitsTest {
@Test
void testInvalidClassEntry() {
assertThrows(ConstantPoolException.class, () -> ClassFile.of().parse(new byte[]{(byte)0xCA, (byte)0xFE, (byte)0xBA, (byte)0xBE,
0, 0, 0, 0, 0, 2, ClassFile.TAG_METHODREF, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}).thisClass());
0, 0, 0, 0, 0, 2, PoolEntry.TAG_METHODREF, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}).thisClass());
}
@Test
void testInvalidUtf8Entry() {
var cp = ClassFile.of().parse(new byte[]{(byte)0xCA, (byte)0xFE, (byte)0xBA, (byte)0xBE,
0, 0, 0, 0, 0, 3, ClassFile.TAG_INTEGER, 0, 0, 0, 0, ClassFile.TAG_NAMEANDTYPE, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}).constantPool();
0, 0, 0, 0, 0, 3, PoolEntry.TAG_INTEGER, 0, 0, 0, 0, PoolEntry.TAG_NAME_AND_TYPE, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}).constantPool();
assertTrue(cp.entryByIndex(1) instanceof IntegerEntry); //parse valid int entry first
assertThrows(ConstantPoolException.class, () -> cp.entryByIndex(2));
}

View File

@ -385,9 +385,9 @@ class StackMapsTest {
StackMapTableAttribute.of(List.of(
StackMapFrameInfo.of(f2,
List.of(),
List.of(StackMapFrameInfo.SimpleVerificationTypeInfo.ITEM_LONG)),
List.of(StackMapFrameInfo.SimpleVerificationTypeInfo.LONG)),
StackMapFrameInfo.of(f3,
List.of(StackMapFrameInfo.SimpleVerificationTypeInfo.ITEM_LONG),
List.of(StackMapFrameInfo.SimpleVerificationTypeInfo.LONG),
List.of()))));
}
));

View File

@ -29,6 +29,7 @@
* @run junit VerifierSelfTest
*/
import java.io.IOException;
import java.lang.classfile.constantpool.PoolEntry;
import java.lang.constant.ClassDesc;
import static java.lang.constant.ConstantDescs.*;
import java.lang.invoke.MethodHandleInfo;
@ -116,7 +117,7 @@ class VerifierSelfTest {
void testInvalidClassNameEntry() {
var cc = ClassFile.of();
var bytes = cc.parse(new byte[]{(byte)0xCA, (byte)0xFE, (byte)0xBA, (byte)0xBE,
0, 0, 0, 0, 0, 2, ClassFile.TAG_INTEGER, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
0, 0, 0, 0, 0, 2, PoolEntry.TAG_INTEGER, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
assertTrue(cc.verify(bytes).stream().anyMatch(e -> e.getMessage().contains("expected ClassEntry")));
}

View File

@ -22,21 +22,13 @@
*/
package helpers;
import java.io.IOException;
import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.RecordComponent;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.Set;
import java.util.function.Function;
@ -53,9 +45,10 @@ import java.lang.classfile.instruction.*;
import static java.util.stream.Collectors.toMap;
import static java.util.stream.Collectors.toSet;
import static java.lang.classfile.ClassFile.*;
import static java.lang.classfile.Attributes.*;
import static java.lang.classfile.constantpool.PoolEntry.*;
import static helpers.ClassRecord.CompatibilityFilter.By_ClassBuilder;
import static jdk.internal.classfile.impl.RawBytecodeHelper.*;
/**
* ClassRecord
@ -916,17 +909,17 @@ public record ClassRecord(
CpFieldRefRecord.ofFieldRefEntry((FieldRefEntry) cpInfo);
case TAG_METHODREF ->
CpMethodRefRecord.ofMethodRefEntry((MethodRefEntry) cpInfo);
case TAG_INTERFACEMETHODREF ->
case TAG_INTERFACE_METHODREF ->
CpInterfaceMethodRefRecord.ofInterfaceMethodRefEntry((InterfaceMethodRefEntry) cpInfo);
case TAG_NAMEANDTYPE ->
case TAG_NAME_AND_TYPE ->
CpNameAndTypeRecord.ofNameAndTypeEntry((NameAndTypeEntry) cpInfo);
case TAG_METHODHANDLE ->
case TAG_METHOD_HANDLE ->
CpMethodHandleRecord.ofMethodHandleEntry((MethodHandleEntry) cpInfo);
case TAG_METHODTYPE ->
case TAG_METHOD_TYPE ->
new CpMethodTypeRecord(((MethodTypeEntry) cpInfo).descriptor().stringValue());
case TAG_CONSTANTDYNAMIC ->
case TAG_DYNAMIC ->
CpConstantDynamicRecord.ofConstantDynamicEntry((ConstantDynamicEntry) cpInfo);
case TAG_INVOKEDYNAMIC ->
case TAG_INVOKE_DYNAMIC ->
CpInvokeDynamicRecord.ofInvokeDynamicEntry((InvokeDynamicEntry) cpInfo);
case TAG_MODULE ->
new CpModuleRecord(((ModuleEntry) cpInfo).name().stringValue());