/
Instructions.java
681 lines (540 loc) · 18.9 KB
/
Instructions.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
package org.isk.jvmhardcore.pjba.instruction;
import org.isk.jvmhardcore.pjba.structure.Instruction;
import org.isk.jvmhardcore.pjba.util.BytecodeUtils;
public class Instructions {
final public static Instruction NOP = new NoArgInstruction(0x00, 0, 0);
final public static Instruction ACONST_NULL = new NoArgInstruction(0x01, 1, 0);
final public static Instruction ICONST_M1 = new NoArgInstruction(0x02, 1, 0);
final public static Instruction ICONST_0 = new NoArgInstruction(0x03, 1, 0);
final public static Instruction ICONST_1 = new NoArgInstruction(0x04, 1, 0);
final public static Instruction ICONST_2 = new NoArgInstruction(0x05, 1, 0);
final public static Instruction ICONST_3 = new NoArgInstruction(0x06, 1, 0);
final public static Instruction ICONST_4 = new NoArgInstruction(0x07, 1, 0);
final public static Instruction ICONST_5 = new NoArgInstruction(0x08, 1, 0);
final public static Instruction LCONST_0 = new NoArgInstruction(0x09, 2, 0);
final public static Instruction LCONST_1 = new NoArgInstruction(0x0a, 2, 0);
final public static Instruction FCONST_0 = new NoArgInstruction(0x0b, 1, 0);
final public static Instruction FCONST_1 = new NoArgInstruction(0x0c, 1, 0);
final public static Instruction FCONST_2 = new NoArgInstruction(0x0d, 1, 0);
final public static Instruction DCONST_0 = new NoArgInstruction(0x0e, 2, 0);
final public static Instruction DCONST_1 = new NoArgInstruction(0x0f, 2, 0);
final public static Instruction ILOAD_0 = new NoArgInstruction(0x1a, 1, 1);
final public static Instruction ILOAD_1 = new NoArgInstruction(0x1b, 1, 2);
final public static Instruction ILOAD_2 = new NoArgInstruction(0x1c, 1, 3);
final public static Instruction ILOAD_3 = new NoArgInstruction(0x1d, 1, 4);
final public static Instruction LLOAD_0 = new NoArgInstruction(0x1e, 2, 2);
final public static Instruction LLOAD_1 = new NoArgInstruction(0x1f, 2, 3);
final public static Instruction LLOAD_2 = new NoArgInstruction(0x20, 2, 4);
final public static Instruction LLOAD_3 = new NoArgInstruction(0x21, 2, 5);
final public static Instruction FLOAD_0 = new NoArgInstruction(0x22, 1, 1);
final public static Instruction FLOAD_1 = new NoArgInstruction(0x23, 1, 2);
final public static Instruction FLOAD_2 = new NoArgInstruction(0x24, 1, 3);
final public static Instruction FLOAD_3 = new NoArgInstruction(0x25, 1, 4);
final public static Instruction DLOAD_0 = new NoArgInstruction(0x26, 2, 2);
final public static Instruction DLOAD_1 = new NoArgInstruction(0x27, 2, 3);
final public static Instruction DLOAD_2 = new NoArgInstruction(0x28, 2, 4);
final public static Instruction DLOAD_3 = new NoArgInstruction(0x29, 2, 5);
final public static Instruction ALOAD_0 = new NoArgInstruction(0x2a, 1, 1);
final public static Instruction ALOAD_1 = new NoArgInstruction(0x2b, 1, 2);
final public static Instruction ALOAD_2 = new NoArgInstruction(0x2c, 1, 3);
final public static Instruction ALOAD_3 = new NoArgInstruction(0x2d, 1, 4);
final public static Instruction ISTORE_0 = new NoArgInstruction(0x3b, -1, 1);
final public static Instruction ISTORE_1 = new NoArgInstruction(0x3c, -1, 2);
final public static Instruction ISTORE_2 = new NoArgInstruction(0x3d, -1, 3);
final public static Instruction ISTORE_3 = new NoArgInstruction(0x3e, -1, 4);
final public static Instruction LSTORE_0 = new NoArgInstruction(0x3f, -2, 2);
final public static Instruction LSTORE_1 = new NoArgInstruction(0x40, -2, 3);
final public static Instruction LSTORE_2 = new NoArgInstruction(0x41, -2, 4);
final public static Instruction LSTORE_3 = new NoArgInstruction(0x42, -2, 5);
final public static Instruction FSTORE_0 = new NoArgInstruction(0x43, -1, 1);
final public static Instruction FSTORE_1 = new NoArgInstruction(0x44, -1, 2);
final public static Instruction FSTORE_2 = new NoArgInstruction(0x45, -1, 3);
final public static Instruction FSTORE_3 = new NoArgInstruction(0x46, -1, 4);
final public static Instruction DSTORE_0 = new NoArgInstruction(0x47, -2, 2);
final public static Instruction DSTORE_1 = new NoArgInstruction(0x48, -2, 3);
final public static Instruction DSTORE_2 = new NoArgInstruction(0x49, -2, 4);
final public static Instruction DSTORE_3 = new NoArgInstruction(0x4a, -2, 5);
final public static Instruction ASTORE_0 = new NoArgInstruction(0x4b, -1, 1);
final public static Instruction ASTORE_1 = new NoArgInstruction(0x4c, -1, 2);
final public static Instruction ASTORE_2 = new NoArgInstruction(0x4d, -1, 3);
final public static Instruction ASTORE_3 = new NoArgInstruction(0x4e, -1, 4);
final public static Instruction POP = new NoArgInstruction(0x57, -1, 0);
final public static Instruction POP2 = new NoArgInstruction(0x58, -2, 0);
final public static Instruction DUP = new NoArgInstruction(0x59, 1, 0);
final public static Instruction DUP_X1 = new NoArgInstruction(0x5a, 1, 0);
final public static Instruction DUP_X2 = new NoArgInstruction(0x5b, 1, 0);
final public static Instruction DUP2 = new NoArgInstruction(0x5c, 2, 0);
final public static Instruction DUP2_X1 = new NoArgInstruction(0x5d, 2, 0);
final public static Instruction DUP2_X2 = new NoArgInstruction(0x5e, 2, 0);
final public static Instruction SWAP = new NoArgInstruction(0x5f, 0, 0);
final public static Instruction IADD = new NoArgInstruction(0x60, -1, 0);
final public static Instruction LADD = new NoArgInstruction(0x61, -2, 0);
final public static Instruction FADD = new NoArgInstruction(0x62, -1, 0);
final public static Instruction DADD = new NoArgInstruction(0x63, -2, 0);
final public static Instruction ISUB = new NoArgInstruction(0x64, -1, 0);
final public static Instruction LSUB = new NoArgInstruction(0x65, -2, 0);
final public static Instruction FSUB = new NoArgInstruction(0x66, -1, 0);
final public static Instruction DSUB = new NoArgInstruction(0x67, -2, 0);
final public static Instruction IMUL = new NoArgInstruction(0x68, -1, 0);
final public static Instruction LMUL = new NoArgInstruction(0x69, -2, 0);
final public static Instruction FMUL = new NoArgInstruction(0x6a, -1, 0);
final public static Instruction DMUL = new NoArgInstruction(0x6b, -2, 0);
final public static Instruction IDIV = new NoArgInstruction(0x6c, -1, 0);
final public static Instruction LDIV = new NoArgInstruction(0x6d, -2, 0);
final public static Instruction FDIV = new NoArgInstruction(0x6e, -1, 0);
final public static Instruction DDIV = new NoArgInstruction(0x6f, -2, 0);
final public static Instruction IREM = new NoArgInstruction(0x70, -1, 0);
final public static Instruction LREM = new NoArgInstruction(0x71, -2, 0);
final public static Instruction FREM = new NoArgInstruction(0x72, -1, 0);
final public static Instruction DREM = new NoArgInstruction(0x73, -2, 0);
final public static Instruction INEG = new NoArgInstruction(0x74, 0, 0);
final public static Instruction LNEG = new NoArgInstruction(0x75, 0, 0);
final public static Instruction FNEG = new NoArgInstruction(0x76, 0, 0);
final public static Instruction DNEG = new NoArgInstruction(0x77, 0, 0);
final public static Instruction ISHL = new NoArgInstruction(0x78, -1, 0);
final public static Instruction LSHL = new NoArgInstruction(0x79, -2, 0);
final public static Instruction ISHR = new NoArgInstruction(0x7a, -1, 0);
final public static Instruction LSHR = new NoArgInstruction(0x7b, -2, 0);
final public static Instruction IUSHR = new NoArgInstruction(0x7c, -1, 0);
final public static Instruction LUSHR = new NoArgInstruction(0x7d, -2, 0);
final public static Instruction IAND = new NoArgInstruction(0x7e, -1, 0);
final public static Instruction LAND = new NoArgInstruction(0x7f, -2, 0);
final public static Instruction IOR = new NoArgInstruction(0x80, -1, 0);
final public static Instruction LOR = new NoArgInstruction(0x81, -2, 0);
final public static Instruction IXOR = new NoArgInstruction(0x82, -1, 0);
final public static Instruction LXOR = new NoArgInstruction(0x83, -2, 0);
final public static Instruction I2L = new NoArgInstruction(0x85, 1, 0);
final public static Instruction I2F = new NoArgInstruction(0x86, 0, 0);
final public static Instruction I2D = new NoArgInstruction(0x87, 1, 0);
final public static Instruction L2I = new NoArgInstruction(0x88, 0, 0);
final public static Instruction L2F = new NoArgInstruction(0x89, -1, 0);
final public static Instruction L2D = new NoArgInstruction(0x8a, 0, 0);
final public static Instruction F2I = new NoArgInstruction(0x8b, 0, 0);
final public static Instruction F2L = new NoArgInstruction(0x8c, 1, 0);
final public static Instruction F2D = new NoArgInstruction(0x8d, 1, 0);
final public static Instruction D2I = new NoArgInstruction(0x8e, -1, 0);
final public static Instruction D2L = new NoArgInstruction(0x8f, 0, 0);
final public static Instruction D2F = new NoArgInstruction(0x90, -1, 0);
final public static Instruction I2B = new NoArgInstruction(0x91, 0, 0);
final public static Instruction I2C = new NoArgInstruction(0x92, 0, 0);
final public static Instruction I2S = new NoArgInstruction(0x93, 0, 0);
final public static Instruction IRETURN = new NoArgInstruction(0xac, -1, 0);
final public static Instruction LRETURN = new NoArgInstruction(0xad, -2, 0);
final public static Instruction FRETURN = new NoArgInstruction(0xae, -1, 0);
final public static Instruction DRETURN = new NoArgInstruction(0xaf, -2, 0);
final public static Instruction ARETURN = new NoArgInstruction(0xb0, -1, 0);
final public static Instruction RETURN = new NoArgInstruction(0xb1, 0, 0);
private Instructions() {
}
public static Instruction nop() {
return NOP;
}
public static Instruction aconst_null() {
return ACONST_NULL;
}
public static Instruction iconst_m1() {
return ICONST_M1;
}
public static Instruction iconst_0() {
return ICONST_0;
}
public static Instruction iconst_1() {
return ICONST_1;
}
public static Instruction iconst_2() {
return ICONST_2;
}
public static Instruction iconst_3() {
return ICONST_3;
}
public static Instruction iconst_4() {
return ICONST_4;
}
public static Instruction iconst_5() {
return ICONST_5;
}
public static Instruction lconst_0() {
return LCONST_0;
}
public static Instruction lconst_1() {
return LCONST_1;
}
public static Instruction fconst_0() {
return FCONST_0;
}
public static Instruction fconst_1() {
return FCONST_1;
}
public static Instruction fconst_2() {
return FCONST_2;
}
public static Instruction dconst_0() {
return DCONST_0;
}
public static Instruction dconst_1() {
return DCONST_1;
}
public static Instruction bipush(byte value) {
return new ByteArgInstruction(0x10, 1, 0, value);
}
public static Instruction sipush(short value) {
return new ShortArgInstruction(0x11, 1, 0, value);
}
public static Instruction ldc(byte indexInCP) {
return new ByteArgInstruction(0x12, 1, 0, indexInCP);
}
public static Instruction ldc_w(short indexInCP) {
return new ShortArgInstruction(0x13, 1, 0, indexInCP);
}
public static Instruction ldc2_w(short indexInCP) {
return new ShortArgInstruction(0x14, 2, 0, indexInCP);
}
public static Instruction iload(byte indexInLV) {
return new ByteArgInstruction(0x15, 1, BytecodeUtils.unsign(indexInLV) + 1, indexInLV);
}
public static Instruction lload(byte indexInLV) {
return new ByteArgInstruction(0x16, 2, BytecodeUtils.unsign(indexInLV) + 2, indexInLV);
}
public static Instruction fload(byte indexInLV) {
return new ByteArgInstruction(0x17, 1, BytecodeUtils.unsign(indexInLV) + 1, indexInLV);
}
public static Instruction dload(byte indexInLV) {
return new ByteArgInstruction(0x18, 2, BytecodeUtils.unsign(indexInLV) + 2, indexInLV);
}
public static Instruction aload(byte indexInLV) {
return new ByteArgInstruction(0x19, 1, BytecodeUtils.unsign(indexInLV) + 1, indexInLV);
}
public static Instruction iload_0() {
return ILOAD_0;
}
public static Instruction iload_1() {
return ILOAD_1;
}
public static Instruction iload_2() {
return ILOAD_2;
}
public static Instruction iload_3() {
return ILOAD_3;
}
public static Instruction lload_0() {
return LLOAD_0;
}
public static Instruction lload_1() {
return LLOAD_1;
}
public static Instruction lload_2() {
return LLOAD_2;
}
public static Instruction lload_3() {
return LLOAD_3;
}
public static Instruction fload_0() {
return FLOAD_0;
}
public static Instruction fload_1() {
return FLOAD_1;
}
public static Instruction fload_2() {
return FLOAD_2;
}
public static Instruction fload_3() {
return FLOAD_3;
}
public static Instruction dload_0() {
return DLOAD_0;
}
public static Instruction dload_1() {
return DLOAD_1;
}
public static Instruction dload_2() {
return DLOAD_2;
}
public static Instruction dload_3() {
return DLOAD_3;
}
public static Instruction aload_0() {
return ALOAD_0;
}
public static Instruction aload_1() {
return ALOAD_1;
}
public static Instruction aload_2() {
return ALOAD_2;
}
public static Instruction aload_3() {
return ALOAD_3;
}
public static Instruction istore(byte indexInLV) {
return new ByteArgInstruction(0x36, -1, BytecodeUtils.unsign(indexInLV) + 1, indexInLV);
}
public static Instruction lstore(byte indexInLV) {
return new ByteArgInstruction(0x37, -2, BytecodeUtils.unsign(indexInLV) + 2, indexInLV);
}
public static Instruction fstore(byte indexInLV) {
return new ByteArgInstruction(0x38, -1, BytecodeUtils.unsign(indexInLV) + 1, indexInLV);
}
public static Instruction dstore(byte indexInLV) {
return new ByteArgInstruction(0x39, -2, BytecodeUtils.unsign(indexInLV) + 2, indexInLV);
}
public static Instruction astore(byte indexInLV) {
return new ByteArgInstruction(0x3a, -1, BytecodeUtils.unsign(indexInLV) + 1, indexInLV);
}
public static Instruction istore_0() {
return ISTORE_0;
}
public static Instruction istore_1() {
return ISTORE_1;
}
public static Instruction istore_2() {
return ISTORE_2;
}
public static Instruction istore_3() {
return ISTORE_3;
}
public static Instruction lstore_0() {
return LSTORE_0;
}
public static Instruction lstore_1() {
return LSTORE_1;
}
public static Instruction lstore_2() {
return LSTORE_2;
}
public static Instruction lstore_3() {
return LSTORE_3;
}
public static Instruction fstore_0() {
return FSTORE_0;
}
public static Instruction fstore_1() {
return FSTORE_1;
}
public static Instruction fstore_2() {
return FSTORE_2;
}
public static Instruction fstore_3() {
return FSTORE_3;
}
public static Instruction dstore_0() {
return DSTORE_0;
}
public static Instruction dstore_1() {
return DSTORE_1;
}
public static Instruction dstore_2() {
return DSTORE_2;
}
public static Instruction dstore_3() {
return DSTORE_3;
}
public static Instruction astore_0() {
return ASTORE_0;
}
public static Instruction astore_1() {
return ASTORE_1;
}
public static Instruction astore_2() {
return ASTORE_2;
}
public static Instruction astore_3() {
return ASTORE_3;
}
public static Instruction pop() {
return POP;
}
public static Instruction pop2() {
return POP2;
}
public static Instruction dup() {
return DUP;
}
public static Instruction dup_x1() {
return DUP_X1;
}
public static Instruction dup_x2() {
return DUP_X2;
}
public static Instruction dup2() {
return DUP2;
}
public static Instruction dup2_x1() {
return DUP2_X1;
}
public static Instruction dup2_x2() {
return DUP2_X2;
}
public static Instruction swap() {
return SWAP;
}
public static Instruction iadd() {
return IADD;
}
public static Instruction ladd() {
return LADD;
}
public static Instruction fadd() {
return FADD;
}
public static Instruction dadd() {
return DADD;
}
public static Instruction isub() {
return ISUB;
}
public static Instruction lsub() {
return LSUB;
}
public static Instruction fsub() {
return FSUB;
}
public static Instruction dsub() {
return DSUB;
}
public static Instruction imul() {
return IMUL;
}
public static Instruction lmul() {
return LMUL;
}
public static Instruction fmul() {
return FMUL;
}
public static Instruction dmul() {
return DMUL;
}
public static Instruction idiv() {
return IDIV;
}
public static Instruction ldiv() {
return LDIV;
}
public static Instruction fdiv() {
return FDIV;
}
public static Instruction ddiv() {
return DDIV;
}
public static Instruction irem() {
return IREM;
}
public static Instruction lrem() {
return LREM;
}
public static Instruction frem() {
return FREM;
}
public static Instruction drem() {
return DREM;
}
public static Instruction ineg() {
return INEG;
}
public static Instruction lneg() {
return LNEG;
}
public static Instruction fneg() {
return FNEG;
}
public static Instruction dneg() {
return DNEG;
}
public static Instruction ishl() {
return ISHL;
}
public static Instruction lshl() {
return LSHL;
}
public static Instruction ishr() {
return ISHR;
}
public static Instruction lshr() {
return LSHR;
}
public static Instruction iushr() {
return IUSHR;
}
public static Instruction lushr() {
return LUSHR;
}
public static Instruction iand() {
return IAND;
}
public static Instruction land() {
return LAND;
}
public static Instruction ior() {
return IOR;
}
public static Instruction lor() {
return LOR;
}
public static Instruction ixor() {
return IXOR;
}
public static Instruction lxor() {
return LXOR;
}
public static Instruction i2l() {
return I2L;
}
public static Instruction i2f() {
return I2F;
}
public static Instruction i2d() {
return I2D;
}
public static Instruction l2i() {
return L2I;
}
public static Instruction l2f() {
return L2F;
}
public static Instruction l2d() {
return L2D;
}
public static Instruction f2i() {
return F2I;
}
public static Instruction f2l() {
return F2L;
}
public static Instruction f2d() {
return F2D;
}
public static Instruction d2i() {
return D2I;
}
public static Instruction d2l() {
return D2L;
}
public static Instruction d2f() {
return D2F;
}
public static Instruction i2b() {
return I2B;
}
public static Instruction i2c() {
return I2C;
}
public static Instruction i2s() {
return I2S;
}
public static Instruction ireturn() {
return IRETURN;
}
public static Instruction lreturn() {
return LRETURN;
}
public static Instruction freturn() {
return FRETURN;
}
public static Instruction dreturn() {
return DRETURN;
}
public static Instruction areturn() {
return ARETURN;
}
public static Instruction return_() {
return RETURN;
}
}