1 /***
2  * ASM: a very small and fast Java bytecode manipulation framework
3  * Copyright (c) 2000-2011 INRIA, France Telecom
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. Neither the name of the copyright holders nor the names of its
15  *    contributors may be used to endorse or promote products derived from
16  *    this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28  * THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 package com.sleepycat.asm;
31 
32 /**
33  * Defines the JVM opcodes, access flags and array type codes. This interface
34  * does not define all the JVM opcodes because some opcodes are automatically
35  * handled. For example, the xLOAD and xSTORE opcodes are automatically replaced
36  * by xLOAD_n and xSTORE_n opcodes when possible. The xLOAD_n and xSTORE_n
37  * opcodes are therefore not defined in this interface. Likewise for LDC,
38  * automatically replaced by LDC_W or LDC2_W when necessary, WIDE, GOTO_W and
39  * JSR_W.
40  *
41  * @author Eric Bruneton
42  * @author Eugene Kuleshov
43  */
44 public interface Opcodes {
45 
46     // ASM API versions
47 
48     int ASM4 = 4 << 16 | 0 << 8 | 0;
49 
50     // versions
51 
52     int V1_1 = 3 << 16 | 45;
53     int V1_2 = 0 << 16 | 46;
54     int V1_3 = 0 << 16 | 47;
55     int V1_4 = 0 << 16 | 48;
56     int V1_5 = 0 << 16 | 49;
57     int V1_6 = 0 << 16 | 50;
58     int V1_7 = 0 << 16 | 51;
59 
60     // access flags
61 
62     int ACC_PUBLIC = 0x0001; // class, field, method
63     int ACC_PRIVATE = 0x0002; // class, field, method
64     int ACC_PROTECTED = 0x0004; // class, field, method
65     int ACC_STATIC = 0x0008; // field, method
66     int ACC_FINAL = 0x0010; // class, field, method
67     int ACC_SUPER = 0x0020; // class
68     int ACC_SYNCHRONIZED = 0x0020; // method
69     int ACC_VOLATILE = 0x0040; // field
70     int ACC_BRIDGE = 0x0040; // method
71     int ACC_VARARGS = 0x0080; // method
72     int ACC_TRANSIENT = 0x0080; // field
73     int ACC_NATIVE = 0x0100; // method
74     int ACC_INTERFACE = 0x0200; // class
75     int ACC_ABSTRACT = 0x0400; // class, method
76     int ACC_STRICT = 0x0800; // method
77     int ACC_SYNTHETIC = 0x1000; // class, field, method
78     int ACC_ANNOTATION = 0x2000; // class
79     int ACC_ENUM = 0x4000; // class(?) field inner
80 
81     // ASM specific pseudo access flags
82 
83     int ACC_DEPRECATED = 0x20000; // class, field, method
84 
85     // types for NEWARRAY
86 
87     int T_BOOLEAN = 4;
88     int T_CHAR = 5;
89     int T_FLOAT = 6;
90     int T_DOUBLE = 7;
91     int T_BYTE = 8;
92     int T_SHORT = 9;
93     int T_INT = 10;
94     int T_LONG = 11;
95 
96     // tags for Handle
97 
98     int H_GETFIELD = 1;
99     int H_GETSTATIC = 2;
100     int H_PUTFIELD = 3;
101     int H_PUTSTATIC = 4;
102     int H_INVOKEVIRTUAL = 5;
103     int H_INVOKESTATIC = 6;
104     int H_INVOKESPECIAL = 7;
105     int H_NEWINVOKESPECIAL = 8;
106     int H_INVOKEINTERFACE = 9;
107 
108     // stack map frame types
109 
110     /**
111      * Represents an expanded frame. See {@link ClassReader#EXPAND_FRAMES}.
112      */
113     int F_NEW = -1;
114 
115     /**
116      * Represents a compressed frame with complete frame data.
117      */
118     int F_FULL = 0;
119 
120     /**
121      * Represents a compressed frame where locals are the same as the locals in
122      * the previous frame, except that additional 1-3 locals are defined, and
123      * with an empty stack.
124      */
125     int F_APPEND = 1;
126 
127     /**
128      * Represents a compressed frame where locals are the same as the locals in
129      * the previous frame, except that the last 1-3 locals are absent and with
130      * an empty stack.
131      */
132     int F_CHOP = 2;
133 
134     /**
135      * Represents a compressed frame with exactly the same locals as the
136      * previous frame and with an empty stack.
137      */
138     int F_SAME = 3;
139 
140     /**
141      * Represents a compressed frame with exactly the same locals as the
142      * previous frame and with a single value on the stack.
143      */
144     int F_SAME1 = 4;
145 
146     Integer TOP = new Integer(0);
147     Integer INTEGER = new Integer(1);
148     Integer FLOAT = new Integer(2);
149     Integer DOUBLE = new Integer(3);
150     Integer LONG = new Integer(4);
151     Integer NULL = new Integer(5);
152     Integer UNINITIALIZED_THIS = new Integer(6);
153 
154     // opcodes // visit method (- = idem)
155 
156     int NOP = 0; // visitInsn
157     int ACONST_NULL = 1; // -
158     int ICONST_M1 = 2; // -
159     int ICONST_0 = 3; // -
160     int ICONST_1 = 4; // -
161     int ICONST_2 = 5; // -
162     int ICONST_3 = 6; // -
163     int ICONST_4 = 7; // -
164     int ICONST_5 = 8; // -
165     int LCONST_0 = 9; // -
166     int LCONST_1 = 10; // -
167     int FCONST_0 = 11; // -
168     int FCONST_1 = 12; // -
169     int FCONST_2 = 13; // -
170     int DCONST_0 = 14; // -
171     int DCONST_1 = 15; // -
172     int BIPUSH = 16; // visitIntInsn
173     int SIPUSH = 17; // -
174     int LDC = 18; // visitLdcInsn
175     // int LDC_W = 19; // -
176     // int LDC2_W = 20; // -
177     int ILOAD = 21; // visitVarInsn
178     int LLOAD = 22; // -
179     int FLOAD = 23; // -
180     int DLOAD = 24; // -
181     int ALOAD = 25; // -
182     // int ILOAD_0 = 26; // -
183     // int ILOAD_1 = 27; // -
184     // int ILOAD_2 = 28; // -
185     // int ILOAD_3 = 29; // -
186     // int LLOAD_0 = 30; // -
187     // int LLOAD_1 = 31; // -
188     // int LLOAD_2 = 32; // -
189     // int LLOAD_3 = 33; // -
190     // int FLOAD_0 = 34; // -
191     // int FLOAD_1 = 35; // -
192     // int FLOAD_2 = 36; // -
193     // int FLOAD_3 = 37; // -
194     // int DLOAD_0 = 38; // -
195     // int DLOAD_1 = 39; // -
196     // int DLOAD_2 = 40; // -
197     // int DLOAD_3 = 41; // -
198     // int ALOAD_0 = 42; // -
199     // int ALOAD_1 = 43; // -
200     // int ALOAD_2 = 44; // -
201     // int ALOAD_3 = 45; // -
202     int IALOAD = 46; // visitInsn
203     int LALOAD = 47; // -
204     int FALOAD = 48; // -
205     int DALOAD = 49; // -
206     int AALOAD = 50; // -
207     int BALOAD = 51; // -
208     int CALOAD = 52; // -
209     int SALOAD = 53; // -
210     int ISTORE = 54; // visitVarInsn
211     int LSTORE = 55; // -
212     int FSTORE = 56; // -
213     int DSTORE = 57; // -
214     int ASTORE = 58; // -
215     // int ISTORE_0 = 59; // -
216     // int ISTORE_1 = 60; // -
217     // int ISTORE_2 = 61; // -
218     // int ISTORE_3 = 62; // -
219     // int LSTORE_0 = 63; // -
220     // int LSTORE_1 = 64; // -
221     // int LSTORE_2 = 65; // -
222     // int LSTORE_3 = 66; // -
223     // int FSTORE_0 = 67; // -
224     // int FSTORE_1 = 68; // -
225     // int FSTORE_2 = 69; // -
226     // int FSTORE_3 = 70; // -
227     // int DSTORE_0 = 71; // -
228     // int DSTORE_1 = 72; // -
229     // int DSTORE_2 = 73; // -
230     // int DSTORE_3 = 74; // -
231     // int ASTORE_0 = 75; // -
232     // int ASTORE_1 = 76; // -
233     // int ASTORE_2 = 77; // -
234     // int ASTORE_3 = 78; // -
235     int IASTORE = 79; // visitInsn
236     int LASTORE = 80; // -
237     int FASTORE = 81; // -
238     int DASTORE = 82; // -
239     int AASTORE = 83; // -
240     int BASTORE = 84; // -
241     int CASTORE = 85; // -
242     int SASTORE = 86; // -
243     int POP = 87; // -
244     int POP2 = 88; // -
245     int DUP = 89; // -
246     int DUP_X1 = 90; // -
247     int DUP_X2 = 91; // -
248     int DUP2 = 92; // -
249     int DUP2_X1 = 93; // -
250     int DUP2_X2 = 94; // -
251     int SWAP = 95; // -
252     int IADD = 96; // -
253     int LADD = 97; // -
254     int FADD = 98; // -
255     int DADD = 99; // -
256     int ISUB = 100; // -
257     int LSUB = 101; // -
258     int FSUB = 102; // -
259     int DSUB = 103; // -
260     int IMUL = 104; // -
261     int LMUL = 105; // -
262     int FMUL = 106; // -
263     int DMUL = 107; // -
264     int IDIV = 108; // -
265     int LDIV = 109; // -
266     int FDIV = 110; // -
267     int DDIV = 111; // -
268     int IREM = 112; // -
269     int LREM = 113; // -
270     int FREM = 114; // -
271     int DREM = 115; // -
272     int INEG = 116; // -
273     int LNEG = 117; // -
274     int FNEG = 118; // -
275     int DNEG = 119; // -
276     int ISHL = 120; // -
277     int LSHL = 121; // -
278     int ISHR = 122; // -
279     int LSHR = 123; // -
280     int IUSHR = 124; // -
281     int LUSHR = 125; // -
282     int IAND = 126; // -
283     int LAND = 127; // -
284     int IOR = 128; // -
285     int LOR = 129; // -
286     int IXOR = 130; // -
287     int LXOR = 131; // -
288     int IINC = 132; // visitIincInsn
289     int I2L = 133; // visitInsn
290     int I2F = 134; // -
291     int I2D = 135; // -
292     int L2I = 136; // -
293     int L2F = 137; // -
294     int L2D = 138; // -
295     int F2I = 139; // -
296     int F2L = 140; // -
297     int F2D = 141; // -
298     int D2I = 142; // -
299     int D2L = 143; // -
300     int D2F = 144; // -
301     int I2B = 145; // -
302     int I2C = 146; // -
303     int I2S = 147; // -
304     int LCMP = 148; // -
305     int FCMPL = 149; // -
306     int FCMPG = 150; // -
307     int DCMPL = 151; // -
308     int DCMPG = 152; // -
309     int IFEQ = 153; // visitJumpInsn
310     int IFNE = 154; // -
311     int IFLT = 155; // -
312     int IFGE = 156; // -
313     int IFGT = 157; // -
314     int IFLE = 158; // -
315     int IF_ICMPEQ = 159; // -
316     int IF_ICMPNE = 160; // -
317     int IF_ICMPLT = 161; // -
318     int IF_ICMPGE = 162; // -
319     int IF_ICMPGT = 163; // -
320     int IF_ICMPLE = 164; // -
321     int IF_ACMPEQ = 165; // -
322     int IF_ACMPNE = 166; // -
323     int GOTO = 167; // -
324     int JSR = 168; // -
325     int RET = 169; // visitVarInsn
326     int TABLESWITCH = 170; // visiTableSwitchInsn
327     int LOOKUPSWITCH = 171; // visitLookupSwitch
328     int IRETURN = 172; // visitInsn
329     int LRETURN = 173; // -
330     int FRETURN = 174; // -
331     int DRETURN = 175; // -
332     int ARETURN = 176; // -
333     int RETURN = 177; // -
334     int GETSTATIC = 178; // visitFieldInsn
335     int PUTSTATIC = 179; // -
336     int GETFIELD = 180; // -
337     int PUTFIELD = 181; // -
338     int INVOKEVIRTUAL = 182; // visitMethodInsn
339     int INVOKESPECIAL = 183; // -
340     int INVOKESTATIC = 184; // -
341     int INVOKEINTERFACE = 185; // -
342     int INVOKEDYNAMIC = 186; // visitInvokeDynamicInsn
343     int NEW = 187; // visitTypeInsn
344     int NEWARRAY = 188; // visitIntInsn
345     int ANEWARRAY = 189; // visitTypeInsn
346     int ARRAYLENGTH = 190; // visitInsn
347     int ATHROW = 191; // -
348     int CHECKCAST = 192; // visitTypeInsn
349     int INSTANCEOF = 193; // -
350     int MONITORENTER = 194; // visitInsn
351     int MONITOREXIT = 195; // -
352     // int WIDE = 196; // NOT VISITED
353     int MULTIANEWARRAY = 197; // visitMultiANewArrayInsn
354     int IFNULL = 198; // visitJumpInsn
355     int IFNONNULL = 199; // -
356     // int GOTO_W = 200; // -
357     // int JSR_W = 201; // -
358 }
359