1 /*
2  * Copyright (C) 2008 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 /*
18  * Table of Dalvik opcode names.
19  *
20  * IMPORTANT NOTE: The contents of this file are mostly generated
21  * automatically by the opcode-gen tool. Any edits to the generated
22  * sections will get wiped out the next time the tool is run.
23  */
24 
25 #include "DexOpcodes.h"
26 #include <assert.h>
27 
28 /*
29  * Dalvik opcode names.
30  */
31 static const char* gOpNames[kNumPackedOpcodes] = {
32     // BEGIN(libdex-opcode-names); GENERATED AUTOMATICALLY BY opcode-gen
33     "nop",
34     "move",
35     "move/from16",
36     "move/16",
37     "move-wide",
38     "move-wide/from16",
39     "move-wide/16",
40     "move-object",
41     "move-object/from16",
42     "move-object/16",
43     "move-result",
44     "move-result-wide",
45     "move-result-object",
46     "move-exception",
47     "return-void",
48     "return",
49     "return-wide",
50     "return-object",
51     "const/4",
52     "const/16",
53     "const",
54     "const/high16",
55     "const-wide/16",
56     "const-wide/32",
57     "const-wide",
58     "const-wide/high16",
59     "const-string",
60     "const-string/jumbo",
61     "const-class",
62     "monitor-enter",
63     "monitor-exit",
64     "check-cast",
65     "instance-of",
66     "array-length",
67     "new-instance",
68     "new-array",
69     "filled-new-array",
70     "filled-new-array/range",
71     "fill-array-data",
72     "throw",
73     "goto",
74     "goto/16",
75     "goto/32",
76     "packed-switch",
77     "sparse-switch",
78     "cmpl-float",
79     "cmpg-float",
80     "cmpl-double",
81     "cmpg-double",
82     "cmp-long",
83     "if-eq",
84     "if-ne",
85     "if-lt",
86     "if-ge",
87     "if-gt",
88     "if-le",
89     "if-eqz",
90     "if-nez",
91     "if-ltz",
92     "if-gez",
93     "if-gtz",
94     "if-lez",
95     "unused-3e",
96     "unused-3f",
97     "unused-40",
98     "unused-41",
99     "unused-42",
100     "unused-43",
101     "aget",
102     "aget-wide",
103     "aget-object",
104     "aget-boolean",
105     "aget-byte",
106     "aget-char",
107     "aget-short",
108     "aput",
109     "aput-wide",
110     "aput-object",
111     "aput-boolean",
112     "aput-byte",
113     "aput-char",
114     "aput-short",
115     "iget",
116     "iget-wide",
117     "iget-object",
118     "iget-boolean",
119     "iget-byte",
120     "iget-char",
121     "iget-short",
122     "iput",
123     "iput-wide",
124     "iput-object",
125     "iput-boolean",
126     "iput-byte",
127     "iput-char",
128     "iput-short",
129     "sget",
130     "sget-wide",
131     "sget-object",
132     "sget-boolean",
133     "sget-byte",
134     "sget-char",
135     "sget-short",
136     "sput",
137     "sput-wide",
138     "sput-object",
139     "sput-boolean",
140     "sput-byte",
141     "sput-char",
142     "sput-short",
143     "invoke-virtual",
144     "invoke-super",
145     "invoke-direct",
146     "invoke-static",
147     "invoke-interface",
148     "unused-73",
149     "invoke-virtual/range",
150     "invoke-super/range",
151     "invoke-direct/range",
152     "invoke-static/range",
153     "invoke-interface/range",
154     "unused-79",
155     "unused-7a",
156     "neg-int",
157     "not-int",
158     "neg-long",
159     "not-long",
160     "neg-float",
161     "neg-double",
162     "int-to-long",
163     "int-to-float",
164     "int-to-double",
165     "long-to-int",
166     "long-to-float",
167     "long-to-double",
168     "float-to-int",
169     "float-to-long",
170     "float-to-double",
171     "double-to-int",
172     "double-to-long",
173     "double-to-float",
174     "int-to-byte",
175     "int-to-char",
176     "int-to-short",
177     "add-int",
178     "sub-int",
179     "mul-int",
180     "div-int",
181     "rem-int",
182     "and-int",
183     "or-int",
184     "xor-int",
185     "shl-int",
186     "shr-int",
187     "ushr-int",
188     "add-long",
189     "sub-long",
190     "mul-long",
191     "div-long",
192     "rem-long",
193     "and-long",
194     "or-long",
195     "xor-long",
196     "shl-long",
197     "shr-long",
198     "ushr-long",
199     "add-float",
200     "sub-float",
201     "mul-float",
202     "div-float",
203     "rem-float",
204     "add-double",
205     "sub-double",
206     "mul-double",
207     "div-double",
208     "rem-double",
209     "add-int/2addr",
210     "sub-int/2addr",
211     "mul-int/2addr",
212     "div-int/2addr",
213     "rem-int/2addr",
214     "and-int/2addr",
215     "or-int/2addr",
216     "xor-int/2addr",
217     "shl-int/2addr",
218     "shr-int/2addr",
219     "ushr-int/2addr",
220     "add-long/2addr",
221     "sub-long/2addr",
222     "mul-long/2addr",
223     "div-long/2addr",
224     "rem-long/2addr",
225     "and-long/2addr",
226     "or-long/2addr",
227     "xor-long/2addr",
228     "shl-long/2addr",
229     "shr-long/2addr",
230     "ushr-long/2addr",
231     "add-float/2addr",
232     "sub-float/2addr",
233     "mul-float/2addr",
234     "div-float/2addr",
235     "rem-float/2addr",
236     "add-double/2addr",
237     "sub-double/2addr",
238     "mul-double/2addr",
239     "div-double/2addr",
240     "rem-double/2addr",
241     "add-int/lit16",
242     "rsub-int",
243     "mul-int/lit16",
244     "div-int/lit16",
245     "rem-int/lit16",
246     "and-int/lit16",
247     "or-int/lit16",
248     "xor-int/lit16",
249     "add-int/lit8",
250     "rsub-int/lit8",
251     "mul-int/lit8",
252     "div-int/lit8",
253     "rem-int/lit8",
254     "and-int/lit8",
255     "or-int/lit8",
256     "xor-int/lit8",
257     "shl-int/lit8",
258     "shr-int/lit8",
259     "ushr-int/lit8",
260     "+iget-volatile",
261     "+iput-volatile",
262     "+sget-volatile",
263     "+sput-volatile",
264     "+iget-object-volatile",
265     "+iget-wide-volatile",
266     "+iput-wide-volatile",
267     "+sget-wide-volatile",
268     "+sput-wide-volatile",
269     "^breakpoint",
270     "^throw-verification-error",
271     "+execute-inline",
272     "+execute-inline/range",
273     "+invoke-object-init/range",
274     "+return-void-barrier",
275     "+iget-quick",
276     "unused-f3",
277     "unused-f4",
278     "unused-f5",
279     "unused-f6",
280     "unused-f7",
281     "unused-f8",
282     "unused-f9",
283     "invoke-polymorphic",
284     "invoke-polymorphic/range",
285     "invoke-custom",
286     "invoke-custom/range",
287     "const-method-handle",
288     "const-method-type",
289     // END(libdex-opcode-names)
290 };
291 
292 /*
293  * Return the name of an opcode.
294  */
dexGetOpcodeName(Opcode op)295 const char* dexGetOpcodeName(Opcode op)
296 {
297     assert(op >= 0 && op < kNumPackedOpcodes);
298     return gOpNames[op];
299 }
300