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        // empty
042    }
043
044    /*
045     * NOTE these are not currently immutable, because Instruction has mutable protected fields opcode and length.
046     */
047    Instruction NOP = InstructionConst.NOP;
048    Instruction ACONST_NULL = InstructionConst.ACONST_NULL;
049    Instruction ICONST_M1 = InstructionConst.ICONST_M1;
050    Instruction ICONST_0 = InstructionConst.ICONST_0;
051    Instruction ICONST_1 = InstructionConst.ICONST_1;
052    Instruction ICONST_2 = InstructionConst.ICONST_2;
053    Instruction ICONST_3 = InstructionConst.ICONST_3;
054    Instruction ICONST_4 = InstructionConst.ICONST_4;
055    Instruction ICONST_5 = InstructionConst.ICONST_5;
056    Instruction LCONST_0 = InstructionConst.LCONST_0;
057    Instruction LCONST_1 = InstructionConst.LCONST_1;
058    Instruction FCONST_0 = InstructionConst.FCONST_0;
059    Instruction FCONST_1 = InstructionConst.FCONST_1;
060    Instruction FCONST_2 = InstructionConst.FCONST_2;
061    Instruction DCONST_0 = InstructionConst.DCONST_0;
062    Instruction DCONST_1 = InstructionConst.DCONST_1;
063    ArrayInstruction IALOAD = InstructionConst.IALOAD;
064    ArrayInstruction LALOAD = InstructionConst.LALOAD;
065    ArrayInstruction FALOAD = InstructionConst.FALOAD;
066    ArrayInstruction DALOAD = InstructionConst.DALOAD;
067    ArrayInstruction AALOAD = InstructionConst.AALOAD;
068    ArrayInstruction BALOAD = InstructionConst.BALOAD;
069    ArrayInstruction CALOAD = InstructionConst.CALOAD;
070    ArrayInstruction SALOAD = InstructionConst.SALOAD;
071    ArrayInstruction IASTORE = InstructionConst.IASTORE;
072    ArrayInstruction LASTORE = InstructionConst.LASTORE;
073    ArrayInstruction FASTORE = InstructionConst.FASTORE;
074    ArrayInstruction DASTORE = InstructionConst.DASTORE;
075    ArrayInstruction AASTORE = InstructionConst.AASTORE;
076    ArrayInstruction BASTORE = InstructionConst.BASTORE;
077    ArrayInstruction CASTORE = InstructionConst.CASTORE;
078    ArrayInstruction SASTORE = InstructionConst.SASTORE;
079    StackInstruction POP = InstructionConst.POP;
080    StackInstruction POP2 = InstructionConst.POP2;
081    StackInstruction DUP = InstructionConst.DUP;
082    StackInstruction DUP_X1 = InstructionConst.DUP_X1;
083    StackInstruction DUP_X2 = InstructionConst.DUP_X2;
084    StackInstruction DUP2 = InstructionConst.DUP2;
085    StackInstruction DUP2_X1 = InstructionConst.DUP2_X1;
086    StackInstruction DUP2_X2 = InstructionConst.DUP2_X2;
087    StackInstruction SWAP = InstructionConst.SWAP;
088    ArithmeticInstruction IADD = InstructionConst.IADD;
089    ArithmeticInstruction LADD = InstructionConst.LADD;
090    ArithmeticInstruction FADD = InstructionConst.FADD;
091    ArithmeticInstruction DADD = InstructionConst.DADD;
092    ArithmeticInstruction ISUB = InstructionConst.ISUB;
093    ArithmeticInstruction LSUB = InstructionConst.LSUB;
094    ArithmeticInstruction FSUB = InstructionConst.FSUB;
095    ArithmeticInstruction DSUB = InstructionConst.DSUB;
096    ArithmeticInstruction IMUL = InstructionConst.IMUL;
097    ArithmeticInstruction LMUL = InstructionConst.LMUL;
098    ArithmeticInstruction FMUL = InstructionConst.FMUL;
099    ArithmeticInstruction DMUL = InstructionConst.DMUL;
100    ArithmeticInstruction IDIV = InstructionConst.IDIV;
101    ArithmeticInstruction LDIV = InstructionConst.LDIV;
102    ArithmeticInstruction FDIV = InstructionConst.FDIV;
103    ArithmeticInstruction DDIV = InstructionConst.DDIV;
104    ArithmeticInstruction IREM = InstructionConst.IREM;
105    ArithmeticInstruction LREM = InstructionConst.LREM;
106    ArithmeticInstruction FREM = InstructionConst.FREM;
107    ArithmeticInstruction DREM = InstructionConst.DREM;
108    ArithmeticInstruction INEG = InstructionConst.INEG;
109    ArithmeticInstruction LNEG = InstructionConst.LNEG;
110    ArithmeticInstruction FNEG = InstructionConst.FNEG;
111    ArithmeticInstruction DNEG = InstructionConst.DNEG;
112    ArithmeticInstruction ISHL = InstructionConst.ISHL;
113    ArithmeticInstruction LSHL = InstructionConst.LSHL;
114    ArithmeticInstruction ISHR = InstructionConst.ISHR;
115    ArithmeticInstruction LSHR = InstructionConst.LSHR;
116    ArithmeticInstruction IUSHR = InstructionConst.IUSHR;
117    ArithmeticInstruction LUSHR = InstructionConst.LUSHR;
118    ArithmeticInstruction IAND = InstructionConst.IAND;
119    ArithmeticInstruction LAND = InstructionConst.LAND;
120    ArithmeticInstruction IOR = InstructionConst.IOR;
121    ArithmeticInstruction LOR = InstructionConst.LOR;
122    ArithmeticInstruction IXOR = InstructionConst.IXOR;
123    ArithmeticInstruction LXOR = InstructionConst.LXOR;
124    ConversionInstruction I2L = InstructionConst.I2L;
125    ConversionInstruction I2F = InstructionConst.I2F;
126    ConversionInstruction I2D = InstructionConst.I2D;
127    ConversionInstruction L2I = InstructionConst.L2I;
128    ConversionInstruction L2F = InstructionConst.L2F;
129    ConversionInstruction L2D = InstructionConst.L2D;
130    ConversionInstruction F2I = InstructionConst.F2I;
131    ConversionInstruction F2L = InstructionConst.F2L;
132    ConversionInstruction F2D = InstructionConst.F2D;
133    ConversionInstruction D2I = InstructionConst.D2I;
134    ConversionInstruction D2L = InstructionConst.D2L;
135    ConversionInstruction D2F = InstructionConst.D2F;
136    ConversionInstruction I2B = InstructionConst.I2B;
137    ConversionInstruction I2C = InstructionConst.I2C;
138    ConversionInstruction I2S = InstructionConst.I2S;
139    Instruction LCMP = InstructionConst.LCMP;
140    Instruction FCMPL = InstructionConst.FCMPL;
141    Instruction FCMPG = InstructionConst.FCMPG;
142    Instruction DCMPL = InstructionConst.DCMPL;
143    Instruction DCMPG = InstructionConst.DCMPG;
144    ReturnInstruction IRETURN = InstructionConst.IRETURN;
145    ReturnInstruction LRETURN = InstructionConst.LRETURN;
146    ReturnInstruction FRETURN = InstructionConst.FRETURN;
147    ReturnInstruction DRETURN = InstructionConst.DRETURN;
148    ReturnInstruction ARETURN = InstructionConst.ARETURN;
149    ReturnInstruction RETURN = InstructionConst.RETURN;
150    Instruction ARRAYLENGTH = InstructionConst.ARRAYLENGTH;
151    Instruction ATHROW = InstructionConst.ATHROW;
152    Instruction MONITORENTER = InstructionConst.MONITORENTER;
153    Instruction MONITOREXIT = InstructionConst.MONITOREXIT;
154
155    /**
156     * You can use these constants in multiple places safely, if you can guarantee that you will never alter their internal
157     * values, e.g. call setIndex().
158     */
159    LocalVariableInstruction THIS = InstructionConst.THIS;
160    LocalVariableInstruction ALOAD_0 = InstructionConst.ALOAD_0;
161    LocalVariableInstruction ALOAD_1 = InstructionConst.ALOAD_1;
162    LocalVariableInstruction ALOAD_2 = InstructionConst.ALOAD_2;
163    LocalVariableInstruction ILOAD_0 = InstructionConst.ILOAD_0;
164    LocalVariableInstruction ILOAD_1 = InstructionConst.ILOAD_1;
165    LocalVariableInstruction ILOAD_2 = InstructionConst.ILOAD_2;
166    LocalVariableInstruction ASTORE_0 = InstructionConst.ASTORE_0;
167    LocalVariableInstruction ASTORE_1 = InstructionConst.ASTORE_1;
168    LocalVariableInstruction ASTORE_2 = InstructionConst.ASTORE_2;
169    LocalVariableInstruction ISTORE_0 = InstructionConst.ISTORE_0;
170    LocalVariableInstruction ISTORE_1 = InstructionConst.ISTORE_1;
171    LocalVariableInstruction ISTORE_2 = InstructionConst.ISTORE_2;
172
173    /**
174     * Gets object via its opcode, for immutable instructions like branch instructions entries are set to null.
175     */
176    Instruction[] INSTRUCTIONS = InstructionConst.INSTRUCTIONS;
177
178    /**
179     * Interfaces may have no static initializers, so we simulate this with an inner class.
180     */
181    Clinit bla = new Clinit();
182}