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