1 /*
2  * Copyright (C) 2014 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package dexfuzz.rawdex;
18 
19 public enum Opcode {
20   NOP,
21   MOVE,
22   MOVE_FROM16,
23   MOVE_16,
24   MOVE_WIDE,
25   MOVE_WIDE_FROM16,
26   MOVE_WIDE_16,
27   MOVE_OBJECT,
28   MOVE_OBJECT_FROM16,
29   MOVE_OBJECT_16,
30   MOVE_RESULT,
31   MOVE_RESULT_WIDE,
32   MOVE_RESULT_OBJECT,
33   MOVE_EXCEPTION,
34   RETURN_VOID,
35   RETURN,
36   RETURN_WIDE,
37   RETURN_OBJECT,
38   CONST_4,
39   CONST_16,
40   CONST,
41   CONST_HIGH16,
42   CONST_WIDE_16,
43   CONST_WIDE_32,
44   CONST_WIDE,
45   CONST_WIDE_HIGH16,
46   CONST_STRING,
47   CONST_STRING_JUMBO,
48   CONST_CLASS,
49   MONITOR_ENTER,
50   MONITOR_EXIT,
51   CHECK_CAST,
52   INSTANCE_OF,
53   ARRAY_LENGTH,
54   NEW_INSTANCE,
55   NEW_ARRAY,
56   FILLED_NEW_ARRAY,
57   FILLED_NEW_ARRAY_RANGE,
58   FILL_ARRAY_DATA,
59   THROW,
60   GOTO,
61   GOTO_16,
62   GOTO_32,
63   PACKED_SWITCH,
64   SPARSE_SWITCH,
65   CMPL_FLOAT,
66   CMPG_FLOAT,
67   CMPL_DOUBLE,
68   CMPG_DOUBLE,
69   CMP_LONG,
70   IF_EQ,
71   IF_NE,
72   IF_LT,
73   IF_GE,
74   IF_GT,
75   IF_LE,
76   IF_EQZ,
77   IF_NEZ,
78   IF_LTZ,
79   IF_GEZ,
80   IF_GTZ,
81   IF_LEZ,
82   UNUSED_3E,
83   UNUSED_3F,
84   UNUSED_40,
85   UNUSED_41,
86   UNUSED_42,
87   UNUSED_43,
88   AGET,
89   AGET_WIDE,
90   AGET_OBJECT,
91   AGET_BOOLEAN,
92   AGET_BYTE,
93   AGET_CHAR,
94   AGET_SHORT,
95   APUT,
96   APUT_WIDE,
97   APUT_OBJECT,
98   APUT_BOOLEAN,
99   APUT_BYTE,
100   APUT_CHAR,
101   APUT_SHORT,
102   IGET,
103   IGET_WIDE,
104   IGET_OBJECT,
105   IGET_BOOLEAN,
106   IGET_BYTE,
107   IGET_CHAR,
108   IGET_SHORT,
109   IPUT,
110   IPUT_WIDE,
111   IPUT_OBJECT,
112   IPUT_BOOLEAN,
113   IPUT_BYTE,
114   IPUT_CHAR,
115   IPUT_SHORT,
116   SGET,
117   SGET_WIDE,
118   SGET_OBJECT,
119   SGET_BOOLEAN,
120   SGET_BYTE,
121   SGET_CHAR,
122   SGET_SHORT,
123   SPUT,
124   SPUT_WIDE,
125   SPUT_OBJECT,
126   SPUT_BOOLEAN,
127   SPUT_BYTE,
128   SPUT_CHAR,
129   SPUT_SHORT,
130   INVOKE_VIRTUAL,
131   INVOKE_SUPER,
132   INVOKE_DIRECT,
133   INVOKE_STATIC,
134   INVOKE_INTERFACE,
135   RETURN_VOID_NO_BARRIER,
136   INVOKE_VIRTUAL_RANGE,
137   INVOKE_SUPER_RANGE,
138   INVOKE_DIRECT_RANGE,
139   INVOKE_STATIC_RANGE,
140   INVOKE_INTERFACE_RANGE,
141   UNUSED_79,
142   UNUSED_7A,
143   NEG_INT,
144   NOT_INT,
145   NEG_LONG,
146   NOT_LONG,
147   NEG_FLOAT,
148   NEG_DOUBLE,
149   INT_TO_LONG,
150   INT_TO_FLOAT,
151   INT_TO_DOUBLE,
152   LONG_TO_INT,
153   LONG_TO_FLOAT,
154   LONG_TO_DOUBLE,
155   FLOAT_TO_INT,
156   FLOAT_TO_LONG,
157   FLOAT_TO_DOUBLE,
158   DOUBLE_TO_INT,
159   DOUBLE_TO_LONG,
160   DOUBLE_TO_FLOAT,
161   INT_TO_BYTE,
162   INT_TO_CHAR,
163   INT_TO_SHORT,
164   ADD_INT,
165   SUB_INT,
166   MUL_INT,
167   DIV_INT,
168   REM_INT,
169   AND_INT,
170   OR_INT,
171   XOR_INT,
172   SHL_INT,
173   SHR_INT,
174   USHR_INT,
175   ADD_LONG,
176   SUB_LONG,
177   MUL_LONG,
178   DIV_LONG,
179   REM_LONG,
180   AND_LONG,
181   OR_LONG,
182   XOR_LONG,
183   SHL_LONG,
184   SHR_LONG,
185   USHR_LONG,
186   ADD_FLOAT,
187   SUB_FLOAT,
188   MUL_FLOAT,
189   DIV_FLOAT,
190   REM_FLOAT,
191   ADD_DOUBLE,
192   SUB_DOUBLE,
193   MUL_DOUBLE,
194   DIV_DOUBLE,
195   REM_DOUBLE,
196   ADD_INT_2ADDR,
197   SUB_INT_2ADDR,
198   MUL_INT_2ADDR,
199   DIV_INT_2ADDR,
200   REM_INT_2ADDR,
201   AND_INT_2ADDR,
202   OR_INT_2ADDR,
203   XOR_INT_2ADDR,
204   SHL_INT_2ADDR,
205   SHR_INT_2ADDR,
206   USHR_INT_2ADDR,
207   ADD_LONG_2ADDR,
208   SUB_LONG_2ADDR,
209   MUL_LONG_2ADDR,
210   DIV_LONG_2ADDR,
211   REM_LONG_2ADDR,
212   AND_LONG_2ADDR,
213   OR_LONG_2ADDR,
214   XOR_LONG_2ADDR,
215   SHL_LONG_2ADDR,
216   SHR_LONG_2ADDR,
217   USHR_LONG_2ADDR,
218   ADD_FLOAT_2ADDR,
219   SUB_FLOAT_2ADDR,
220   MUL_FLOAT_2ADDR,
221   DIV_FLOAT_2ADDR,
222   REM_FLOAT_2ADDR,
223   ADD_DOUBLE_2ADDR,
224   SUB_DOUBLE_2ADDR,
225   MUL_DOUBLE_2ADDR,
226   DIV_DOUBLE_2ADDR,
227   REM_DOUBLE_2ADDR,
228   ADD_INT_LIT16,
229   RSUB_INT,
230   MUL_INT_LIT16,
231   DIV_INT_LIT16,
232   REM_INT_LIT16,
233   AND_INT_LIT16,
234   OR_INT_LIT16,
235   XOR_INT_LIT16,
236   ADD_INT_LIT8,
237   RSUB_INT_LIT8,
238   MUL_INT_LIT8,
239   DIV_INT_LIT8,
240   REM_INT_LIT8,
241   AND_INT_LIT8,
242   OR_INT_LIT8,
243   XOR_INT_LIT8,
244   SHL_INT_LIT8,
245   SHR_INT_LIT8,
246   USHR_INT_LIT8,
247   IGET_QUICK,
248   IGET_WIDE_QUICK,
249   IGET_OBJECT_QUICK,
250   IPUT_QUICK,
251   IPUT_WIDE_QUICK,
252   IPUT_OBJECT_QUICK,
253   INVOKE_VIRTUAL_QUICK,
254   INVOKE_VIRTUAL_QUICK_RANGE,
255   IPUT_BOOLEAN_QUICK,
256   IPUT_BYTE_QUICK,
257   IPUT_CHAR_QUICK,
258   IPUT_SHORT_QUICK,
259   UNUSED_EF,
260   UNUSED_F0,
261   UNUSED_F1,
262   UNUSED_F2,
263   UNUSED_F3,
264   UNUSED_F4,
265   UNUSED_F5,
266   UNUSED_F6,
267   UNUSED_F7,
268   UNUSED_F8,
269   UNUSED_F9,
270   UNUSED_FA,
271   UNUSED_FB,
272   UNUSED_FC,
273   UNUSED_FD,
274   UNUSED_FE,
275   UNUSED_FF;
276 
isBetween(Opcode opcode, Opcode opcode1, Opcode opcode2)277   public static boolean isBetween(Opcode opcode, Opcode opcode1, Opcode opcode2) {
278     return (opcode.ordinal() >= opcode1.ordinal() && opcode.ordinal() <= opcode2.ordinal());
279   }
280 }
281