99
1010import javax .annotation .Nonnull ;
1111
12+ @ SuppressWarnings ("unused" )
1213public final class JvmInstructions {
1314 public static final NoArgInstruction ACONST_NULL = new NoArgInstruction (0x01 );
1415 public static final BPInstruction ALOAD = new BPInstruction (0x19 );
16+ public static final NoArgInstruction ALOAD_0 = new NoArgInstruction (0x2a );
17+ public static final NoArgInstruction ALOAD_1 = new NoArgInstruction (0x2b );
18+ public static final NoArgInstruction ALOAD_2 = new NoArgInstruction (0x2c );
19+ public static final NoArgInstruction ALOAD_3 = new NoArgInstruction (0x2d );
1520 public static final CPInstruction <ClassEntry > ANEWARRAY = new CPInstruction <>(0xbd );
1621 public static final NoArgInstruction ARETURN = new NoArgInstruction (0xb0 );
1722 public static final BPInstruction ASTORE = new BPInstruction (0x3a );
23+ public static final NoArgInstruction ASTORE_0 = new NoArgInstruction (0x4b );
24+ public static final NoArgInstruction ASTORE_1 = new NoArgInstruction (0x4c );
25+ public static final NoArgInstruction ASTORE_2 = new NoArgInstruction (0x4d );
26+ public static final NoArgInstruction ASTORE_3 = new NoArgInstruction (0x4e );
1827 public static final BPInstruction BIPUSH = new BPInstruction (0x10 );
1928 public static final NoArgInstruction DCONST_0 = new NoArgInstruction (0x0e );
2029 public static final NoArgInstruction DCONST_1 = new NoArgInstruction (0x0f );
2130 public static final BPInstruction DLOAD = new BPInstruction (0x18 );
31+ public static final NoArgInstruction DLOAD_0 = new NoArgInstruction (0x26 );
32+ public static final NoArgInstruction DLOAD_1 = new NoArgInstruction (0x27 );
33+ public static final NoArgInstruction DLOAD_2 = new NoArgInstruction (0x28 );
34+ public static final NoArgInstruction DLOAD_3 = new NoArgInstruction (0x29 );
2235 public static final NoArgInstruction DRETURN = new NoArgInstruction (0xaf );
2336 public static final BPInstruction DSTORE = new BPInstruction (0x39 );
37+ public static final NoArgInstruction DSTORE_0 = new NoArgInstruction (0x47 );
38+ public static final NoArgInstruction DSTORE_1 = new NoArgInstruction (0x48 );
39+ public static final NoArgInstruction DSTORE_2 = new NoArgInstruction (0x49 );
40+ public static final NoArgInstruction DSTORE_3 = new NoArgInstruction (0x4a );
2441 public static final NoArgInstruction DUP = new NoArgInstruction (0x59 );
2542 public static final NoArgInstruction FCONST_0 = new NoArgInstruction (0x0b );
2643 public static final NoArgInstruction FCONST_1 = new NoArgInstruction (0x0c );
2744 public static final NoArgInstruction FCONST_2 = new NoArgInstruction (0x0d );
2845 public static final BPInstruction FLOAD = new BPInstruction (0x17 );
46+ public static final NoArgInstruction FLOAD_0 = new NoArgInstruction (0x22 );
47+ public static final NoArgInstruction FLOAD_1 = new NoArgInstruction (0x23 );
48+ public static final NoArgInstruction FLOAD_2 = new NoArgInstruction (0x24 );
49+ public static final NoArgInstruction FLOAD_3 = new NoArgInstruction (0x25 );
2950 public static final NoArgInstruction FRETURN = new NoArgInstruction (0xae );
3051 public static final BPInstruction FSTORE = new BPInstruction (0x38 );
52+ public static final NoArgInstruction FSTORE_0 = new NoArgInstruction (0x43 );
53+ public static final NoArgInstruction FSTORE_1 = new NoArgInstruction (0x44 );
54+ public static final NoArgInstruction FSTORE_2 = new NoArgInstruction (0x45 );
55+ public static final NoArgInstruction FSTORE_3 = new NoArgInstruction (0x46 );
3156 public static final CPInstruction <FieldrefEntry > GETFIELD = new CPInstruction <>(0xb4 );
3257 public static final CPInstruction <FieldrefEntry > GETSTATIC = new CPInstruction <>(0xb2 );
3358 public static final BranchInstruction GOTO = new BranchInstruction (0xa7 );
@@ -43,20 +68,37 @@ public final class JvmInstructions {
4368 public static final NoArgInstruction ICONST_5 = new NoArgInstruction (0x08 );
4469 public static final NoArgInstruction ICONST_M1 = new NoArgInstruction (0x02 );
4570 public static final BranchInstruction IFNE = new BranchInstruction (0x9a );
71+ public static final TPInstruction IINC = new TPInstruction (0x84 );
4672 public static final BPInstruction ILOAD = new BPInstruction (0x15 );
73+ public static final NoArgInstruction ILOAD_0 = new NoArgInstruction (0x1a );
74+ public static final NoArgInstruction ILOAD_1 = new NoArgInstruction (0x1b );
75+ public static final NoArgInstruction ILOAD_2 = new NoArgInstruction (0x1c );
76+ public static final NoArgInstruction ILOAD_3 = new NoArgInstruction (0x1d );
4777 public static final CPInstruction <MethodrefEntry > INVOKESTATIC = new CPInstruction <>(0xb8 );
4878 public static final CPInstruction <MethodrefEntry > INVOKEVIRTUAL = new CPInstruction <>(0xb6 );
4979 public static final NoArgInstruction IRETURN = new NoArgInstruction (0xac );
5080 public static final BPInstruction ISTORE = new BPInstruction (0x36 );
81+ public static final NoArgInstruction ISTORE_0 = new NoArgInstruction (0x3b );
82+ public static final NoArgInstruction ISTORE_1 = new NoArgInstruction (0x3c );
83+ public static final NoArgInstruction ISTORE_2 = new NoArgInstruction (0x3d );
84+ public static final NoArgInstruction ISTORE_3 = new NoArgInstruction (0x3e );
5185 public static final NoArgInstruction ISUB = new NoArgInstruction (0x64 );
5286 public static final NoArgInstruction LCONST_0 = new NoArgInstruction (0x09 );
5387 public static final NoArgInstruction LCONST_1 = new NoArgInstruction (0x0a );
5488 public static final CPInstruction <ConstantPoolEntry > LDC = new CPInstruction <>(0x12 );
5589 public static final CPInstruction <ConstantPoolEntry > LDC2_W = new CPInstruction <>(0x14 );
5690 public static final CPInstruction <ConstantPoolEntry > LDC_W = new CPInstruction <>(0x13 );
5791 public static final BPInstruction LLOAD = new BPInstruction (0x16 );
92+ public static final NoArgInstruction LLOAD_0 = new NoArgInstruction (0x1e );
93+ public static final NoArgInstruction LLOAD_1 = new NoArgInstruction (0x1f );
94+ public static final NoArgInstruction LLOAD_2 = new NoArgInstruction (0x20 );
95+ public static final NoArgInstruction LLOAD_3 = new NoArgInstruction (0x21 );
5896 public static final NoArgInstruction LRETURN = new NoArgInstruction (0xad );
5997 public static final BPInstruction LSTORE = new BPInstruction (0x37 );
98+ public static final NoArgInstruction LSTORE_0 = new NoArgInstruction (0x3f );
99+ public static final NoArgInstruction LSTORE_1 = new NoArgInstruction (0x40 );
100+ public static final NoArgInstruction LSTORE_2 = new NoArgInstruction (0x41 );
101+ public static final NoArgInstruction LSTORE_3 = new NoArgInstruction (0x42 );
60102 public static final CPInstruction <ClassEntry > NEW = new CPInstruction <>(0xbb );
61103 public static final BPInstruction NEWARRAY = new BPInstruction (0xbc );
62104 public static final NoArgInstruction NOP = new NoArgInstruction (0x00 );
@@ -164,7 +206,7 @@ protected BranchInstructionImpl(@Nonnull JvmInstruction instruction, int offset)
164206 @ Override
165207 public byte [] getBytes () {
166208 byte [] bytes ;
167- if (this .getInstruction ().getInstructionByte () == GOTO .getInstructionByte () ) {
209+ if (this .getInstruction ().getInstructionByte () == GOTO .getInstructionByte ()) {
168210 bytes = new byte []{(byte ) offset };
169211 } else {
170212 bytes = ByteUtils .twoBytesFromInt (offset );
@@ -173,4 +215,33 @@ public byte[] getBytes() {
173215 }
174216 }
175217 }
218+
219+ public static final class TPInstruction extends JvmInstruction {
220+
221+ private TPInstruction (int instructionByte ) {
222+ super (instructionByte );
223+ }
224+
225+ @ Nonnull
226+ public JvmInstructionImpl create (int index , int amount ) {
227+ return new TPInstructionImpl (this , index , amount );
228+ }
229+
230+ private static final class TPInstructionImpl extends JvmInstructionImpl {
231+
232+ private final int index ;
233+ private final int amount ;
234+
235+ protected TPInstructionImpl (@ Nonnull JvmInstruction instruction , int index , int amount ) {
236+ super (instruction );
237+ this .index = index ;
238+ this .amount = amount ;
239+ }
240+
241+ @ Override
242+ public byte [] getBytes () {
243+ return new byte []{getInstruction ().getInstructionByte (), (byte ) index , (byte ) amount };
244+ }
245+ }
246+ }
176247}
0 commit comments