ROSE 0.11.145.192
InstructionEnumsJvm.h
1#ifndef ROSE_BinaryAnalysis_InstructionEnumsJvm_H
2#define ROSE_BinaryAnalysis_InstructionEnumsJvm_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5
6/* References:
7 * [1] "The Java® Virtual Machine Specification Java SE 17 Edition"
8 * authors: Tim Lindholm Frank Yellin Gilad Bracha Alex Buckley Daniel Smith
9 * date: 2021-08-09
10 */
11
12namespace Rose {
13namespace BinaryAnalysis {
14
15// The Java Virtual Machine (JVM) instruction set Chapter 6 [1]
16//
17// Format of JVM instruction opcode (kind) description
18//
19// mnemonic = opcode (decimal) , opcode (hex) : # operands : [operands] : "Short description of the instruction"
20// -------- ---------------- ------------ ---------- ---------- --------------------------------------
21// nop = 0 , 0x00 : 0 : : "Do nothing"
22// ...
23// bipush = 16 , 0x10 : 1 : byte : "Push byte"
24// ...
25//
26
27// JVM instruction types.
28enum class JvmInstructionKind {
29 nop = 0, // 0x00:0:: "Do nothing"
30 aconst_null = 1, // 0x01: "Push null"
31 iconst_m1 = 2, // 0x02: "Push int constant -1"
32 iconst_0 = 3, // 0x03: "Push int constant 0"
33 iconst_1 = 4, // 0x04: "Push int constant 1"
34 iconst_2 = 5, // 0x05: "Push int constant 2"
35 iconst_3 = 6, // 0x06: "Push int constant 3"
36 iconst_4 = 7, // 0x07: "Push int constant 4"
37 iconst_5 = 8, // 0x08: "Push int constant 5"
38 lconst_0 = 9, // 0x09: "Push long constant 0"
39 lconst_1 = 10, // 0x0a: "Push long constant 1"
40 fconst_0 = 11, // 0x0b: "Push float 0.0"
41 fconst_1 = 12, // 0x0c: "Push float 1.0"
42 fconst_2 = 13, // 0x0d: "Push float 2.0"
43 dconst_0 = 14, // 0x0e: "Push double 0.0"
44 dconst_1 = 15, // 0x0f: "Push double 1.0"
45 bipush = 16, // 0x10 1: byte: "Push byte"
46 sipush = 17, // 0x11 2: byte1, byte2: "Push short"
47 ldc = 18, // 0x12 1: index: "Push item from run-time constant pool"
48 ldc_w = 19, // 0x13 2: indexbyte1, indexbyte2: "Push item from run-time constant pool (wide index)"
49 ldc2_w = 20, // 0x14 2: indexbyte1, indexbyte2: "Push long or double from run-time constant pool (wide index)"
50 iload = 21, // 0x15 1: index: "Load int from local variable"
51 lload = 22, // 0x16 1: index: "Load long from local variable"
52 fload = 23, // 0x17 1: index: "Load float from local variable"
53 dload = 24, // 0x18 1: index: "Load double from local variable"
54 aload = 25, // 0x19 1: index: "Load reference from local variable"
55 iload_0 = 26, // 0x1a: "Load int from local variable 0"
56 iload_1 = 27, // 0x1b: "Load int from local variable 1"
57 iload_2 = 28, // 0x1c: "Load int from local variable 2"
58 iload_3 = 29, // 0x1d: "Load int from local variable 3"
59 lload_0 = 30, // 0x1e: "Load long from local variable 0"
60 lload_1 = 31, // 0x1f: "Load long from local variable 1"
61 lload_2 = 32, // 0x20: "Load long from local variable 2"
62 lload_3 = 33, // 0x21: "Load long from local variable 3"
63 fload_0 = 34, // 0x22: "Load float from local variable 0"
64 fload_1 = 35, // 0x23: "Load float from local variable 1"
65 fload_2 = 36, // 0x24: "Load float from local variable 2"
66 fload_3 = 37, // 0x25: "Load float from local variable 3"
67 dload_0 = 38, // 0x26: "Load double from local variable 0"
68 dload_1 = 39, // 0x27: "Load double from local variable 1"
69 dload_2 = 40, // 0x28: "Load double from local variable 2"
70 dload_3 = 41, // 0x29: "Load double from local variable 3"
71 aload_0 = 42, // 0x2a: "Load reference from local variable 0"
72 aload_1 = 43, // 0x2b: "Load reference from local variable 1"
73 aload_2 = 44, // 0x2c: "Load reference from local variable 2"
74 aload_3 = 45, // 0x2d: "Load reference from local variable 3"
75 iaload = 46, // 0x2e: "Load int from array"
76 laload = 47, // 0x2f: "Load long from array"
77 faload = 48, // 0x30: "Load float from array"
78 daload = 49, // 0x31: "Load double from array"
79 aaload = 50, // 0x32: "Load reference from array"
80 baload = 51, // 0x33: "Load byte or boolean from array"
81 caload = 52, // 0x34: "Load char from array"
82 saload = 53, // 0x35: "Load short from array"
83 istore = 54, // 0x36 1: index "Store int into local variable at index"
84 lstore = 55, // 0x37 1: index
85 fstore = 56, // 0x38 1: index
86 dstore = 57, // 0x39 1: index
87 astore = 58, // 0x3a 1: index
88 istore_0 = 59, // 0x3b: "Store int into local variable 0"
89 istore_1 = 60, // 0x3c: "Store int into local variable 1"
90 istore_2 = 61, // 0x3d: "Store int into local variable 2"
91 istore_3 = 62, // 0x3e: "Store int into local variable 3"
92 lstore_0 = 63, // 0x3f: "Store long into local variable 0"
93 lstore_1 = 64, // 0x40: "Store long into local variable 1"
94 lstore_2 = 65, // 0x41: "Store long into local variable 2"
95 lstore_3 = 66, // 0x42: "Store long into local variable 3"
96 fstore_0 = 67, // 0x43: "Store float into local variable 0"
97 fstore_1 = 68, // 0x44: "Store float into local variable 1"
98 fstore_2 = 69, // 0x45: "Store float into local variable 2"
99 fstore_3 = 70, // 0x46: "Store float into local variable 3"
100 dstore_0 = 71, // 0x47: "Store double into local variable 0"
101 dstore_1 = 72, // 0x48: "Store double into local variable 1"
102 dstore_2 = 73, // 0x49: "Store double into local variable 2"
103 dstore_3 = 74, // 0x4a: "Store double into local variable 3"
104 astore_0 = 75, // 0x4b: "Store reference into local variable 0"
105 astore_1 = 76, // 0x4c: "Store reference into local variable 1"
106 astore_2 = 77, // 0x4d: "Store reference into local variable 2"
107 astore_3 = 78, // 0x4e: "Store reference into local variable 3"
108 iastore = 79, // 0x4f: "Store into int array"
109 lastore = 80, // 0x50: "Store into long array"
110 fastore = 81, // 0x51: "Store into float array"
111 dastore = 82, // 0x52: "Store into double array"
112 aastore = 83, // 0x53: "Store into reference array"
113 bastore = 84, // 0x54: "Store into byte or boolean array"
114 castore = 85, // 0x55: "Store into char array"
115 sastore = 86, // 0x56: "Store into short array"
116 pop = 87, // 0x57: "Pop the top operand stack value"
117 pop2 = 88, // 0x58: "Pop the top one or two operand stack values"
118 dup = 89, // 0x59: "Duplicate the top operand stack value"
119 dup_x1 = 90, // 0x5a: "Duplicate the top operand stack value and insert two values down"
120 dup_x2 = 91, // 0x5b: "Duplicate the top operand stack value and insert two or three values down"
121 dup2 = 92, // 0x5c: "Duplicate the top one or two operand stack values"
122 dup2_x1 = 93, // 0x5d: "Duplicate the top one or two operand stack values and insert two or three values down"
123 dup2_x2 = 94, // 0x5e: "Duplicate the top one or two operand stack values and insert two, three, or four values down"
124 swap = 95, // 0x5f: "Swap the top two operand stack values"
125 iadd = 96, // 0x60: "Add int"
126 ladd = 97, // 0x61: "Add long"
127 fadd = 98, // 0x62: "Add float"
128 dadd = 99, // 0x63: "Add double"
129 isub = 100, // 0x64: "Subtract int"
130 lsub = 101, // 0x65: "Subtract long"
131 fsub = 102, // 0x66: "Subtract float"
132 dsub = 103, // 0x67: "Subtract double"
133 imul = 104, // 0x68: "Multiply int"
134 lmul = 105, // 0x69: "Multiply long"
135 fmul = 106, // 0x6a: "Multiply float"
136 dmul = 107, // 0x6b: "Multiply double"
137 idiv = 108, // 0x6c: "Divide int"
138 ldiv = 109, // 0x6d: "Divide long"
139 fdiv = 110, // 0x6e: "Divide float"
140 ddiv = 111, // 0x6f: "Divide double"
141 irem = 112, // 0x70: "Remainder int"
142 lrem = 113, // 0x71: "Remainder long"
143 frem = 114, // 0x72: "Remainder float"
144 drem = 115, // 0x73: "Remainder double"
145 ineg = 116, // 0x74: "Negate int"
146 lneg = 117, // 0x75: "Negate long"
147 fneg = 118, // 0x76: "Negate float"
148 dneg = 119, // 0x77: "Negate double"
149 ishl = 120, // 0x78: "Shift left int"
150 lshl = 121, // 0x79: "Shift left long"
151 ishr = 122, // 0x7a: "Shift right int"
152 lshr = 123, // 0x7b: "Shift right long"
153 iushr = 124, // 0x7c: "Logical shift right int"
154 lushr = 125, // 0x7d: "Logical shift right long"
155 iand = 126, // 0x7e: "Boolean AND int"
156 land = 127, // 0x7f: "Boolean AND long"
157 ior = 128, // 0x80: "Boolean OR int"
158 lor = 129, // 0x81: "Boolean OR long"
159 ixor = 130, // 0x82: "Boolean XOR int"
160 lxor = 131, // 0x83: "Boolean XOR long"
161 iinc = 132, // 0x84:2: index, const: "Increment local variable"
162 i2l = 133, // 0x85: "Convert int to long"
163 i2f = 134, // 0x86: "Convert int to float"
164 i2d = 135, // 0x87: "Convert int to double"
165 l2i = 136, // 0x88: "Convert long to int"
166 l2f = 137, // 0x89: "Convert long to float"
167 l2d = 138, // 0x8a: "Convert long to double"
168 f2i = 139, // 0x8b: "Convert float to int"
169 f2l = 140, // 0x8c: "Convert float to long"
170 f2d = 141, // 0x8d: "Convert float to double"
171 d2i = 142, // 0x8e: "Convert double to int"
172 d2l = 143, // 0x8f: "Convert double to long"
173 d2f = 144, // 0x90: "Convert double to float"
174 i2b = 145, // 0x91: "Convert int to byte"
175 i2c = 146, // 0x92: "Convert int to char"
176 i2s = 147, // 0x93: "Convert int to short"
177 lcmp = 148, // 0x94: "Compare long"
178 fcmpl = 149, // 0x95: "Compare float"
179 fcmpg = 150, // 0x96: "Compare float"
180 dcmpl = 151, // 0x97: "Compare double"
181 dcmpg = 152, // 0x98: "Compare double"
182 ifeq = 153, // 0x99 2: branchbyte1, branchbyte2: "Branch if int comparison .eq. with zero succeeds"
183 ifne = 154, // 0x9a 2: branchbyte1, branchbyte2
184 iflt = 155, // 0x9b 2: branchbyte1, branchbyte2
185 ifge = 156, // 0x9c 2: branchbyte1, branchbyte2
186 ifgt = 157, // 0x9d 2: branchbyte1, branchbyte2
187 ifle = 158, // 0x9e 2: branchbyte1, branchbyte2
188 if_icmpeq = 159, // 0x9f 2: branchbyte1, branchbyte2
189 if_icmpne = 160, // 0xa0 2: branchbyte1, branchbyte2
190 if_icmplt = 161, // 0xa1 2: branchbyte1, branchbyte2
191 if_icmpge = 162, // 0xa2 2: branchbyte1, branchbyte2
192 if_icmpgt = 163, // 0xa3 2: branchbyte1, branchbyte2
193 if_icmple = 164, // 0xa4 2: branchbyte1, branchbyte2: "Branch if int comparison .le. succeeds"
194 if_acmpeq = 165, // 0xa5 2: branchbyte1, branchbyte2
195 if_acmpne = 166, // 0xa6 2: branchbyte1, branchbyte2
196 goto_ = 167, // 0xa7 2: branchbyte1, branchbyte2
197 jsr = 168, // 0xa8 2: branchbyte1, branchbyte2
198 ret = 169, // 0xa9 1: index
199 tableswitch = 170, // 0xaa 16+: [0-3 bytes padding],defaultbyte1,defaultbyte2,defaultbyte3,defaultbyte4,lowbye1,lowbyte2,lowbyte3,lowbyte4,highbyte1,highbyte2,highbyte3,highbyte4,jump offsets...
200 lookupswitch = 171, // 0xab 8+: <0-3 bytes padding>,defaultbyte1,defaultbyte2,defaultbyte3,defaultbyte4,npairs,npairs2,npairs3,npairs4,match-offset pairs...
201 ireturn = 172, // 0xac: "Return int from method"
202 lreturn = 173, // 0xad: "Return long from method"
203 freturn = 174, // 0xae: "Return float from method"
204 dreturn = 175, // 0xaf: "Return double from method"
205 areturn = 176, // 0xb0: "Return reference from method"
206 return_ = 177, // 0xb1: "Return void from method"
207 getstatic = 178, // 0xb2 2: indexbyte1, indexbyte2: "Get static field in class"
208 putstatic = 179, // 0xb3 2: indexbyte1, indexbyte2: "Set static field in class"
209 getfield = 180, // 0xb4 2: indexbyte1, indexbyte2: "Fetch field from object"
210 putfield = 181, // 0xb5 2: indexbyte1, indexbyte2: "Set field in object"
211 invokevirtual = 182, // 0xb6 2: indexbyte1, indexbyte2
212 invokespecial = 183, // 0xb7 2: indexbyte1, indexbyte2: "Invoke instance method; direct invocation of instance initialization methods and methods of the current class and its supertypes"
213 invokestatic = 184, // 0xb8 2: indexbyte1, indexbyte2
214 invokeinterface = 185, // 0xb9 4: indexbyte1, indexbyte2, count, 0
215 invokedynamic = 186, // 0xba 4: indexbyte1, indexbyte2, 0, 0
216 new_ = 187, // 0xbb 2: indexbyte1, indexbyte2
217 newarray = 188, // 0xbc 1: atype: "Create new array"
218 anewarray = 189, // 0xbd 2: indexbyte1, indexbyte2: "Create new array of reference"
219 arraylength = 190, // 0xbe: "Get length of array"
220 athrow = 191, // 0xbf: "Throw exception or error"
221 checkcast = 192, // 0xc0 2: indexbyte1, indexbyte2: "Check whether object is of given type"
222 instanceof = 193, // 0xc1 2: indexbyte1, indexbyte2: "Determine if object is of given type"
223 monitorenter = 194, // 0xc2: "Enter monitor for object"
224 monitorexit = 195, // 0xc3: "Exit monitor for object"
225 wide = 196, // 0xc4 3/5: opcode,indexbyte1,indexbyte2 or iinc,indexbyte1,indexbyte2,countbyte1,countbye2
226 multianewarray = 197, // 0xc5 3: indexbyte1, indexbyte2, dimensions
227 ifnull = 198, // 0xc6 2: branchbyte1, branchbyte2: "Branch if reference is null"
228 ifnonnull = 199, // 0xc7 2: branchbyte1, branchbyte2
229 goto_w = 200, // 0xc8 4: branchbyte1, branchbyte2, branchbyte3, branchbyte4
230 jsr_w = 201, // 0xc9 4: branchbyte1, branchbyte2, branchbyte3, branchbyte4
231 breakpoint = 202, // 0xca
232 impdep1 = 254, // 0xfe
233 impdep2 = 255, // 0xff
234 unknown = 666 // unknown/illegal opcode
235};
236
237} // namespace
238} // namespace
239
240#endif
241#endif
The ROSE library.