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     int V14 = 0 << 16 | 58;
 100     int V15 = 0 << 16 | 59;
 101 
 102     /**
 103       * Version flag indicating that the class is using 'preview' features.
 104       *
 105       * <p>{@code version & V_PREVIEW == V_PREVIEW} tests if a version is flagged with {@code
 106       * V_PREVIEW}.
 107       */
 108     int V_PREVIEW = 0xFFFF0000;
 109 
 110     // Access flags values, defined in
 111     // - https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.1-200-E.1
 112     // - https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.5-200-A.1
 113     // - https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.6-200-A.1
 114     // - https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.25
 115 
 116     int ACC_PUBLIC = 0x0001; // class, field, method
 117     int ACC_PRIVATE = 0x0002; // class, field, method
 118     int ACC_PROTECTED = 0x0004; // class, field, method
 119     int ACC_STATIC = 0x0008; // field, method
 120     int ACC_FINAL = 0x0010; // class, field, method, parameter
 121     int ACC_SUPER = 0x0020; // class
 122     int ACC_SYNCHRONIZED = 0x0020; // method
 123     int ACC_OPEN = 0x0020; // module
 124     int ACC_TRANSITIVE = 0x0020; // module requires
 125     int ACC_VOLATILE = 0x0040; // field
 126     int ACC_BRIDGE = 0x0040; // method
 127     int ACC_STATIC_PHASE = 0x0040; // module requires
 128     int ACC_VARARGS = 0x0080; // method
 129     int ACC_TRANSIENT = 0x0080; // field
 130     int ACC_NATIVE = 0x0100; // method
 131     int ACC_INTERFACE = 0x0200; // class
 132     int ACC_ABSTRACT = 0x0400; // class, method
 133     int ACC_STRICT = 0x0800; // method
 134     int ACC_SYNTHETIC = 0x1000; // class, field, method, parameter, module *
 135     int ACC_ANNOTATION = 0x2000; // class
 136     int ACC_ENUM = 0x4000; // class(?) field inner
 137     int ACC_MANDATED = 0x8000; // parameter, module, module *
 138     int ACC_MODULE = 0x8000; // class
 139 
 140     // ASM specific access flags.
 141     // WARNING: the 16 least significant bits must NOT be used, to avoid conflicts with standard
 142     // access flags, and also to make sure that these flags are automatically filtered out when
 143     // written in class files (because access flags are stored using 16 bits only).
 144 
 145     int ACC_DEPRECATED = 0x20000; // class, field, method
 146 
 147     // Possible values for the type operand of the NEWARRAY instruction.
 148     // See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-6.html#jvms-6.5.newarray.
 149 
 150     int T_BOOLEAN = 4;
 151     int T_CHAR = 5;
 152     int T_FLOAT = 6;
 153     int T_DOUBLE = 7;
 154     int T_BYTE = 8;
 155     int T_SHORT = 9;
 156     int T_INT = 10;
 157     int T_LONG = 11;
 158 
 159     // Possible values for the reference_kind field of CONSTANT_MethodHandle_info structures.
 160     // See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.4.8.
 161 
 162     int H_GETFIELD = 1;
 163     int H_GETSTATIC = 2;
 164     int H_PUTFIELD = 3;
 165     int H_PUTSTATIC = 4;
 166     int H_INVOKEVIRTUAL = 5;
 167     int H_INVOKESTATIC = 6;
 168     int H_INVOKESPECIAL = 7;
 169     int H_NEWINVOKESPECIAL = 8;
 170     int H_INVOKEINTERFACE = 9;
 171 
 172     // ASM specific stack map frame types, used in {@link ClassVisitor#visitFrame}.
 173 
 174     /** An expanded frame. See {@link ClassReader#EXPAND_FRAMES}. */
 175     int F_NEW = -1;
 176 
 177     /** A compressed frame with complete frame data. */
 178     int F_FULL = 0;
 179 
 180     /**
 181       * A compressed frame where locals are the same as the locals in the previous frame, except that
 182       * additional 1-3 locals are defined, and with an empty stack.
 183       */
 184     int F_APPEND = 1;
 185 
 186     /**
 187       * A compressed frame where locals are the same as the locals in the previous frame, except that
 188       * the last 1-3 locals are absent and with an empty stack.
 189       */
 190     int F_CHOP = 2;
 191 
 192     /**
 193       * A compressed frame with exactly the same locals as the previous frame and with an empty stack.
 194       */
 195     int F_SAME = 3;
 196 
 197     /**
 198       * A compressed frame with exactly the same locals as the previous frame and with a single value
 199       * on the stack.
 200       */
 201     int F_SAME1 = 4;
 202 
 203     // Standard stack map frame element types, used in {@link ClassVisitor#visitFrame}.
 204 
 205     Integer TOP = Frame.ITEM_TOP;
 206     Integer INTEGER = Frame.ITEM_INTEGER;
 207     Integer FLOAT = Frame.ITEM_FLOAT;
 208     Integer DOUBLE = Frame.ITEM_DOUBLE;
 209     Integer LONG = Frame.ITEM_LONG;
 210     Integer NULL = Frame.ITEM_NULL;
 211     Integer UNINITIALIZED_THIS = Frame.ITEM_UNINITIALIZED_THIS;
 212 
 213     // The JVM opcode values (with the MethodVisitor method name used to visit them in comment, and
 214     // where '-' means 'same method name as on the previous line').
 215     // See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-6.html.
 216 
 217     int NOP = 0; // visitInsn
 218     int ACONST_NULL = 1; // -
 219     int ICONST_M1 = 2; // -
 220     int ICONST_0 = 3; // -
 221     int ICONST_1 = 4; // -
 222     int ICONST_2 = 5; // -
 223     int ICONST_3 = 6; // -
 224     int ICONST_4 = 7; // -
 225     int ICONST_5 = 8; // -
 226     int LCONST_0 = 9; // -
 227     int LCONST_1 = 10; // -
 228     int FCONST_0 = 11; // -
 229     int FCONST_1 = 12; // -
 230     int FCONST_2 = 13; // -
 231     int DCONST_0 = 14; // -
 232     int DCONST_1 = 15; // -
 233     int BIPUSH = 16; // visitIntInsn
 234     int SIPUSH = 17; // -
 235     int LDC = 18; // visitLdcInsn
 236     int ILOAD = 21; // visitVarInsn
 237     int LLOAD = 22; // -
 238     int FLOAD = 23; // -
 239     int DLOAD = 24; // -
 240     int ALOAD = 25; // -
 241     int IALOAD = 46; // visitInsn
 242     int LALOAD = 47; // -
 243     int FALOAD = 48; // -
 244     int DALOAD = 49; // -
 245     int AALOAD = 50; // -
 246     int BALOAD = 51; // -
 247     int CALOAD = 52; // -
 248     int SALOAD = 53; // -
 249     int ISTORE = 54; // visitVarInsn
 250     int LSTORE = 55; // -
 251     int FSTORE = 56; // -
 252     int DSTORE = 57; // -
 253     int ASTORE = 58; // -
 254     int IASTORE = 79; // visitInsn
 255     int LASTORE = 80; // -
 256     int FASTORE = 81; // -
 257     int DASTORE = 82; // -
 258     int AASTORE = 83; // -
 259     int BASTORE = 84; // -
 260     int CASTORE = 85; // -
 261     int SASTORE = 86; // -
 262     int POP = 87; // -
 263     int POP2 = 88; // -
 264     int DUP = 89; // -
 265     int DUP_X1 = 90; // -
 266     int DUP_X2 = 91; // -
 267     int DUP2 = 92; // -
 268     int DUP2_X1 = 93; // -
 269     int DUP2_X2 = 94; // -
 270     int SWAP = 95; // -
 271     int IADD = 96; // -
 272     int LADD = 97; // -
 273     int FADD = 98; // -
 274     int DADD = 99; // -
 275     int ISUB = 100; // -
 276     int LSUB = 101; // -
 277     int FSUB = 102; // -
 278     int DSUB = 103; // -
 279     int IMUL = 104; // -
 280     int LMUL = 105; // -
 281     int FMUL = 106; // -
 282     int DMUL = 107; // -
 283     int IDIV = 108; // -
 284     int LDIV = 109; // -
 285     int FDIV = 110; // -
 286     int DDIV = 111; // -
 287     int IREM = 112; // -
 288     int LREM = 113; // -
 289     int FREM = 114; // -
 290     int DREM = 115; // -
 291     int INEG = 116; // -
 292     int LNEG = 117; // -
 293     int FNEG = 118; // -
 294     int DNEG = 119; // -
 295     int ISHL = 120; // -
 296     int LSHL = 121; // -
 297     int ISHR = 122; // -
 298     int LSHR = 123; // -
 299     int IUSHR = 124; // -
 300     int LUSHR = 125; // -
 301     int IAND = 126; // -
 302     int LAND = 127; // -
 303     int IOR = 128; // -
 304     int LOR = 129; // -
 305     int IXOR = 130; // -
 306     int LXOR = 131; // -
 307     int IINC = 132; // visitIincInsn
 308     int I2L = 133; // visitInsn
 309     int I2F = 134; // -
 310     int I2D = 135; // -
 311     int L2I = 136; // -
 312     int L2F = 137; // -
 313     int L2D = 138; // -
 314     int F2I = 139; // -
 315     int F2L = 140; // -
 316     int F2D = 141; // -
 317     int D2I = 142; // -
 318     int D2L = 143; // -
 319     int D2F = 144; // -
 320     int I2B = 145; // -
 321     int I2C = 146; // -
 322     int I2S = 147; // -
 323     int LCMP = 148; // -
 324     int FCMPL = 149; // -
 325     int FCMPG = 150; // -
 326     int DCMPL = 151; // -
 327     int DCMPG = 152; // -
 328     int IFEQ = 153; // visitJumpInsn
 329     int IFNE = 154; // -
 330     int IFLT = 155; // -
 331     int IFGE = 156; // -
 332     int IFGT = 157; // -
 333     int IFLE = 158; // -
 334     int IF_ICMPEQ = 159; // -
 335     int IF_ICMPNE = 160; // -
 336     int IF_ICMPLT = 161; // -
 337     int IF_ICMPGE = 162; // -
 338     int IF_ICMPGT = 163; // -
 339     int IF_ICMPLE = 164; // -
 340     int IF_ACMPEQ = 165; // -
 341     int IF_ACMPNE = 166; // -
 342     int GOTO = 167; // -
 343     int JSR = 168; // -
 344     int RET = 169; // visitVarInsn
 345     int TABLESWITCH = 170; // visiTableSwitchInsn
 346     int LOOKUPSWITCH = 171; // visitLookupSwitch
 347     int IRETURN = 172; // visitInsn
 348     int LRETURN = 173; // -
 349     int FRETURN = 174; // -
 350     int DRETURN = 175; // -
 351     int ARETURN = 176; // -
 352     int RETURN = 177; // -
 353     int GETSTATIC = 178; // visitFieldInsn
 354     int PUTSTATIC = 179; // -
 355     int GETFIELD = 180; // -
 356     int PUTFIELD = 181; // -
 357     int INVOKEVIRTUAL = 182; // visitMethodInsn
 358     int INVOKESPECIAL = 183; // -
 359     int INVOKESTATIC = 184; // -
 360     int INVOKEINTERFACE = 185; // -
 361     int INVOKEDYNAMIC = 186; // visitInvokeDynamicInsn
 362     int NEW = 187; // visitTypeInsn
 363     int NEWARRAY = 188; // visitIntInsn
 364     int ANEWARRAY = 189; // visitTypeInsn
 365     int ARRAYLENGTH = 190; // visitInsn
 366     int ATHROW = 191; // -
 367     int CHECKCAST = 192; // visitTypeInsn
 368     int INSTANCEOF = 193; // -
 369     int MONITORENTER = 194; // visitInsn
 370     int MONITOREXIT = 195; // -
 371     int MULTIANEWARRAY = 197; // visitMultiANewArrayInsn
 372     int IFNULL = 198; // visitJumpInsn
 373     int IFNONNULL = 199; // -
 374 }