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