    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one or more
    003 * contributor license agreements.  See the NOTICE file distributed with
    004 * this work for additional information regarding copyright ownership.
    005 * The ASF licenses this file to You under the Apache License, Version 2.0
    006 * (the "License"); you may not use this file except in compliance with
    007 * the License.  You may obtain a copy of the License at
    008 *
    009 *      http://www.apache.org/licenses/LICENSE-2.0
    010 *
    011 *  Unless required by applicable law or agreed to in writing, software
    012 *  distributed under the License is distributed on an "AS IS" BASIS,
    013 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014 *  See the License for the specific language governing permissions and
    015 *  limitations under the License.
    016 */
    017package org.apache.bcel.generic;
    018
    019/**
    020 * Contains shareable instruction objects.
    021 * <p>
    022 * In order to save memory you can use some instructions multiply, since they have an immutable state and are directly
    023 * derived from Instruction. I.e. they have no instance fields that could be changed. Since some of these instructions
    024 * like ICONST_0 occur very frequently this can save a lot of time and space. This feature is an adaptation of the
    025 * FlyWeight design pattern, we just use an array instead of a factory.
    026 * </p>
    027 * <p>
    028 * The Instructions can also accessed directly under their names, so it's possible to write
    029 * il.append(Instruction.ICONST_0);
    030 * </p>
    031 *
    032 * @deprecated (since 6.0) Do not use. Use {@link InstructionConst} instead.
    033 */
    034@Deprecated
    035public interface InstructionConstants {
    036
    037    /**
    038     * Deprecated, consider private and ignore.
    039     */
    040    class Clinit {}
    041
    042    /*
    043     * NOTE these are not currently immutable, because Instruction has mutable protected fields opcode and length.
    044     */
    045    Instruction NOP = InstructionConst.NOP;
    046    Instruction ACONST_NULL = InstructionConst.ACONST_NULL;
    047    Instruction ICONST_M1 = InstructionConst.ICONST_M1;
    048    Instruction ICONST_0 = InstructionConst.ICONST_0;
    049    Instruction ICONST_1 = InstructionConst.ICONST_1;
    050    Instruction ICONST_2 = InstructionConst.ICONST_2;
    051    Instruction ICONST_3 = InstructionConst.ICONST_3;
    052    Instruction ICONST_4 = InstructionConst.ICONST_4;
    053    Instruction ICONST_5 = InstructionConst.ICONST_5;
    054    Instruction LCONST_0 = InstructionConst.LCONST_0;
    055    Instruction LCONST_1 = InstructionConst.LCONST_1;
    056    Instruction FCONST_0 = InstructionConst.FCONST_0;
    057    Instruction FCONST_1 = InstructionConst.FCONST_1;
    058    Instruction FCONST_2 = InstructionConst.FCONST_2;
    059    Instruction DCONST_0 = InstructionConst.DCONST_0;
    060    Instruction DCONST_1 = InstructionConst.DCONST_1;
    061    ArrayInstruction IALOAD = InstructionConst.IALOAD;
    062    ArrayInstruction LALOAD = InstructionConst.LALOAD;
    063    ArrayInstruction FALOAD = InstructionConst.FALOAD;
    064    ArrayInstruction DALOAD = InstructionConst.DALOAD;
    065    ArrayInstruction AALOAD = InstructionConst.AALOAD;
    066    ArrayInstruction BALOAD = InstructionConst.BALOAD;
    067    ArrayInstruction CALOAD = InstructionConst.CALOAD;
    068    ArrayInstruction SALOAD = InstructionConst.SALOAD;
    069    ArrayInstruction IASTORE = InstructionConst.IASTORE;
    070    ArrayInstruction LASTORE = InstructionConst.LASTORE;
    071    ArrayInstruction FASTORE = InstructionConst.FASTORE;
    072    ArrayInstruction DASTORE = InstructionConst.DASTORE;
    073    ArrayInstruction AASTORE = InstructionConst.AASTORE;
    074    ArrayInstruction BASTORE = InstructionConst.BASTORE;
    075    ArrayInstruction CASTORE = InstructionConst.CASTORE;
    076    ArrayInstruction SASTORE = InstructionConst.SASTORE;
    077    StackInstruction POP = InstructionConst.POP;
    078    StackInstruction POP2 = InstructionConst.POP2;
    079    StackInstruction DUP = InstructionConst.DUP;
    080    StackInstruction DUP_X1 = InstructionConst.DUP_X1;
    081    StackInstruction DUP_X2 = InstructionConst.DUP_X2;
    082    StackInstruction DUP2 = InstructionConst.DUP2;
    083    StackInstruction DUP2_X1 = InstructionConst.DUP2_X1;
    084    StackInstruction DUP2_X2 = InstructionConst.DUP2_X2;
    085    StackInstruction SWAP = InstructionConst.SWAP;
    086    ArithmeticInstruction IADD = InstructionConst.IADD;
    087    ArithmeticInstruction LADD = InstructionConst.LADD;
    088    ArithmeticInstruction FADD = InstructionConst.FADD;
    089    ArithmeticInstruction DADD = InstructionConst.DADD;
    090    ArithmeticInstruction ISUB = InstructionConst.ISUB;
    091    ArithmeticInstruction LSUB = InstructionConst.LSUB;
    092    ArithmeticInstruction FSUB = InstructionConst.FSUB;
    093    ArithmeticInstruction DSUB = InstructionConst.DSUB;
    094    ArithmeticInstruction IMUL = InstructionConst.IMUL;
    095    ArithmeticInstruction LMUL = InstructionConst.LMUL;
    096    ArithmeticInstruction FMUL = InstructionConst.FMUL;
    097    ArithmeticInstruction DMUL = InstructionConst.DMUL;
    098    ArithmeticInstruction IDIV = InstructionConst.IDIV;
    099    ArithmeticInstruction LDIV = InstructionConst.LDIV;
    100    ArithmeticInstruction FDIV = InstructionConst.FDIV;
    101    ArithmeticInstruction DDIV = InstructionConst.DDIV;
    102    ArithmeticInstruction IREM = InstructionConst.IREM;
    103    ArithmeticInstruction LREM = InstructionConst.LREM;
    104    ArithmeticInstruction FREM = InstructionConst.FREM;
    105    ArithmeticInstruction DREM = InstructionConst.DREM;
    106    ArithmeticInstruction INEG = InstructionConst.INEG;
    107    ArithmeticInstruction LNEG = InstructionConst.LNEG;
    108    ArithmeticInstruction FNEG = InstructionConst.FNEG;
    109    ArithmeticInstruction DNEG = InstructionConst.DNEG;
    110    ArithmeticInstruction ISHL = InstructionConst.ISHL;
    111    ArithmeticInstruction LSHL = InstructionConst.LSHL;
    112    ArithmeticInstruction ISHR = InstructionConst.ISHR;
    113    ArithmeticInstruction LSHR = InstructionConst.LSHR;
    114    ArithmeticInstruction IUSHR = InstructionConst.IUSHR;
    115    ArithmeticInstruction LUSHR = InstructionConst.LUSHR;
    116    ArithmeticInstruction IAND = InstructionConst.IAND;
    117    ArithmeticInstruction LAND = InstructionConst.LAND;
    118    ArithmeticInstruction IOR = InstructionConst.IOR;
    119    ArithmeticInstruction LOR = InstructionConst.LOR;
    120    ArithmeticInstruction IXOR = InstructionConst.IXOR;
    121    ArithmeticInstruction LXOR = InstructionConst.LXOR;
    122    ConversionInstruction I2L = InstructionConst.I2L;
    123    ConversionInstruction I2F = InstructionConst.I2F;
    124    ConversionInstruction I2D = InstructionConst.I2D;
    125    ConversionInstruction L2I = InstructionConst.L2I;
    126    ConversionInstruction L2F = InstructionConst.L2F;
    127    ConversionInstruction L2D = InstructionConst.L2D;
    128    ConversionInstruction F2I = InstructionConst.F2I;
    129    ConversionInstruction F2L = InstructionConst.F2L;
    130    ConversionInstruction F2D = InstructionConst.F2D;
    131    ConversionInstruction D2I = InstructionConst.D2I;
    132    ConversionInstruction D2L = InstructionConst.D2L;
    133    ConversionInstruction D2F = InstructionConst.D2F;
    134    ConversionInstruction I2B = InstructionConst.I2B;
    135    ConversionInstruction I2C = InstructionConst.I2C;
    136    ConversionInstruction I2S = InstructionConst.I2S;
    137    Instruction LCMP = InstructionConst.LCMP;
    138    Instruction FCMPL = InstructionConst.FCMPL;
    139    Instruction FCMPG = InstructionConst.FCMPG;
    140    Instruction DCMPL = InstructionConst.DCMPL;
    141    Instruction DCMPG = InstructionConst.DCMPG;
    142    ReturnInstruction IRETURN = InstructionConst.IRETURN;
    143    ReturnInstruction LRETURN = InstructionConst.LRETURN;
    144    ReturnInstruction FRETURN = InstructionConst.FRETURN;
    145    ReturnInstruction DRETURN = InstructionConst.DRETURN;
    146    ReturnInstruction ARETURN = InstructionConst.ARETURN;
    147    ReturnInstruction RETURN = InstructionConst.RETURN;
    148    Instruction ARRAYLENGTH = InstructionConst.ARRAYLENGTH;
    149    Instruction ATHROW = InstructionConst.ATHROW;
    150    Instruction MONITORENTER = InstructionConst.MONITORENTER;
    151    Instruction MONITOREXIT = InstructionConst.MONITOREXIT;
    152
    153    /**
    154     * You can use these constants in multiple places safely, if you can guarantee that you will never alter their internal
    155     * values, e.g. call setIndex().
    156     */
    157    LocalVariableInstruction THIS = InstructionConst.THIS;
    158    LocalVariableInstruction ALOAD_0 = InstructionConst.ALOAD_0;
    159    LocalVariableInstruction ALOAD_1 = InstructionConst.ALOAD_1;
    160    LocalVariableInstruction ALOAD_2 = InstructionConst.ALOAD_2;
    161    LocalVariableInstruction ILOAD_0 = InstructionConst.ILOAD_0;
    162    LocalVariableInstruction ILOAD_1 = InstructionConst.ILOAD_1;
    163    LocalVariableInstruction ILOAD_2 = InstructionConst.ILOAD_2;
    164    LocalVariableInstruction ASTORE_0 = InstructionConst.ASTORE_0;
    165    LocalVariableInstruction ASTORE_1 = InstructionConst.ASTORE_1;
    166    LocalVariableInstruction ASTORE_2 = InstructionConst.ASTORE_2;
    167    LocalVariableInstruction ISTORE_0 = InstructionConst.ISTORE_0;
    168    LocalVariableInstruction ISTORE_1 = InstructionConst.ISTORE_1;
    169    LocalVariableInstruction ISTORE_2 = InstructionConst.ISTORE_2;
    170
    171    /**
    172     * Gets object via its opcode, for immutable instructions like branch instructions entries are set to null.
    173     */
    174    Instruction[] INSTRUCTIONS = InstructionConst.INSTRUCTIONS;
    175
    176    /**
    177     * Interfaces may have no static initializers, so we simulate this with an inner class.
    178     */
    179    Clinit bla = new Clinit();
    180}