1 /*
2  * Copyright (C) 2011 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 com.android.dx.io;
18 
19 import com.android.dx.io.instructions.InstructionCodec;
20 import com.android.dx.util.Hex;
21 
22 /**
23  * Information about each Dalvik opcode.
24  */
25 public final class OpcodeInfo {
26     /*
27      * TODO: Merge at least most of the info from the Dops class into
28      * this one.
29      */
30 
31     /** non-null; array containing all the information */
32     private static final Info[] INFO;
33 
34     /**
35      * pseudo-opcode used for nonstandard formatted "instructions"
36      * (which are mostly not actually instructions, though they do
37      * appear in instruction lists). TODO: Retire the usage of this
38      * constant.
39      */
40     public static final Info SPECIAL_FORMAT =
41         new Info(Opcodes.SPECIAL_FORMAT, "<special>",
42                 InstructionCodec.FORMAT_00X, IndexType.NONE);
43 
44     // TODO: These payload opcodes should be generated by opcode-gen.
45 
46     public static final Info PACKED_SWITCH_PAYLOAD =
47         new Info(Opcodes.PACKED_SWITCH_PAYLOAD, "packed-switch-payload",
48                 InstructionCodec.FORMAT_PACKED_SWITCH_PAYLOAD,
49                 IndexType.NONE);
50 
51     public static final Info SPARSE_SWITCH_PAYLOAD =
52         new Info(Opcodes.SPARSE_SWITCH_PAYLOAD, "sparse-switch-payload",
53                 InstructionCodec.FORMAT_SPARSE_SWITCH_PAYLOAD,
54                 IndexType.NONE);
55 
56     public static final Info FILL_ARRAY_DATA_PAYLOAD =
57         new Info(Opcodes.FILL_ARRAY_DATA_PAYLOAD, "fill-array-data-payload",
58                 InstructionCodec.FORMAT_FILL_ARRAY_DATA_PAYLOAD,
59                 IndexType.NONE);
60 
61     // BEGIN(opcode-info-defs); GENERATED AUTOMATICALLY BY opcode-gen
62     public static final Info NOP =
63         new Info(Opcodes.NOP, "nop",
64             InstructionCodec.FORMAT_10X, IndexType.NONE);
65 
66     public static final Info MOVE =
67         new Info(Opcodes.MOVE, "move",
68             InstructionCodec.FORMAT_12X, IndexType.NONE);
69 
70     public static final Info MOVE_FROM16 =
71         new Info(Opcodes.MOVE_FROM16, "move/from16",
72             InstructionCodec.FORMAT_22X, IndexType.NONE);
73 
74     public static final Info MOVE_16 =
75         new Info(Opcodes.MOVE_16, "move/16",
76             InstructionCodec.FORMAT_32X, IndexType.NONE);
77 
78     public static final Info MOVE_WIDE =
79         new Info(Opcodes.MOVE_WIDE, "move-wide",
80             InstructionCodec.FORMAT_12X, IndexType.NONE);
81 
82     public static final Info MOVE_WIDE_FROM16 =
83         new Info(Opcodes.MOVE_WIDE_FROM16, "move-wide/from16",
84             InstructionCodec.FORMAT_22X, IndexType.NONE);
85 
86     public static final Info MOVE_WIDE_16 =
87         new Info(Opcodes.MOVE_WIDE_16, "move-wide/16",
88             InstructionCodec.FORMAT_32X, IndexType.NONE);
89 
90     public static final Info MOVE_OBJECT =
91         new Info(Opcodes.MOVE_OBJECT, "move-object",
92             InstructionCodec.FORMAT_12X, IndexType.NONE);
93 
94     public static final Info MOVE_OBJECT_FROM16 =
95         new Info(Opcodes.MOVE_OBJECT_FROM16, "move-object/from16",
96             InstructionCodec.FORMAT_22X, IndexType.NONE);
97 
98     public static final Info MOVE_OBJECT_16 =
99         new Info(Opcodes.MOVE_OBJECT_16, "move-object/16",
100             InstructionCodec.FORMAT_32X, IndexType.NONE);
101 
102     public static final Info MOVE_RESULT =
103         new Info(Opcodes.MOVE_RESULT, "move-result",
104             InstructionCodec.FORMAT_11X, IndexType.NONE);
105 
106     public static final Info MOVE_RESULT_WIDE =
107         new Info(Opcodes.MOVE_RESULT_WIDE, "move-result-wide",
108             InstructionCodec.FORMAT_11X, IndexType.NONE);
109 
110     public static final Info MOVE_RESULT_OBJECT =
111         new Info(Opcodes.MOVE_RESULT_OBJECT, "move-result-object",
112             InstructionCodec.FORMAT_11X, IndexType.NONE);
113 
114     public static final Info MOVE_EXCEPTION =
115         new Info(Opcodes.MOVE_EXCEPTION, "move-exception",
116             InstructionCodec.FORMAT_11X, IndexType.NONE);
117 
118     public static final Info RETURN_VOID =
119         new Info(Opcodes.RETURN_VOID, "return-void",
120             InstructionCodec.FORMAT_10X, IndexType.NONE);
121 
122     public static final Info RETURN =
123         new Info(Opcodes.RETURN, "return",
124             InstructionCodec.FORMAT_11X, IndexType.NONE);
125 
126     public static final Info RETURN_WIDE =
127         new Info(Opcodes.RETURN_WIDE, "return-wide",
128             InstructionCodec.FORMAT_11X, IndexType.NONE);
129 
130     public static final Info RETURN_OBJECT =
131         new Info(Opcodes.RETURN_OBJECT, "return-object",
132             InstructionCodec.FORMAT_11X, IndexType.NONE);
133 
134     public static final Info CONST_4 =
135         new Info(Opcodes.CONST_4, "const/4",
136             InstructionCodec.FORMAT_11N, IndexType.NONE);
137 
138     public static final Info CONST_16 =
139         new Info(Opcodes.CONST_16, "const/16",
140             InstructionCodec.FORMAT_21S, IndexType.NONE);
141 
142     public static final Info CONST =
143         new Info(Opcodes.CONST, "const",
144             InstructionCodec.FORMAT_31I, IndexType.NONE);
145 
146     public static final Info CONST_HIGH16 =
147         new Info(Opcodes.CONST_HIGH16, "const/high16",
148             InstructionCodec.FORMAT_21H, IndexType.NONE);
149 
150     public static final Info CONST_WIDE_16 =
151         new Info(Opcodes.CONST_WIDE_16, "const-wide/16",
152             InstructionCodec.FORMAT_21S, IndexType.NONE);
153 
154     public static final Info CONST_WIDE_32 =
155         new Info(Opcodes.CONST_WIDE_32, "const-wide/32",
156             InstructionCodec.FORMAT_31I, IndexType.NONE);
157 
158     public static final Info CONST_WIDE =
159         new Info(Opcodes.CONST_WIDE, "const-wide",
160             InstructionCodec.FORMAT_51L, IndexType.NONE);
161 
162     public static final Info CONST_WIDE_HIGH16 =
163         new Info(Opcodes.CONST_WIDE_HIGH16, "const-wide/high16",
164             InstructionCodec.FORMAT_21H, IndexType.NONE);
165 
166     public static final Info CONST_STRING =
167         new Info(Opcodes.CONST_STRING, "const-string",
168             InstructionCodec.FORMAT_21C, IndexType.STRING_REF);
169 
170     public static final Info CONST_STRING_JUMBO =
171         new Info(Opcodes.CONST_STRING_JUMBO, "const-string/jumbo",
172             InstructionCodec.FORMAT_31C, IndexType.STRING_REF);
173 
174     public static final Info CONST_CLASS =
175         new Info(Opcodes.CONST_CLASS, "const-class",
176             InstructionCodec.FORMAT_21C, IndexType.TYPE_REF);
177 
178     public static final Info MONITOR_ENTER =
179         new Info(Opcodes.MONITOR_ENTER, "monitor-enter",
180             InstructionCodec.FORMAT_11X, IndexType.NONE);
181 
182     public static final Info MONITOR_EXIT =
183         new Info(Opcodes.MONITOR_EXIT, "monitor-exit",
184             InstructionCodec.FORMAT_11X, IndexType.NONE);
185 
186     public static final Info CHECK_CAST =
187         new Info(Opcodes.CHECK_CAST, "check-cast",
188             InstructionCodec.FORMAT_21C, IndexType.TYPE_REF);
189 
190     public static final Info INSTANCE_OF =
191         new Info(Opcodes.INSTANCE_OF, "instance-of",
192             InstructionCodec.FORMAT_22C, IndexType.TYPE_REF);
193 
194     public static final Info ARRAY_LENGTH =
195         new Info(Opcodes.ARRAY_LENGTH, "array-length",
196             InstructionCodec.FORMAT_12X, IndexType.NONE);
197 
198     public static final Info NEW_INSTANCE =
199         new Info(Opcodes.NEW_INSTANCE, "new-instance",
200             InstructionCodec.FORMAT_21C, IndexType.TYPE_REF);
201 
202     public static final Info NEW_ARRAY =
203         new Info(Opcodes.NEW_ARRAY, "new-array",
204             InstructionCodec.FORMAT_22C, IndexType.TYPE_REF);
205 
206     public static final Info FILLED_NEW_ARRAY =
207         new Info(Opcodes.FILLED_NEW_ARRAY, "filled-new-array",
208             InstructionCodec.FORMAT_35C, IndexType.TYPE_REF);
209 
210     public static final Info FILLED_NEW_ARRAY_RANGE =
211         new Info(Opcodes.FILLED_NEW_ARRAY_RANGE, "filled-new-array/range",
212             InstructionCodec.FORMAT_3RC, IndexType.TYPE_REF);
213 
214     public static final Info FILL_ARRAY_DATA =
215         new Info(Opcodes.FILL_ARRAY_DATA, "fill-array-data",
216             InstructionCodec.FORMAT_31T, IndexType.NONE);
217 
218     public static final Info THROW =
219         new Info(Opcodes.THROW, "throw",
220             InstructionCodec.FORMAT_11X, IndexType.NONE);
221 
222     public static final Info GOTO =
223         new Info(Opcodes.GOTO, "goto",
224             InstructionCodec.FORMAT_10T, IndexType.NONE);
225 
226     public static final Info GOTO_16 =
227         new Info(Opcodes.GOTO_16, "goto/16",
228             InstructionCodec.FORMAT_20T, IndexType.NONE);
229 
230     public static final Info GOTO_32 =
231         new Info(Opcodes.GOTO_32, "goto/32",
232             InstructionCodec.FORMAT_30T, IndexType.NONE);
233 
234     public static final Info PACKED_SWITCH =
235         new Info(Opcodes.PACKED_SWITCH, "packed-switch",
236             InstructionCodec.FORMAT_31T, IndexType.NONE);
237 
238     public static final Info SPARSE_SWITCH =
239         new Info(Opcodes.SPARSE_SWITCH, "sparse-switch",
240             InstructionCodec.FORMAT_31T, IndexType.NONE);
241 
242     public static final Info CMPL_FLOAT =
243         new Info(Opcodes.CMPL_FLOAT, "cmpl-float",
244             InstructionCodec.FORMAT_23X, IndexType.NONE);
245 
246     public static final Info CMPG_FLOAT =
247         new Info(Opcodes.CMPG_FLOAT, "cmpg-float",
248             InstructionCodec.FORMAT_23X, IndexType.NONE);
249 
250     public static final Info CMPL_DOUBLE =
251         new Info(Opcodes.CMPL_DOUBLE, "cmpl-double",
252             InstructionCodec.FORMAT_23X, IndexType.NONE);
253 
254     public static final Info CMPG_DOUBLE =
255         new Info(Opcodes.CMPG_DOUBLE, "cmpg-double",
256             InstructionCodec.FORMAT_23X, IndexType.NONE);
257 
258     public static final Info CMP_LONG =
259         new Info(Opcodes.CMP_LONG, "cmp-long",
260             InstructionCodec.FORMAT_23X, IndexType.NONE);
261 
262     public static final Info IF_EQ =
263         new Info(Opcodes.IF_EQ, "if-eq",
264             InstructionCodec.FORMAT_22T, IndexType.NONE);
265 
266     public static final Info IF_NE =
267         new Info(Opcodes.IF_NE, "if-ne",
268             InstructionCodec.FORMAT_22T, IndexType.NONE);
269 
270     public static final Info IF_LT =
271         new Info(Opcodes.IF_LT, "if-lt",
272             InstructionCodec.FORMAT_22T, IndexType.NONE);
273 
274     public static final Info IF_GE =
275         new Info(Opcodes.IF_GE, "if-ge",
276             InstructionCodec.FORMAT_22T, IndexType.NONE);
277 
278     public static final Info IF_GT =
279         new Info(Opcodes.IF_GT, "if-gt",
280             InstructionCodec.FORMAT_22T, IndexType.NONE);
281 
282     public static final Info IF_LE =
283         new Info(Opcodes.IF_LE, "if-le",
284             InstructionCodec.FORMAT_22T, IndexType.NONE);
285 
286     public static final Info IF_EQZ =
287         new Info(Opcodes.IF_EQZ, "if-eqz",
288             InstructionCodec.FORMAT_21T, IndexType.NONE);
289 
290     public static final Info IF_NEZ =
291         new Info(Opcodes.IF_NEZ, "if-nez",
292             InstructionCodec.FORMAT_21T, IndexType.NONE);
293 
294     public static final Info IF_LTZ =
295         new Info(Opcodes.IF_LTZ, "if-ltz",
296             InstructionCodec.FORMAT_21T, IndexType.NONE);
297 
298     public static final Info IF_GEZ =
299         new Info(Opcodes.IF_GEZ, "if-gez",
300             InstructionCodec.FORMAT_21T, IndexType.NONE);
301 
302     public static final Info IF_GTZ =
303         new Info(Opcodes.IF_GTZ, "if-gtz",
304             InstructionCodec.FORMAT_21T, IndexType.NONE);
305 
306     public static final Info IF_LEZ =
307         new Info(Opcodes.IF_LEZ, "if-lez",
308             InstructionCodec.FORMAT_21T, IndexType.NONE);
309 
310     public static final Info AGET =
311         new Info(Opcodes.AGET, "aget",
312             InstructionCodec.FORMAT_23X, IndexType.NONE);
313 
314     public static final Info AGET_WIDE =
315         new Info(Opcodes.AGET_WIDE, "aget-wide",
316             InstructionCodec.FORMAT_23X, IndexType.NONE);
317 
318     public static final Info AGET_OBJECT =
319         new Info(Opcodes.AGET_OBJECT, "aget-object",
320             InstructionCodec.FORMAT_23X, IndexType.NONE);
321 
322     public static final Info AGET_BOOLEAN =
323         new Info(Opcodes.AGET_BOOLEAN, "aget-boolean",
324             InstructionCodec.FORMAT_23X, IndexType.NONE);
325 
326     public static final Info AGET_BYTE =
327         new Info(Opcodes.AGET_BYTE, "aget-byte",
328             InstructionCodec.FORMAT_23X, IndexType.NONE);
329 
330     public static final Info AGET_CHAR =
331         new Info(Opcodes.AGET_CHAR, "aget-char",
332             InstructionCodec.FORMAT_23X, IndexType.NONE);
333 
334     public static final Info AGET_SHORT =
335         new Info(Opcodes.AGET_SHORT, "aget-short",
336             InstructionCodec.FORMAT_23X, IndexType.NONE);
337 
338     public static final Info APUT =
339         new Info(Opcodes.APUT, "aput",
340             InstructionCodec.FORMAT_23X, IndexType.NONE);
341 
342     public static final Info APUT_WIDE =
343         new Info(Opcodes.APUT_WIDE, "aput-wide",
344             InstructionCodec.FORMAT_23X, IndexType.NONE);
345 
346     public static final Info APUT_OBJECT =
347         new Info(Opcodes.APUT_OBJECT, "aput-object",
348             InstructionCodec.FORMAT_23X, IndexType.NONE);
349 
350     public static final Info APUT_BOOLEAN =
351         new Info(Opcodes.APUT_BOOLEAN, "aput-boolean",
352             InstructionCodec.FORMAT_23X, IndexType.NONE);
353 
354     public static final Info APUT_BYTE =
355         new Info(Opcodes.APUT_BYTE, "aput-byte",
356             InstructionCodec.FORMAT_23X, IndexType.NONE);
357 
358     public static final Info APUT_CHAR =
359         new Info(Opcodes.APUT_CHAR, "aput-char",
360             InstructionCodec.FORMAT_23X, IndexType.NONE);
361 
362     public static final Info APUT_SHORT =
363         new Info(Opcodes.APUT_SHORT, "aput-short",
364             InstructionCodec.FORMAT_23X, IndexType.NONE);
365 
366     public static final Info IGET =
367         new Info(Opcodes.IGET, "iget",
368             InstructionCodec.FORMAT_22C, IndexType.FIELD_REF);
369 
370     public static final Info IGET_WIDE =
371         new Info(Opcodes.IGET_WIDE, "iget-wide",
372             InstructionCodec.FORMAT_22C, IndexType.FIELD_REF);
373 
374     public static final Info IGET_OBJECT =
375         new Info(Opcodes.IGET_OBJECT, "iget-object",
376             InstructionCodec.FORMAT_22C, IndexType.FIELD_REF);
377 
378     public static final Info IGET_BOOLEAN =
379         new Info(Opcodes.IGET_BOOLEAN, "iget-boolean",
380             InstructionCodec.FORMAT_22C, IndexType.FIELD_REF);
381 
382     public static final Info IGET_BYTE =
383         new Info(Opcodes.IGET_BYTE, "iget-byte",
384             InstructionCodec.FORMAT_22C, IndexType.FIELD_REF);
385 
386     public static final Info IGET_CHAR =
387         new Info(Opcodes.IGET_CHAR, "iget-char",
388             InstructionCodec.FORMAT_22C, IndexType.FIELD_REF);
389 
390     public static final Info IGET_SHORT =
391         new Info(Opcodes.IGET_SHORT, "iget-short",
392             InstructionCodec.FORMAT_22C, IndexType.FIELD_REF);
393 
394     public static final Info IPUT =
395         new Info(Opcodes.IPUT, "iput",
396             InstructionCodec.FORMAT_22C, IndexType.FIELD_REF);
397 
398     public static final Info IPUT_WIDE =
399         new Info(Opcodes.IPUT_WIDE, "iput-wide",
400             InstructionCodec.FORMAT_22C, IndexType.FIELD_REF);
401 
402     public static final Info IPUT_OBJECT =
403         new Info(Opcodes.IPUT_OBJECT, "iput-object",
404             InstructionCodec.FORMAT_22C, IndexType.FIELD_REF);
405 
406     public static final Info IPUT_BOOLEAN =
407         new Info(Opcodes.IPUT_BOOLEAN, "iput-boolean",
408             InstructionCodec.FORMAT_22C, IndexType.FIELD_REF);
409 
410     public static final Info IPUT_BYTE =
411         new Info(Opcodes.IPUT_BYTE, "iput-byte",
412             InstructionCodec.FORMAT_22C, IndexType.FIELD_REF);
413 
414     public static final Info IPUT_CHAR =
415         new Info(Opcodes.IPUT_CHAR, "iput-char",
416             InstructionCodec.FORMAT_22C, IndexType.FIELD_REF);
417 
418     public static final Info IPUT_SHORT =
419         new Info(Opcodes.IPUT_SHORT, "iput-short",
420             InstructionCodec.FORMAT_22C, IndexType.FIELD_REF);
421 
422     public static final Info SGET =
423         new Info(Opcodes.SGET, "sget",
424             InstructionCodec.FORMAT_21C, IndexType.FIELD_REF);
425 
426     public static final Info SGET_WIDE =
427         new Info(Opcodes.SGET_WIDE, "sget-wide",
428             InstructionCodec.FORMAT_21C, IndexType.FIELD_REF);
429 
430     public static final Info SGET_OBJECT =
431         new Info(Opcodes.SGET_OBJECT, "sget-object",
432             InstructionCodec.FORMAT_21C, IndexType.FIELD_REF);
433 
434     public static final Info SGET_BOOLEAN =
435         new Info(Opcodes.SGET_BOOLEAN, "sget-boolean",
436             InstructionCodec.FORMAT_21C, IndexType.FIELD_REF);
437 
438     public static final Info SGET_BYTE =
439         new Info(Opcodes.SGET_BYTE, "sget-byte",
440             InstructionCodec.FORMAT_21C, IndexType.FIELD_REF);
441 
442     public static final Info SGET_CHAR =
443         new Info(Opcodes.SGET_CHAR, "sget-char",
444             InstructionCodec.FORMAT_21C, IndexType.FIELD_REF);
445 
446     public static final Info SGET_SHORT =
447         new Info(Opcodes.SGET_SHORT, "sget-short",
448             InstructionCodec.FORMAT_21C, IndexType.FIELD_REF);
449 
450     public static final Info SPUT =
451         new Info(Opcodes.SPUT, "sput",
452             InstructionCodec.FORMAT_21C, IndexType.FIELD_REF);
453 
454     public static final Info SPUT_WIDE =
455         new Info(Opcodes.SPUT_WIDE, "sput-wide",
456             InstructionCodec.FORMAT_21C, IndexType.FIELD_REF);
457 
458     public static final Info SPUT_OBJECT =
459         new Info(Opcodes.SPUT_OBJECT, "sput-object",
460             InstructionCodec.FORMAT_21C, IndexType.FIELD_REF);
461 
462     public static final Info SPUT_BOOLEAN =
463         new Info(Opcodes.SPUT_BOOLEAN, "sput-boolean",
464             InstructionCodec.FORMAT_21C, IndexType.FIELD_REF);
465 
466     public static final Info SPUT_BYTE =
467         new Info(Opcodes.SPUT_BYTE, "sput-byte",
468             InstructionCodec.FORMAT_21C, IndexType.FIELD_REF);
469 
470     public static final Info SPUT_CHAR =
471         new Info(Opcodes.SPUT_CHAR, "sput-char",
472             InstructionCodec.FORMAT_21C, IndexType.FIELD_REF);
473 
474     public static final Info SPUT_SHORT =
475         new Info(Opcodes.SPUT_SHORT, "sput-short",
476             InstructionCodec.FORMAT_21C, IndexType.FIELD_REF);
477 
478     public static final Info INVOKE_VIRTUAL =
479         new Info(Opcodes.INVOKE_VIRTUAL, "invoke-virtual",
480             InstructionCodec.FORMAT_35C, IndexType.METHOD_REF);
481 
482     public static final Info INVOKE_SUPER =
483         new Info(Opcodes.INVOKE_SUPER, "invoke-super",
484             InstructionCodec.FORMAT_35C, IndexType.METHOD_REF);
485 
486     public static final Info INVOKE_DIRECT =
487         new Info(Opcodes.INVOKE_DIRECT, "invoke-direct",
488             InstructionCodec.FORMAT_35C, IndexType.METHOD_REF);
489 
490     public static final Info INVOKE_STATIC =
491         new Info(Opcodes.INVOKE_STATIC, "invoke-static",
492             InstructionCodec.FORMAT_35C, IndexType.METHOD_REF);
493 
494     public static final Info INVOKE_INTERFACE =
495         new Info(Opcodes.INVOKE_INTERFACE, "invoke-interface",
496             InstructionCodec.FORMAT_35C, IndexType.METHOD_REF);
497 
498     public static final Info INVOKE_VIRTUAL_RANGE =
499         new Info(Opcodes.INVOKE_VIRTUAL_RANGE, "invoke-virtual/range",
500             InstructionCodec.FORMAT_3RC, IndexType.METHOD_REF);
501 
502     public static final Info INVOKE_SUPER_RANGE =
503         new Info(Opcodes.INVOKE_SUPER_RANGE, "invoke-super/range",
504             InstructionCodec.FORMAT_3RC, IndexType.METHOD_REF);
505 
506     public static final Info INVOKE_DIRECT_RANGE =
507         new Info(Opcodes.INVOKE_DIRECT_RANGE, "invoke-direct/range",
508             InstructionCodec.FORMAT_3RC, IndexType.METHOD_REF);
509 
510     public static final Info INVOKE_STATIC_RANGE =
511         new Info(Opcodes.INVOKE_STATIC_RANGE, "invoke-static/range",
512             InstructionCodec.FORMAT_3RC, IndexType.METHOD_REF);
513 
514     public static final Info INVOKE_INTERFACE_RANGE =
515         new Info(Opcodes.INVOKE_INTERFACE_RANGE, "invoke-interface/range",
516             InstructionCodec.FORMAT_3RC, IndexType.METHOD_REF);
517 
518     public static final Info NEG_INT =
519         new Info(Opcodes.NEG_INT, "neg-int",
520             InstructionCodec.FORMAT_12X, IndexType.NONE);
521 
522     public static final Info NOT_INT =
523         new Info(Opcodes.NOT_INT, "not-int",
524             InstructionCodec.FORMAT_12X, IndexType.NONE);
525 
526     public static final Info NEG_LONG =
527         new Info(Opcodes.NEG_LONG, "neg-long",
528             InstructionCodec.FORMAT_12X, IndexType.NONE);
529 
530     public static final Info NOT_LONG =
531         new Info(Opcodes.NOT_LONG, "not-long",
532             InstructionCodec.FORMAT_12X, IndexType.NONE);
533 
534     public static final Info NEG_FLOAT =
535         new Info(Opcodes.NEG_FLOAT, "neg-float",
536             InstructionCodec.FORMAT_12X, IndexType.NONE);
537 
538     public static final Info NEG_DOUBLE =
539         new Info(Opcodes.NEG_DOUBLE, "neg-double",
540             InstructionCodec.FORMAT_12X, IndexType.NONE);
541 
542     public static final Info INT_TO_LONG =
543         new Info(Opcodes.INT_TO_LONG, "int-to-long",
544             InstructionCodec.FORMAT_12X, IndexType.NONE);
545 
546     public static final Info INT_TO_FLOAT =
547         new Info(Opcodes.INT_TO_FLOAT, "int-to-float",
548             InstructionCodec.FORMAT_12X, IndexType.NONE);
549 
550     public static final Info INT_TO_DOUBLE =
551         new Info(Opcodes.INT_TO_DOUBLE, "int-to-double",
552             InstructionCodec.FORMAT_12X, IndexType.NONE);
553 
554     public static final Info LONG_TO_INT =
555         new Info(Opcodes.LONG_TO_INT, "long-to-int",
556             InstructionCodec.FORMAT_12X, IndexType.NONE);
557 
558     public static final Info LONG_TO_FLOAT =
559         new Info(Opcodes.LONG_TO_FLOAT, "long-to-float",
560             InstructionCodec.FORMAT_12X, IndexType.NONE);
561 
562     public static final Info LONG_TO_DOUBLE =
563         new Info(Opcodes.LONG_TO_DOUBLE, "long-to-double",
564             InstructionCodec.FORMAT_12X, IndexType.NONE);
565 
566     public static final Info FLOAT_TO_INT =
567         new Info(Opcodes.FLOAT_TO_INT, "float-to-int",
568             InstructionCodec.FORMAT_12X, IndexType.NONE);
569 
570     public static final Info FLOAT_TO_LONG =
571         new Info(Opcodes.FLOAT_TO_LONG, "float-to-long",
572             InstructionCodec.FORMAT_12X, IndexType.NONE);
573 
574     public static final Info FLOAT_TO_DOUBLE =
575         new Info(Opcodes.FLOAT_TO_DOUBLE, "float-to-double",
576             InstructionCodec.FORMAT_12X, IndexType.NONE);
577 
578     public static final Info DOUBLE_TO_INT =
579         new Info(Opcodes.DOUBLE_TO_INT, "double-to-int",
580             InstructionCodec.FORMAT_12X, IndexType.NONE);
581 
582     public static final Info DOUBLE_TO_LONG =
583         new Info(Opcodes.DOUBLE_TO_LONG, "double-to-long",
584             InstructionCodec.FORMAT_12X, IndexType.NONE);
585 
586     public static final Info DOUBLE_TO_FLOAT =
587         new Info(Opcodes.DOUBLE_TO_FLOAT, "double-to-float",
588             InstructionCodec.FORMAT_12X, IndexType.NONE);
589 
590     public static final Info INT_TO_BYTE =
591         new Info(Opcodes.INT_TO_BYTE, "int-to-byte",
592             InstructionCodec.FORMAT_12X, IndexType.NONE);
593 
594     public static final Info INT_TO_CHAR =
595         new Info(Opcodes.INT_TO_CHAR, "int-to-char",
596             InstructionCodec.FORMAT_12X, IndexType.NONE);
597 
598     public static final Info INT_TO_SHORT =
599         new Info(Opcodes.INT_TO_SHORT, "int-to-short",
600             InstructionCodec.FORMAT_12X, IndexType.NONE);
601 
602     public static final Info ADD_INT =
603         new Info(Opcodes.ADD_INT, "add-int",
604             InstructionCodec.FORMAT_23X, IndexType.NONE);
605 
606     public static final Info SUB_INT =
607         new Info(Opcodes.SUB_INT, "sub-int",
608             InstructionCodec.FORMAT_23X, IndexType.NONE);
609 
610     public static final Info MUL_INT =
611         new Info(Opcodes.MUL_INT, "mul-int",
612             InstructionCodec.FORMAT_23X, IndexType.NONE);
613 
614     public static final Info DIV_INT =
615         new Info(Opcodes.DIV_INT, "div-int",
616             InstructionCodec.FORMAT_23X, IndexType.NONE);
617 
618     public static final Info REM_INT =
619         new Info(Opcodes.REM_INT, "rem-int",
620             InstructionCodec.FORMAT_23X, IndexType.NONE);
621 
622     public static final Info AND_INT =
623         new Info(Opcodes.AND_INT, "and-int",
624             InstructionCodec.FORMAT_23X, IndexType.NONE);
625 
626     public static final Info OR_INT =
627         new Info(Opcodes.OR_INT, "or-int",
628             InstructionCodec.FORMAT_23X, IndexType.NONE);
629 
630     public static final Info XOR_INT =
631         new Info(Opcodes.XOR_INT, "xor-int",
632             InstructionCodec.FORMAT_23X, IndexType.NONE);
633 
634     public static final Info SHL_INT =
635         new Info(Opcodes.SHL_INT, "shl-int",
636             InstructionCodec.FORMAT_23X, IndexType.NONE);
637 
638     public static final Info SHR_INT =
639         new Info(Opcodes.SHR_INT, "shr-int",
640             InstructionCodec.FORMAT_23X, IndexType.NONE);
641 
642     public static final Info USHR_INT =
643         new Info(Opcodes.USHR_INT, "ushr-int",
644             InstructionCodec.FORMAT_23X, IndexType.NONE);
645 
646     public static final Info ADD_LONG =
647         new Info(Opcodes.ADD_LONG, "add-long",
648             InstructionCodec.FORMAT_23X, IndexType.NONE);
649 
650     public static final Info SUB_LONG =
651         new Info(Opcodes.SUB_LONG, "sub-long",
652             InstructionCodec.FORMAT_23X, IndexType.NONE);
653 
654     public static final Info MUL_LONG =
655         new Info(Opcodes.MUL_LONG, "mul-long",
656             InstructionCodec.FORMAT_23X, IndexType.NONE);
657 
658     public static final Info DIV_LONG =
659         new Info(Opcodes.DIV_LONG, "div-long",
660             InstructionCodec.FORMAT_23X, IndexType.NONE);
661 
662     public static final Info REM_LONG =
663         new Info(Opcodes.REM_LONG, "rem-long",
664             InstructionCodec.FORMAT_23X, IndexType.NONE);
665 
666     public static final Info AND_LONG =
667         new Info(Opcodes.AND_LONG, "and-long",
668             InstructionCodec.FORMAT_23X, IndexType.NONE);
669 
670     public static final Info OR_LONG =
671         new Info(Opcodes.OR_LONG, "or-long",
672             InstructionCodec.FORMAT_23X, IndexType.NONE);
673 
674     public static final Info XOR_LONG =
675         new Info(Opcodes.XOR_LONG, "xor-long",
676             InstructionCodec.FORMAT_23X, IndexType.NONE);
677 
678     public static final Info SHL_LONG =
679         new Info(Opcodes.SHL_LONG, "shl-long",
680             InstructionCodec.FORMAT_23X, IndexType.NONE);
681 
682     public static final Info SHR_LONG =
683         new Info(Opcodes.SHR_LONG, "shr-long",
684             InstructionCodec.FORMAT_23X, IndexType.NONE);
685 
686     public static final Info USHR_LONG =
687         new Info(Opcodes.USHR_LONG, "ushr-long",
688             InstructionCodec.FORMAT_23X, IndexType.NONE);
689 
690     public static final Info ADD_FLOAT =
691         new Info(Opcodes.ADD_FLOAT, "add-float",
692             InstructionCodec.FORMAT_23X, IndexType.NONE);
693 
694     public static final Info SUB_FLOAT =
695         new Info(Opcodes.SUB_FLOAT, "sub-float",
696             InstructionCodec.FORMAT_23X, IndexType.NONE);
697 
698     public static final Info MUL_FLOAT =
699         new Info(Opcodes.MUL_FLOAT, "mul-float",
700             InstructionCodec.FORMAT_23X, IndexType.NONE);
701 
702     public static final Info DIV_FLOAT =
703         new Info(Opcodes.DIV_FLOAT, "div-float",
704             InstructionCodec.FORMAT_23X, IndexType.NONE);
705 
706     public static final Info REM_FLOAT =
707         new Info(Opcodes.REM_FLOAT, "rem-float",
708             InstructionCodec.FORMAT_23X, IndexType.NONE);
709 
710     public static final Info ADD_DOUBLE =
711         new Info(Opcodes.ADD_DOUBLE, "add-double",
712             InstructionCodec.FORMAT_23X, IndexType.NONE);
713 
714     public static final Info SUB_DOUBLE =
715         new Info(Opcodes.SUB_DOUBLE, "sub-double",
716             InstructionCodec.FORMAT_23X, IndexType.NONE);
717 
718     public static final Info MUL_DOUBLE =
719         new Info(Opcodes.MUL_DOUBLE, "mul-double",
720             InstructionCodec.FORMAT_23X, IndexType.NONE);
721 
722     public static final Info DIV_DOUBLE =
723         new Info(Opcodes.DIV_DOUBLE, "div-double",
724             InstructionCodec.FORMAT_23X, IndexType.NONE);
725 
726     public static final Info REM_DOUBLE =
727         new Info(Opcodes.REM_DOUBLE, "rem-double",
728             InstructionCodec.FORMAT_23X, IndexType.NONE);
729 
730     public static final Info ADD_INT_2ADDR =
731         new Info(Opcodes.ADD_INT_2ADDR, "add-int/2addr",
732             InstructionCodec.FORMAT_12X, IndexType.NONE);
733 
734     public static final Info SUB_INT_2ADDR =
735         new Info(Opcodes.SUB_INT_2ADDR, "sub-int/2addr",
736             InstructionCodec.FORMAT_12X, IndexType.NONE);
737 
738     public static final Info MUL_INT_2ADDR =
739         new Info(Opcodes.MUL_INT_2ADDR, "mul-int/2addr",
740             InstructionCodec.FORMAT_12X, IndexType.NONE);
741 
742     public static final Info DIV_INT_2ADDR =
743         new Info(Opcodes.DIV_INT_2ADDR, "div-int/2addr",
744             InstructionCodec.FORMAT_12X, IndexType.NONE);
745 
746     public static final Info REM_INT_2ADDR =
747         new Info(Opcodes.REM_INT_2ADDR, "rem-int/2addr",
748             InstructionCodec.FORMAT_12X, IndexType.NONE);
749 
750     public static final Info AND_INT_2ADDR =
751         new Info(Opcodes.AND_INT_2ADDR, "and-int/2addr",
752             InstructionCodec.FORMAT_12X, IndexType.NONE);
753 
754     public static final Info OR_INT_2ADDR =
755         new Info(Opcodes.OR_INT_2ADDR, "or-int/2addr",
756             InstructionCodec.FORMAT_12X, IndexType.NONE);
757 
758     public static final Info XOR_INT_2ADDR =
759         new Info(Opcodes.XOR_INT_2ADDR, "xor-int/2addr",
760             InstructionCodec.FORMAT_12X, IndexType.NONE);
761 
762     public static final Info SHL_INT_2ADDR =
763         new Info(Opcodes.SHL_INT_2ADDR, "shl-int/2addr",
764             InstructionCodec.FORMAT_12X, IndexType.NONE);
765 
766     public static final Info SHR_INT_2ADDR =
767         new Info(Opcodes.SHR_INT_2ADDR, "shr-int/2addr",
768             InstructionCodec.FORMAT_12X, IndexType.NONE);
769 
770     public static final Info USHR_INT_2ADDR =
771         new Info(Opcodes.USHR_INT_2ADDR, "ushr-int/2addr",
772             InstructionCodec.FORMAT_12X, IndexType.NONE);
773 
774     public static final Info ADD_LONG_2ADDR =
775         new Info(Opcodes.ADD_LONG_2ADDR, "add-long/2addr",
776             InstructionCodec.FORMAT_12X, IndexType.NONE);
777 
778     public static final Info SUB_LONG_2ADDR =
779         new Info(Opcodes.SUB_LONG_2ADDR, "sub-long/2addr",
780             InstructionCodec.FORMAT_12X, IndexType.NONE);
781 
782     public static final Info MUL_LONG_2ADDR =
783         new Info(Opcodes.MUL_LONG_2ADDR, "mul-long/2addr",
784             InstructionCodec.FORMAT_12X, IndexType.NONE);
785 
786     public static final Info DIV_LONG_2ADDR =
787         new Info(Opcodes.DIV_LONG_2ADDR, "div-long/2addr",
788             InstructionCodec.FORMAT_12X, IndexType.NONE);
789 
790     public static final Info REM_LONG_2ADDR =
791         new Info(Opcodes.REM_LONG_2ADDR, "rem-long/2addr",
792             InstructionCodec.FORMAT_12X, IndexType.NONE);
793 
794     public static final Info AND_LONG_2ADDR =
795         new Info(Opcodes.AND_LONG_2ADDR, "and-long/2addr",
796             InstructionCodec.FORMAT_12X, IndexType.NONE);
797 
798     public static final Info OR_LONG_2ADDR =
799         new Info(Opcodes.OR_LONG_2ADDR, "or-long/2addr",
800             InstructionCodec.FORMAT_12X, IndexType.NONE);
801 
802     public static final Info XOR_LONG_2ADDR =
803         new Info(Opcodes.XOR_LONG_2ADDR, "xor-long/2addr",
804             InstructionCodec.FORMAT_12X, IndexType.NONE);
805 
806     public static final Info SHL_LONG_2ADDR =
807         new Info(Opcodes.SHL_LONG_2ADDR, "shl-long/2addr",
808             InstructionCodec.FORMAT_12X, IndexType.NONE);
809 
810     public static final Info SHR_LONG_2ADDR =
811         new Info(Opcodes.SHR_LONG_2ADDR, "shr-long/2addr",
812             InstructionCodec.FORMAT_12X, IndexType.NONE);
813 
814     public static final Info USHR_LONG_2ADDR =
815         new Info(Opcodes.USHR_LONG_2ADDR, "ushr-long/2addr",
816             InstructionCodec.FORMAT_12X, IndexType.NONE);
817 
818     public static final Info ADD_FLOAT_2ADDR =
819         new Info(Opcodes.ADD_FLOAT_2ADDR, "add-float/2addr",
820             InstructionCodec.FORMAT_12X, IndexType.NONE);
821 
822     public static final Info SUB_FLOAT_2ADDR =
823         new Info(Opcodes.SUB_FLOAT_2ADDR, "sub-float/2addr",
824             InstructionCodec.FORMAT_12X, IndexType.NONE);
825 
826     public static final Info MUL_FLOAT_2ADDR =
827         new Info(Opcodes.MUL_FLOAT_2ADDR, "mul-float/2addr",
828             InstructionCodec.FORMAT_12X, IndexType.NONE);
829 
830     public static final Info DIV_FLOAT_2ADDR =
831         new Info(Opcodes.DIV_FLOAT_2ADDR, "div-float/2addr",
832             InstructionCodec.FORMAT_12X, IndexType.NONE);
833 
834     public static final Info REM_FLOAT_2ADDR =
835         new Info(Opcodes.REM_FLOAT_2ADDR, "rem-float/2addr",
836             InstructionCodec.FORMAT_12X, IndexType.NONE);
837 
838     public static final Info ADD_DOUBLE_2ADDR =
839         new Info(Opcodes.ADD_DOUBLE_2ADDR, "add-double/2addr",
840             InstructionCodec.FORMAT_12X, IndexType.NONE);
841 
842     public static final Info SUB_DOUBLE_2ADDR =
843         new Info(Opcodes.SUB_DOUBLE_2ADDR, "sub-double/2addr",
844             InstructionCodec.FORMAT_12X, IndexType.NONE);
845 
846     public static final Info MUL_DOUBLE_2ADDR =
847         new Info(Opcodes.MUL_DOUBLE_2ADDR, "mul-double/2addr",
848             InstructionCodec.FORMAT_12X, IndexType.NONE);
849 
850     public static final Info DIV_DOUBLE_2ADDR =
851         new Info(Opcodes.DIV_DOUBLE_2ADDR, "div-double/2addr",
852             InstructionCodec.FORMAT_12X, IndexType.NONE);
853 
854     public static final Info REM_DOUBLE_2ADDR =
855         new Info(Opcodes.REM_DOUBLE_2ADDR, "rem-double/2addr",
856             InstructionCodec.FORMAT_12X, IndexType.NONE);
857 
858     public static final Info ADD_INT_LIT16 =
859         new Info(Opcodes.ADD_INT_LIT16, "add-int/lit16",
860             InstructionCodec.FORMAT_22S, IndexType.NONE);
861 
862     public static final Info RSUB_INT =
863         new Info(Opcodes.RSUB_INT, "rsub-int",
864             InstructionCodec.FORMAT_22S, IndexType.NONE);
865 
866     public static final Info MUL_INT_LIT16 =
867         new Info(Opcodes.MUL_INT_LIT16, "mul-int/lit16",
868             InstructionCodec.FORMAT_22S, IndexType.NONE);
869 
870     public static final Info DIV_INT_LIT16 =
871         new Info(Opcodes.DIV_INT_LIT16, "div-int/lit16",
872             InstructionCodec.FORMAT_22S, IndexType.NONE);
873 
874     public static final Info REM_INT_LIT16 =
875         new Info(Opcodes.REM_INT_LIT16, "rem-int/lit16",
876             InstructionCodec.FORMAT_22S, IndexType.NONE);
877 
878     public static final Info AND_INT_LIT16 =
879         new Info(Opcodes.AND_INT_LIT16, "and-int/lit16",
880             InstructionCodec.FORMAT_22S, IndexType.NONE);
881 
882     public static final Info OR_INT_LIT16 =
883         new Info(Opcodes.OR_INT_LIT16, "or-int/lit16",
884             InstructionCodec.FORMAT_22S, IndexType.NONE);
885 
886     public static final Info XOR_INT_LIT16 =
887         new Info(Opcodes.XOR_INT_LIT16, "xor-int/lit16",
888             InstructionCodec.FORMAT_22S, IndexType.NONE);
889 
890     public static final Info ADD_INT_LIT8 =
891         new Info(Opcodes.ADD_INT_LIT8, "add-int/lit8",
892             InstructionCodec.FORMAT_22B, IndexType.NONE);
893 
894     public static final Info RSUB_INT_LIT8 =
895         new Info(Opcodes.RSUB_INT_LIT8, "rsub-int/lit8",
896             InstructionCodec.FORMAT_22B, IndexType.NONE);
897 
898     public static final Info MUL_INT_LIT8 =
899         new Info(Opcodes.MUL_INT_LIT8, "mul-int/lit8",
900             InstructionCodec.FORMAT_22B, IndexType.NONE);
901 
902     public static final Info DIV_INT_LIT8 =
903         new Info(Opcodes.DIV_INT_LIT8, "div-int/lit8",
904             InstructionCodec.FORMAT_22B, IndexType.NONE);
905 
906     public static final Info REM_INT_LIT8 =
907         new Info(Opcodes.REM_INT_LIT8, "rem-int/lit8",
908             InstructionCodec.FORMAT_22B, IndexType.NONE);
909 
910     public static final Info AND_INT_LIT8 =
911         new Info(Opcodes.AND_INT_LIT8, "and-int/lit8",
912             InstructionCodec.FORMAT_22B, IndexType.NONE);
913 
914     public static final Info OR_INT_LIT8 =
915         new Info(Opcodes.OR_INT_LIT8, "or-int/lit8",
916             InstructionCodec.FORMAT_22B, IndexType.NONE);
917 
918     public static final Info XOR_INT_LIT8 =
919         new Info(Opcodes.XOR_INT_LIT8, "xor-int/lit8",
920             InstructionCodec.FORMAT_22B, IndexType.NONE);
921 
922     public static final Info SHL_INT_LIT8 =
923         new Info(Opcodes.SHL_INT_LIT8, "shl-int/lit8",
924             InstructionCodec.FORMAT_22B, IndexType.NONE);
925 
926     public static final Info SHR_INT_LIT8 =
927         new Info(Opcodes.SHR_INT_LIT8, "shr-int/lit8",
928             InstructionCodec.FORMAT_22B, IndexType.NONE);
929 
930     public static final Info USHR_INT_LIT8 =
931         new Info(Opcodes.USHR_INT_LIT8, "ushr-int/lit8",
932             InstructionCodec.FORMAT_22B, IndexType.NONE);
933 
934     // END(opcode-info-defs)
935 
936     // Static initialization.
937     static {
938         INFO = new Info[Opcodes.MAX_VALUE - Opcodes.MIN_VALUE + 1];
939 
940         // TODO: Stop using this constant.
941         set(SPECIAL_FORMAT);
942 
943         // TODO: These payload opcodes should be generated by opcode-gen.
944         set(PACKED_SWITCH_PAYLOAD);
945         set(SPARSE_SWITCH_PAYLOAD);
946         set(FILL_ARRAY_DATA_PAYLOAD);
947 
948         // BEGIN(opcode-info-init); GENERATED AUTOMATICALLY BY opcode-gen
949         set(NOP);
950         set(MOVE);
951         set(MOVE_FROM16);
952         set(MOVE_16);
953         set(MOVE_WIDE);
954         set(MOVE_WIDE_FROM16);
955         set(MOVE_WIDE_16);
956         set(MOVE_OBJECT);
957         set(MOVE_OBJECT_FROM16);
958         set(MOVE_OBJECT_16);
959         set(MOVE_RESULT);
960         set(MOVE_RESULT_WIDE);
961         set(MOVE_RESULT_OBJECT);
962         set(MOVE_EXCEPTION);
963         set(RETURN_VOID);
964         set(RETURN);
965         set(RETURN_WIDE);
966         set(RETURN_OBJECT);
967         set(CONST_4);
968         set(CONST_16);
969         set(CONST);
970         set(CONST_HIGH16);
971         set(CONST_WIDE_16);
972         set(CONST_WIDE_32);
973         set(CONST_WIDE);
974         set(CONST_WIDE_HIGH16);
975         set(CONST_STRING);
976         set(CONST_STRING_JUMBO);
977         set(CONST_CLASS);
978         set(MONITOR_ENTER);
979         set(MONITOR_EXIT);
980         set(CHECK_CAST);
981         set(INSTANCE_OF);
982         set(ARRAY_LENGTH);
983         set(NEW_INSTANCE);
984         set(NEW_ARRAY);
985         set(FILLED_NEW_ARRAY);
986         set(FILLED_NEW_ARRAY_RANGE);
987         set(FILL_ARRAY_DATA);
988         set(THROW);
989         set(GOTO);
990         set(GOTO_16);
991         set(GOTO_32);
992         set(PACKED_SWITCH);
993         set(SPARSE_SWITCH);
994         set(CMPL_FLOAT);
995         set(CMPG_FLOAT);
996         set(CMPL_DOUBLE);
997         set(CMPG_DOUBLE);
998         set(CMP_LONG);
999         set(IF_EQ);
1000         set(IF_NE);
1001         set(IF_LT);
1002         set(IF_GE);
1003         set(IF_GT);
1004         set(IF_LE);
1005         set(IF_EQZ);
1006         set(IF_NEZ);
1007         set(IF_LTZ);
1008         set(IF_GEZ);
1009         set(IF_GTZ);
1010         set(IF_LEZ);
1011         set(AGET);
1012         set(AGET_WIDE);
1013         set(AGET_OBJECT);
1014         set(AGET_BOOLEAN);
1015         set(AGET_BYTE);
1016         set(AGET_CHAR);
1017         set(AGET_SHORT);
1018         set(APUT);
1019         set(APUT_WIDE);
1020         set(APUT_OBJECT);
1021         set(APUT_BOOLEAN);
1022         set(APUT_BYTE);
1023         set(APUT_CHAR);
1024         set(APUT_SHORT);
1025         set(IGET);
1026         set(IGET_WIDE);
1027         set(IGET_OBJECT);
1028         set(IGET_BOOLEAN);
1029         set(IGET_BYTE);
1030         set(IGET_CHAR);
1031         set(IGET_SHORT);
1032         set(IPUT);
1033         set(IPUT_WIDE);
1034         set(IPUT_OBJECT);
1035         set(IPUT_BOOLEAN);
1036         set(IPUT_BYTE);
1037         set(IPUT_CHAR);
1038         set(IPUT_SHORT);
1039         set(SGET);
1040         set(SGET_WIDE);
1041         set(SGET_OBJECT);
1042         set(SGET_BOOLEAN);
1043         set(SGET_BYTE);
1044         set(SGET_CHAR);
1045         set(SGET_SHORT);
1046         set(SPUT);
1047         set(SPUT_WIDE);
1048         set(SPUT_OBJECT);
1049         set(SPUT_BOOLEAN);
1050         set(SPUT_BYTE);
1051         set(SPUT_CHAR);
1052         set(SPUT_SHORT);
1053         set(INVOKE_VIRTUAL);
1054         set(INVOKE_SUPER);
1055         set(INVOKE_DIRECT);
1056         set(INVOKE_STATIC);
1057         set(INVOKE_INTERFACE);
1058         set(INVOKE_VIRTUAL_RANGE);
1059         set(INVOKE_SUPER_RANGE);
1060         set(INVOKE_DIRECT_RANGE);
1061         set(INVOKE_STATIC_RANGE);
1062         set(INVOKE_INTERFACE_RANGE);
1063         set(NEG_INT);
1064         set(NOT_INT);
1065         set(NEG_LONG);
1066         set(NOT_LONG);
1067         set(NEG_FLOAT);
1068         set(NEG_DOUBLE);
1069         set(INT_TO_LONG);
1070         set(INT_TO_FLOAT);
1071         set(INT_TO_DOUBLE);
1072         set(LONG_TO_INT);
1073         set(LONG_TO_FLOAT);
1074         set(LONG_TO_DOUBLE);
1075         set(FLOAT_TO_INT);
1076         set(FLOAT_TO_LONG);
1077         set(FLOAT_TO_DOUBLE);
1078         set(DOUBLE_TO_INT);
1079         set(DOUBLE_TO_LONG);
1080         set(DOUBLE_TO_FLOAT);
1081         set(INT_TO_BYTE);
1082         set(INT_TO_CHAR);
1083         set(INT_TO_SHORT);
1084         set(ADD_INT);
1085         set(SUB_INT);
1086         set(MUL_INT);
1087         set(DIV_INT);
1088         set(REM_INT);
1089         set(AND_INT);
1090         set(OR_INT);
1091         set(XOR_INT);
1092         set(SHL_INT);
1093         set(SHR_INT);
1094         set(USHR_INT);
1095         set(ADD_LONG);
1096         set(SUB_LONG);
1097         set(MUL_LONG);
1098         set(DIV_LONG);
1099         set(REM_LONG);
1100         set(AND_LONG);
1101         set(OR_LONG);
1102         set(XOR_LONG);
1103         set(SHL_LONG);
1104         set(SHR_LONG);
1105         set(USHR_LONG);
1106         set(ADD_FLOAT);
1107         set(SUB_FLOAT);
1108         set(MUL_FLOAT);
1109         set(DIV_FLOAT);
1110         set(REM_FLOAT);
1111         set(ADD_DOUBLE);
1112         set(SUB_DOUBLE);
1113         set(MUL_DOUBLE);
1114         set(DIV_DOUBLE);
1115         set(REM_DOUBLE);
1116         set(ADD_INT_2ADDR);
1117         set(SUB_INT_2ADDR);
1118         set(MUL_INT_2ADDR);
1119         set(DIV_INT_2ADDR);
1120         set(REM_INT_2ADDR);
1121         set(AND_INT_2ADDR);
1122         set(OR_INT_2ADDR);
1123         set(XOR_INT_2ADDR);
1124         set(SHL_INT_2ADDR);
1125         set(SHR_INT_2ADDR);
1126         set(USHR_INT_2ADDR);
1127         set(ADD_LONG_2ADDR);
1128         set(SUB_LONG_2ADDR);
1129         set(MUL_LONG_2ADDR);
1130         set(DIV_LONG_2ADDR);
1131         set(REM_LONG_2ADDR);
1132         set(AND_LONG_2ADDR);
1133         set(OR_LONG_2ADDR);
1134         set(XOR_LONG_2ADDR);
1135         set(SHL_LONG_2ADDR);
1136         set(SHR_LONG_2ADDR);
1137         set(USHR_LONG_2ADDR);
1138         set(ADD_FLOAT_2ADDR);
1139         set(SUB_FLOAT_2ADDR);
1140         set(MUL_FLOAT_2ADDR);
1141         set(DIV_FLOAT_2ADDR);
1142         set(REM_FLOAT_2ADDR);
1143         set(ADD_DOUBLE_2ADDR);
1144         set(SUB_DOUBLE_2ADDR);
1145         set(MUL_DOUBLE_2ADDR);
1146         set(DIV_DOUBLE_2ADDR);
1147         set(REM_DOUBLE_2ADDR);
1148         set(ADD_INT_LIT16);
1149         set(RSUB_INT);
1150         set(MUL_INT_LIT16);
1151         set(DIV_INT_LIT16);
1152         set(REM_INT_LIT16);
1153         set(AND_INT_LIT16);
1154         set(OR_INT_LIT16);
1155         set(XOR_INT_LIT16);
1156         set(ADD_INT_LIT8);
1157         set(RSUB_INT_LIT8);
1158         set(MUL_INT_LIT8);
1159         set(DIV_INT_LIT8);
1160         set(REM_INT_LIT8);
1161         set(AND_INT_LIT8);
1162         set(OR_INT_LIT8);
1163         set(XOR_INT_LIT8);
1164         set(SHL_INT_LIT8);
1165         set(SHR_INT_LIT8);
1166         set(USHR_INT_LIT8);
1167         // END(opcode-info-init)
1168     }
1169 
1170     /**
1171      * This class is uninstantiable.
1172      */
OpcodeInfo()1173     private OpcodeInfo() {
1174         // This space intentionally left blank.
1175     }
1176 
1177     /**
1178      * Gets the {@link @Info} for the given opcode value.
1179      *
1180      * @param opcode {@code Opcodes.MIN_VALUE..Opcodes.MAX_VALUE;} the
1181      * opcode value
1182      * @return non-null; the associated opcode information instance
1183      */
get(int opcode)1184     public static Info get(int opcode) {
1185         int idx = opcode - Opcodes.MIN_VALUE;
1186 
1187         try {
1188             Info result = INFO[idx];
1189             if (result != null) {
1190                 return result;
1191             }
1192         } catch (ArrayIndexOutOfBoundsException ex) {
1193             // Fall through.
1194         }
1195 
1196         throw new IllegalArgumentException("bogus opcode: "
1197                 + Hex.u2or4(opcode));
1198     }
1199 
1200     /**
1201      * Gets the name of the given opcode.
1202      */
getName(int opcode)1203     public static String getName(int opcode) {
1204         return get(opcode).getName();
1205     }
1206 
1207     /**
1208      * Gets the format (an {@link InstructionCodec}) for the given opcode
1209      * value.
1210      */
getFormat(int opcode)1211     public static InstructionCodec getFormat(int opcode) {
1212         return get(opcode).getFormat();
1213     }
1214 
1215     /**
1216      * Gets the {@link IndexType} for the given opcode value.
1217      */
getIndexType(int opcode)1218     public static IndexType getIndexType(int opcode) {
1219         return get(opcode).getIndexType();
1220     }
1221 
1222     /**
1223      * Puts the given opcode into the table of all ops.
1224      *
1225      * @param opcode non-null; the opcode
1226      */
set(Info opcode)1227     private static void set(Info opcode) {
1228         int idx = opcode.getOpcode() - Opcodes.MIN_VALUE;
1229         INFO[idx] = opcode;
1230     }
1231 
1232     /**
1233      * Information about an opcode.
1234      */
1235     public static class Info {
1236         private final int opcode;
1237         private final String name;
1238         private final InstructionCodec format;
1239         private final IndexType indexType;
1240 
Info(int opcode, String name, InstructionCodec format, IndexType indexType)1241         public Info(int opcode, String name, InstructionCodec format,
1242                 IndexType indexType) {
1243             this.opcode = opcode;
1244             this.name = name;
1245             this.format = format;
1246             this.indexType = indexType;
1247         }
1248 
getOpcode()1249         public int getOpcode() {
1250             return opcode;
1251         }
1252 
getName()1253         public String getName() {
1254             return name;
1255         }
1256 
getFormat()1257         public InstructionCodec getFormat() {
1258             return format;
1259         }
1260 
getIndexType()1261         public IndexType getIndexType() {
1262             return indexType;
1263         }
1264     }
1265 }
1266