1 /* 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * 4 * This code is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License version 2 only, as 6 * published by the Free Software Foundation. Oracle designates this 7 * particular file as subject to the "Classpath" exception as provided 8 * by Oracle in the LICENSE file that accompanied this code. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 */ 24 25 /* 26 * This file is available under and governed by the GNU General Public 27 * License version 2 only, as published by the Free Software Foundation. 28 * However, the following notice accompanied the original version of this 29 * file: 30 * 31 * ASM: a very small and fast Java bytecode manipulation framework 32 * Copyright (c) 2000-2011 INRIA, France Telecom 33 * All rights reserved. 34 * 35 * Redistribution and use in source and binary forms, with or without 36 * modification, are permitted provided that the following conditions 37 * are met: 38 * 1. Redistributions of source code must retain the above copyright 39 * notice, this list of conditions and the following disclaimer. 40 * 2. Redistributions in binary form must reproduce the above copyright 41 * notice, this list of conditions and the following disclaimer in the 42 * documentation and/or other materials provided with the distribution. 43 * 3. Neither the name of the copyright holders nor the names of its 44 * contributors may be used to endorse or promote products derived from 45 * this software without specific prior written permission. 46 * 47 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 48 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 49 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 50 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 51 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 52 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 53 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 54 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 55 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 56 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 57 * THE POSSIBILITY OF SUCH DAMAGE. 58 */ 59 package jdk.internal.org.objectweb.asm; 60 61 /** 62 * The JVM opcodes, access flags and array type codes. This interface does not define all the JVM 63 * opcodes because some opcodes are automatically handled. For example, the xLOAD and xSTORE opcodes 64 * are automatically replaced by xLOAD_n and xSTORE_n opcodes when possible. The xLOAD_n and 65 * xSTORE_n opcodes are therefore not defined in this interface. Likewise for LDC, automatically 66 * replaced by LDC_W or LDC2_W when necessary, WIDE, GOTO_W and JSR_W. 67 * 68 * @see <a href="https://docs.oracle.com/javase/specs/jvms/se11/html/jvms-6.html">JVMS 6</a> 69 * @author Eric Bruneton 70 * @author Eugene Kuleshov 71 */ 72 // DontCheck(InterfaceIsType): can't be fixed (for backward binary compatibility). 73 public interface Opcodes { 74 75 // ASM API versions. 76 77 int ASM4 = 4 << 16 | 0 << 8; 78 int ASM5 = 5 << 16 | 0 << 8; 79 int ASM6 = 6 << 16 | 0 << 8; 80 int ASM7 = 7 << 16 | 0 << 8; 81 82 // Java ClassFile versions (the minor version is stored in the 16 most 83 // significant bits, and the 84 // major version in the 16 least significant bits). 85 86 int V1_1 = 3 << 16 | 45; 87 int V1_2 = 0 << 16 | 46; 88 int V1_3 = 0 << 16 | 47; 89 int V1_4 = 0 << 16 | 48; 90 int V1_5 = 0 << 16 | 49; 91 int V1_6 = 0 << 16 | 50; 92 int V1_7 = 0 << 16 | 51; 93 int V1_8 = 0 << 16 | 52; 94 int V9 = 0 << 16 | 53; 95 int V10 = 0 << 16 | 54; 96 int V11 = 0 << 16 | 55; 97 int V12 = 0 << 16 | 56; 98 int V13 = 0 << 16 | 57; 99 100 /** 101 * Version flag indicating that the class is using 'preview' features. 102 * 103 * <p>{@code version & V_PREVIEW == V_PREVIEW} tests if a version is flagged with {@code 104 * V_PREVIEW}. 105 */ 106 int V_PREVIEW = 0xFFFF0000; 107 108 // Access flags values, defined in 109 // - https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.1-200-E.1 110 // - https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.5-200-A.1 111 // - https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.6-200-A.1 112 // - https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.25 113 114 int ACC_PUBLIC = 0x0001; // class, field, method 115 int ACC_PRIVATE = 0x0002; // class, field, method 116 int ACC_PROTECTED = 0x0004; // class, field, method 117 int ACC_STATIC = 0x0008; // field, method 118 int ACC_FINAL = 0x0010; // class, field, method, parameter 119 int ACC_SUPER = 0x0020; // class 120 int ACC_SYNCHRONIZED = 0x0020; // method 121 int ACC_OPEN = 0x0020; // module 122 int ACC_TRANSITIVE = 0x0020; // module requires 123 int ACC_VOLATILE = 0x0040; // field 124 int ACC_BRIDGE = 0x0040; // method 125 int ACC_STATIC_PHASE = 0x0040; // module requires 126 int ACC_VARARGS = 0x0080; // method 127 int ACC_TRANSIENT = 0x0080; // field 128 int ACC_NATIVE = 0x0100; // method 129 int ACC_INTERFACE = 0x0200; // class 130 int ACC_ABSTRACT = 0x0400; // class, method 131 int ACC_STRICT = 0x0800; // method 132 int ACC_SYNTHETIC = 0x1000; // class, field, method, parameter, module * 133 int ACC_ANNOTATION = 0x2000; // class 134 int ACC_ENUM = 0x4000; // class(?) field inner 135 int ACC_MANDATED = 0x8000; // parameter, module, module * 136 int ACC_MODULE = 0x8000; // class 137 138 // ASM specific access flags. 139 // WARNING: the 16 least significant bits must NOT be used, to avoid conflicts with standard 140 // access flags, and also to make sure that these flags are automatically filtered out when 141 // written in class files (because access flags are stored using 16 bits only). 142 143 int ACC_DEPRECATED = 0x20000; // class, field, method 144 145 // Possible values for the type operand of the NEWARRAY instruction. 146 // See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-6.html#jvms-6.5.newarray. 147 148 int T_BOOLEAN = 4; 149 int T_CHAR = 5; 150 int T_FLOAT = 6; 151 int T_DOUBLE = 7; 152 int T_BYTE = 8; 153 int T_SHORT = 9; 154 int T_INT = 10; 155 int T_LONG = 11; 156 157 // Possible values for the reference_kind field of CONSTANT_MethodHandle_info structures. 158 // See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.4.8. 159 160 int H_GETFIELD = 1; 161 int H_GETSTATIC = 2; 162 int H_PUTFIELD = 3; 163 int H_PUTSTATIC = 4; 164 int H_INVOKEVIRTUAL = 5; 165 int H_INVOKESTATIC = 6; 166 int H_INVOKESPECIAL = 7; 167 int H_NEWINVOKESPECIAL = 8; 168 int H_INVOKEINTERFACE = 9; 169 170 // ASM specific stack map frame types, used in {@link ClassVisitor#visitFrame}. 171 172 /** An expanded frame. See {@link ClassReader#EXPAND_FRAMES}. */ 173 int F_NEW = -1; 174 175 /** A compressed frame with complete frame data. */ 176 int F_FULL = 0; 177 178 /** 179 * A compressed frame where locals are the same as the locals in the previous frame, except that 180 * additional 1-3 locals are defined, and with an empty stack. 181 */ 182 int F_APPEND = 1; 183 184 /** 185 * A compressed frame where locals are the same as the locals in the previous frame, except that 186 * the last 1-3 locals are absent and with an empty stack. 187 */ 188 int F_CHOP = 2; 189 190 /** 191 * A compressed frame with exactly the same locals as the previous frame and with an empty stack. 192 */ 193 int F_SAME = 3; 194 195 /** 196 * A compressed frame with exactly the same locals as the previous frame and with a single value 197 * on the stack. 198 */ 199 int F_SAME1 = 4; 200 201 // Standard stack map frame element types, used in {@link ClassVisitor#visitFrame}. 202 203 Integer TOP = Frame.ITEM_TOP; 204 Integer INTEGER = Frame.ITEM_INTEGER; 205 Integer FLOAT = Frame.ITEM_FLOAT; 206 Integer DOUBLE = Frame.ITEM_DOUBLE; 207 Integer LONG = Frame.ITEM_LONG; 208 Integer NULL = Frame.ITEM_NULL; 209 Integer UNINITIALIZED_THIS = Frame.ITEM_UNINITIALIZED_THIS; 210 211 // The JVM opcode values (with the MethodVisitor method name used to visit them in comment, and 212 // where '-' means 'same method name as on the previous line'). 213 // See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-6.html. 214 215 int NOP = 0; // visitInsn 216 int ACONST_NULL = 1; // - 217 int ICONST_M1 = 2; // - 218 int ICONST_0 = 3; // - 219 int ICONST_1 = 4; // - 220 int ICONST_2 = 5; // - 221 int ICONST_3 = 6; // - 222 int ICONST_4 = 7; // - 223 int ICONST_5 = 8; // - 224 int LCONST_0 = 9; // - 225 int LCONST_1 = 10; // - 226 int FCONST_0 = 11; // - 227 int FCONST_1 = 12; // - 228 int FCONST_2 = 13; // - 229 int DCONST_0 = 14; // - 230 int DCONST_1 = 15; // - 231 int BIPUSH = 16; // visitIntInsn 232 int SIPUSH = 17; // - 233 int LDC = 18; // visitLdcInsn 234 int ILOAD = 21; // visitVarInsn 235 int LLOAD = 22; // - 236 int FLOAD = 23; // - 237 int DLOAD = 24; // - 238 int ALOAD = 25; // - 239 int IALOAD = 46; // visitInsn 240 int LALOAD = 47; // - 241 int FALOAD = 48; // - 242 int DALOAD = 49; // - 243 int AALOAD = 50; // - 244 int BALOAD = 51; // - 245 int CALOAD = 52; // - 246 int SALOAD = 53; // - 247 int ISTORE = 54; // visitVarInsn 248 int LSTORE = 55; // - 249 int FSTORE = 56; // - 250 int DSTORE = 57; // - 251 int ASTORE = 58; // - 252 int IASTORE = 79; // visitInsn 253 int LASTORE = 80; // - 254 int FASTORE = 81; // - 255 int DASTORE = 82; // - 256 int AASTORE = 83; // - 257 int BASTORE = 84; // - 258 int CASTORE = 85; // - 259 int SASTORE = 86; // - 260 int POP = 87; // - 261 int POP2 = 88; // - 262 int DUP = 89; // - 263 int DUP_X1 = 90; // - 264 int DUP_X2 = 91; // - 265 int DUP2 = 92; // - 266 int DUP2_X1 = 93; // - 267 int DUP2_X2 = 94; // - 268 int SWAP = 95; // - 269 int IADD = 96; // - 270 int LADD = 97; // - 271 int FADD = 98; // - 272 int DADD = 99; // - 273 int ISUB = 100; // - 274 int LSUB = 101; // - 275 int FSUB = 102; // - 276 int DSUB = 103; // - 277 int IMUL = 104; // - 278 int LMUL = 105; // - 279 int FMUL = 106; // - 280 int DMUL = 107; // - 281 int IDIV = 108; // - 282 int LDIV = 109; // - 283 int FDIV = 110; // - 284 int DDIV = 111; // - 285 int IREM = 112; // - 286 int LREM = 113; // - 287 int FREM = 114; // - 288 int DREM = 115; // - 289 int INEG = 116; // - 290 int LNEG = 117; // - 291 int FNEG = 118; // - 292 int DNEG = 119; // - 293 int ISHL = 120; // - 294 int LSHL = 121; // - 295 int ISHR = 122; // - 296 int LSHR = 123; // - 297 int IUSHR = 124; // - 298 int LUSHR = 125; // - 299 int IAND = 126; // - 300 int LAND = 127; // - 301 int IOR = 128; // - 302 int LOR = 129; // - 303 int IXOR = 130; // - 304 int LXOR = 131; // - 305 int IINC = 132; // visitIincInsn 306 int I2L = 133; // visitInsn 307 int I2F = 134; // - 308 int I2D = 135; // - 309 int L2I = 136; // - 310 int L2F = 137; // - 311 int L2D = 138; // - 312 int F2I = 139; // - 313 int F2L = 140; // - 314 int F2D = 141; // - 315 int D2I = 142; // - 316 int D2L = 143; // - 317 int D2F = 144; // - 318 int I2B = 145; // - 319 int I2C = 146; // - 320 int I2S = 147; // - 321 int LCMP = 148; // - 322 int FCMPL = 149; // - 323 int FCMPG = 150; // - 324 int DCMPL = 151; // - 325 int DCMPG = 152; // - 326 int IFEQ = 153; // visitJumpInsn 327 int IFNE = 154; // - 328 int IFLT = 155; // - 329 int IFGE = 156; // - 330 int IFGT = 157; // - 331 int IFLE = 158; // - 332 int IF_ICMPEQ = 159; // - 333 int IF_ICMPNE = 160; // - 334 int IF_ICMPLT = 161; // - 335 int IF_ICMPGE = 162; // - 336 int IF_ICMPGT = 163; // - 337 int IF_ICMPLE = 164; // - 338 int IF_ACMPEQ = 165; // - 339 int IF_ACMPNE = 166; // - 340 int GOTO = 167; // - 341 int JSR = 168; // - 342 int RET = 169; // visitVarInsn 343 int TABLESWITCH = 170; // visiTableSwitchInsn 344 int LOOKUPSWITCH = 171; // visitLookupSwitch 345 int IRETURN = 172; // visitInsn 346 int LRETURN = 173; // - 347 int FRETURN = 174; // - 348 int DRETURN = 175; // - 349 int ARETURN = 176; // - 350 int RETURN = 177; // - 351 int GETSTATIC = 178; // visitFieldInsn 352 int PUTSTATIC = 179; // - 353 int GETFIELD = 180; // - 354 int PUTFIELD = 181; // - 355 int INVOKEVIRTUAL = 182; // visitMethodInsn 356 int INVOKESPECIAL = 183; // - 357 int INVOKESTATIC = 184; // - 358 int INVOKEINTERFACE = 185; // - 359 int INVOKEDYNAMIC = 186; // visitInvokeDynamicInsn 360 int NEW = 187; // visitTypeInsn 361 int NEWARRAY = 188; // visitIntInsn 362 int ANEWARRAY = 189; // visitTypeInsn 363 int ARRAYLENGTH = 190; // visitInsn 364 int ATHROW = 191; // - 365 int CHECKCAST = 192; // visitTypeInsn 366 int INSTANCEOF = 193; // - 367 int MONITORENTER = 194; // visitInsn 368 int MONITOREXIT = 195; // - 369 int MULTIANEWARRAY = 197; // visitMultiANewArrayInsn 370 int IFNULL = 198; // visitJumpInsn 371 int IFNONNULL = 199; // - 372 }