001: /***
002: * ASM: a very small and fast Java bytecode manipulation framework
003: * Copyright (c) 2000-2005 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: */package com.tc.asm;
030:
031: /**
032: * Defines the JVM opcodes, access flags and array type codes. This interface
033: * does not define all the JVM opcodes because some opcodes are automatically
034: * handled. For example, the xLOAD and xSTORE opcodes are automatically replaced
035: * by xLOAD_n and xSTORE_n opcodes when possible. The xLOAD_n and xSTORE_n
036: * opcodes are therefore not defined in this interface. Likewise for LDC,
037: * automatically replaced by LDC_W or LDC2_W when necessary, WIDE, GOTO_W and
038: * JSR_W.
039: *
040: * @author Eric Bruneton
041: * @author Eugene Kuleshov
042: */
043: public interface Opcodes {
044:
045: // versions
046:
047: int V1_1 = 3 << 16 | 45;
048: int V1_2 = 0 << 16 | 46;
049: int V1_3 = 0 << 16 | 47;
050: int V1_4 = 0 << 16 | 48;
051: int V1_5 = 0 << 16 | 49;
052: int V1_6 = 0 << 16 | 50;
053:
054: // access flags
055:
056: int ACC_PUBLIC = 0x0001; // class, field, method
057: int ACC_PRIVATE = 0x0002; // class, field, method
058: int ACC_PROTECTED = 0x0004; // class, field, method
059: int ACC_STATIC = 0x0008; // field, method
060: int ACC_FINAL = 0x0010; // class, field, method
061: int ACC_SUPER = 0x0020; // class
062: int ACC_SYNCHRONIZED = 0x0020; // method
063: int ACC_VOLATILE = 0x0040; // field
064: int ACC_BRIDGE = 0x0040; // method
065: int ACC_VARARGS = 0x0080; // method
066: int ACC_TRANSIENT = 0x0080; // field
067: int ACC_NATIVE = 0x0100; // method
068: int ACC_INTERFACE = 0x0200; // class
069: int ACC_ABSTRACT = 0x0400; // class, method
070: int ACC_STRICT = 0x0800; // method
071: int ACC_SYNTHETIC = 0x1000; // class, field, method
072: int ACC_ANNOTATION = 0x2000; // class
073: int ACC_ENUM = 0x4000; // class(?) field inner
074:
075: // ASM specific pseudo access flags
076:
077: int ACC_DEPRECATED = 131072; // class, field, method
078:
079: // types for NEWARRAY
080:
081: int T_BOOLEAN = 4;
082: int T_CHAR = 5;
083: int T_FLOAT = 6;
084: int T_DOUBLE = 7;
085: int T_BYTE = 8;
086: int T_SHORT = 9;
087: int T_INT = 10;
088: int T_LONG = 11;
089:
090: // stack map frame types
091:
092: /**
093: * Represents an expanded frame. See {@link ClassReader#EXPAND_FRAMES}.
094: */
095: int F_NEW = -1;
096:
097: /**
098: * Represents a compressed frame with complete frame data.
099: */
100: int F_FULL = 0;
101:
102: /**
103: * Represents a compressed frame where locals are the same as the locals in
104: * the previous frame, except that additional 1-3 locals are defined, and
105: * with an empty stack.
106: */
107: int F_APPEND = 1;
108:
109: /**
110: * Represents a compressed frame where locals are the same as the locals in
111: * the previous frame, except that the last 1-3 locals are absent and with
112: * an empty stack.
113: */
114: int F_CHOP = 2;
115:
116: /**
117: * Represents a compressed frame with exactly the same locals as the
118: * previous frame and with an empty stack.
119: */
120: int F_SAME = 3;
121:
122: /**
123: * Represents a compressed frame with exactly the same locals as the
124: * previous frame and with a single value on the stack.
125: */
126: int F_SAME1 = 4;
127:
128: Integer TOP = new Integer(0);
129: Integer INTEGER = new Integer(1);
130: Integer FLOAT = new Integer(2);
131: Integer DOUBLE = new Integer(3);
132: Integer LONG = new Integer(4);
133: Integer NULL = new Integer(5);
134: Integer UNINITIALIZED_THIS = new Integer(6);
135:
136: // opcodes // visit method (- = idem)
137:
138: int NOP = 0; // visitInsn
139: int ACONST_NULL = 1; // -
140: int ICONST_M1 = 2; // -
141: int ICONST_0 = 3; // -
142: int ICONST_1 = 4; // -
143: int ICONST_2 = 5; // -
144: int ICONST_3 = 6; // -
145: int ICONST_4 = 7; // -
146: int ICONST_5 = 8; // -
147: int LCONST_0 = 9; // -
148: int LCONST_1 = 10; // -
149: int FCONST_0 = 11; // -
150: int FCONST_1 = 12; // -
151: int FCONST_2 = 13; // -
152: int DCONST_0 = 14; // -
153: int DCONST_1 = 15; // -
154: int BIPUSH = 16; // visitIntInsn
155: int SIPUSH = 17; // -
156: int LDC = 18; // visitLdcInsn
157: // int LDC_W = 19; // -
158: // int LDC2_W = 20; // -
159: int ILOAD = 21; // visitVarInsn
160: int LLOAD = 22; // -
161: int FLOAD = 23; // -
162: int DLOAD = 24; // -
163: int ALOAD = 25; // -
164: // int ILOAD_0 = 26; // -
165: // int ILOAD_1 = 27; // -
166: // int ILOAD_2 = 28; // -
167: // int ILOAD_3 = 29; // -
168: // int LLOAD_0 = 30; // -
169: // int LLOAD_1 = 31; // -
170: // int LLOAD_2 = 32; // -
171: // int LLOAD_3 = 33; // -
172: // int FLOAD_0 = 34; // -
173: // int FLOAD_1 = 35; // -
174: // int FLOAD_2 = 36; // -
175: // int FLOAD_3 = 37; // -
176: // int DLOAD_0 = 38; // -
177: // int DLOAD_1 = 39; // -
178: // int DLOAD_2 = 40; // -
179: // int DLOAD_3 = 41; // -
180: // int ALOAD_0 = 42; // -
181: // int ALOAD_1 = 43; // -
182: // int ALOAD_2 = 44; // -
183: // int ALOAD_3 = 45; // -
184: int IALOAD = 46; // visitInsn
185: int LALOAD = 47; // -
186: int FALOAD = 48; // -
187: int DALOAD = 49; // -
188: int AALOAD = 50; // -
189: int BALOAD = 51; // -
190: int CALOAD = 52; // -
191: int SALOAD = 53; // -
192: int ISTORE = 54; // visitVarInsn
193: int LSTORE = 55; // -
194: int FSTORE = 56; // -
195: int DSTORE = 57; // -
196: int ASTORE = 58; // -
197: // int ISTORE_0 = 59; // -
198: // int ISTORE_1 = 60; // -
199: // int ISTORE_2 = 61; // -
200: // int ISTORE_3 = 62; // -
201: // int LSTORE_0 = 63; // -
202: // int LSTORE_1 = 64; // -
203: // int LSTORE_2 = 65; // -
204: // int LSTORE_3 = 66; // -
205: // int FSTORE_0 = 67; // -
206: // int FSTORE_1 = 68; // -
207: // int FSTORE_2 = 69; // -
208: // int FSTORE_3 = 70; // -
209: // int DSTORE_0 = 71; // -
210: // int DSTORE_1 = 72; // -
211: // int DSTORE_2 = 73; // -
212: // int DSTORE_3 = 74; // -
213: // int ASTORE_0 = 75; // -
214: // int ASTORE_1 = 76; // -
215: // int ASTORE_2 = 77; // -
216: // int ASTORE_3 = 78; // -
217: int IASTORE = 79; // visitInsn
218: int LASTORE = 80; // -
219: int FASTORE = 81; // -
220: int DASTORE = 82; // -
221: int AASTORE = 83; // -
222: int BASTORE = 84; // -
223: int CASTORE = 85; // -
224: int SASTORE = 86; // -
225: int POP = 87; // -
226: int POP2 = 88; // -
227: int DUP = 89; // -
228: int DUP_X1 = 90; // -
229: int DUP_X2 = 91; // -
230: int DUP2 = 92; // -
231: int DUP2_X1 = 93; // -
232: int DUP2_X2 = 94; // -
233: int SWAP = 95; // -
234: int IADD = 96; // -
235: int LADD = 97; // -
236: int FADD = 98; // -
237: int DADD = 99; // -
238: int ISUB = 100; // -
239: int LSUB = 101; // -
240: int FSUB = 102; // -
241: int DSUB = 103; // -
242: int IMUL = 104; // -
243: int LMUL = 105; // -
244: int FMUL = 106; // -
245: int DMUL = 107; // -
246: int IDIV = 108; // -
247: int LDIV = 109; // -
248: int FDIV = 110; // -
249: int DDIV = 111; // -
250: int IREM = 112; // -
251: int LREM = 113; // -
252: int FREM = 114; // -
253: int DREM = 115; // -
254: int INEG = 116; // -
255: int LNEG = 117; // -
256: int FNEG = 118; // -
257: int DNEG = 119; // -
258: int ISHL = 120; // -
259: int LSHL = 121; // -
260: int ISHR = 122; // -
261: int LSHR = 123; // -
262: int IUSHR = 124; // -
263: int LUSHR = 125; // -
264: int IAND = 126; // -
265: int LAND = 127; // -
266: int IOR = 128; // -
267: int LOR = 129; // -
268: int IXOR = 130; // -
269: int LXOR = 131; // -
270: int IINC = 132; // visitIincInsn
271: int I2L = 133; // visitInsn
272: int I2F = 134; // -
273: int I2D = 135; // -
274: int L2I = 136; // -
275: int L2F = 137; // -
276: int L2D = 138; // -
277: int F2I = 139; // -
278: int F2L = 140; // -
279: int F2D = 141; // -
280: int D2I = 142; // -
281: int D2L = 143; // -
282: int D2F = 144; // -
283: int I2B = 145; // -
284: int I2C = 146; // -
285: int I2S = 147; // -
286: int LCMP = 148; // -
287: int FCMPL = 149; // -
288: int FCMPG = 150; // -
289: int DCMPL = 151; // -
290: int DCMPG = 152; // -
291: int IFEQ = 153; // visitJumpInsn
292: int IFNE = 154; // -
293: int IFLT = 155; // -
294: int IFGE = 156; // -
295: int IFGT = 157; // -
296: int IFLE = 158; // -
297: int IF_ICMPEQ = 159; // -
298: int IF_ICMPNE = 160; // -
299: int IF_ICMPLT = 161; // -
300: int IF_ICMPGE = 162; // -
301: int IF_ICMPGT = 163; // -
302: int IF_ICMPLE = 164; // -
303: int IF_ACMPEQ = 165; // -
304: int IF_ACMPNE = 166; // -
305: int GOTO = 167; // -
306: int JSR = 168; // -
307: int RET = 169; // visitVarInsn
308: int TABLESWITCH = 170; // visiTableSwitchInsn
309: int LOOKUPSWITCH = 171; // visitLookupSwitch
310: int IRETURN = 172; // visitInsn
311: int LRETURN = 173; // -
312: int FRETURN = 174; // -
313: int DRETURN = 175; // -
314: int ARETURN = 176; // -
315: int RETURN = 177; // -
316: int GETSTATIC = 178; // visitFieldInsn
317: int PUTSTATIC = 179; // -
318: int GETFIELD = 180; // -
319: int PUTFIELD = 181; // -
320: int INVOKEVIRTUAL = 182; // visitMethodInsn
321: int INVOKESPECIAL = 183; // -
322: int INVOKESTATIC = 184; // -
323: int INVOKEINTERFACE = 185; // -
324: // int UNUSED = 186; // NOT VISITED
325: int NEW = 187; // visitTypeInsn
326: int NEWARRAY = 188; // visitIntInsn
327: int ANEWARRAY = 189; // visitTypeInsn
328: int ARRAYLENGTH = 190; // visitInsn
329: int ATHROW = 191; // -
330: int CHECKCAST = 192; // visitTypeInsn
331: int INSTANCEOF = 193; // -
332: int MONITORENTER = 194; // visitInsn
333: int MONITOREXIT = 195; // -
334: // int WIDE = 196; // NOT VISITED
335: int MULTIANEWARRAY = 197; // visitMultiANewArrayInsn
336: int IFNULL = 198; // visitJumpInsn
337: int IFNONNULL = 199; // -
338: // int GOTO_W = 200; // -
339: // int JSR_W = 201; // -
340: }
|