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