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