View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   https://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.bcel.generic;
20  
21  /**
22   * Contains shareable instruction objects.
23   * <p>
24   * In order to save memory you can use some instructions multiply, since they have an immutable state and are directly
25   * derived from Instruction. I.e. they have no instance fields that could be changed. Since some of these instructions
26   * like ICONST_0 occur very frequently this can save a lot of time and space. This feature is an adaptation of the
27   * FlyWeight design pattern, we just use an array instead of a factory.
28   * </p>
29   * <p>
30   * The Instructions can also accessed directly under their names, so it's possible to write
31   * il.append(Instruction.ICONST_0);
32   * </p>
33   *
34   * @deprecated (since 6.0) Do not use. Use {@link InstructionConst} instead.
35   */
36  @Deprecated
37  public interface InstructionConstants {
38  
39      /**
40       * Deprecated, consider private and ignore.
41       */
42      class Clinit {
43          // empty
44      }
45  
46      /*
47       * NOTE these are not currently immutable, because Instruction has mutable protected fields opcode and length.
48       */
49      Instruction NOP = InstructionConst.NOP;
50      Instruction ACONST_NULL = InstructionConst.ACONST_NULL;
51      Instruction ICONST_M1 = InstructionConst.ICONST_M1;
52      Instruction ICONST_0 = InstructionConst.ICONST_0;
53      Instruction ICONST_1 = InstructionConst.ICONST_1;
54      Instruction ICONST_2 = InstructionConst.ICONST_2;
55      Instruction ICONST_3 = InstructionConst.ICONST_3;
56      Instruction ICONST_4 = InstructionConst.ICONST_4;
57      Instruction ICONST_5 = InstructionConst.ICONST_5;
58      Instruction LCONST_0 = InstructionConst.LCONST_0;
59      Instruction LCONST_1 = InstructionConst.LCONST_1;
60      Instruction FCONST_0 = InstructionConst.FCONST_0;
61      Instruction FCONST_1 = InstructionConst.FCONST_1;
62      Instruction FCONST_2 = InstructionConst.FCONST_2;
63      Instruction DCONST_0 = InstructionConst.DCONST_0;
64      Instruction DCONST_1 = InstructionConst.DCONST_1;
65      ArrayInstruction IALOAD = InstructionConst.IALOAD;
66      ArrayInstruction LALOAD = InstructionConst.LALOAD;
67      ArrayInstruction FALOAD = InstructionConst.FALOAD;
68      ArrayInstruction DALOAD = InstructionConst.DALOAD;
69      ArrayInstruction AALOAD = InstructionConst.AALOAD;
70      ArrayInstruction BALOAD = InstructionConst.BALOAD;
71      ArrayInstruction CALOAD = InstructionConst.CALOAD;
72      ArrayInstruction SALOAD = InstructionConst.SALOAD;
73      ArrayInstruction IASTORE = InstructionConst.IASTORE;
74      ArrayInstruction LASTORE = InstructionConst.LASTORE;
75      ArrayInstruction FASTORE = InstructionConst.FASTORE;
76      ArrayInstruction DASTORE = InstructionConst.DASTORE;
77      ArrayInstruction AASTORE = InstructionConst.AASTORE;
78      ArrayInstruction BASTORE = InstructionConst.BASTORE;
79      ArrayInstruction CASTORE = InstructionConst.CASTORE;
80      ArrayInstruction SASTORE = InstructionConst.SASTORE;
81      StackInstruction POP = InstructionConst.POP;
82      StackInstruction POP2 = InstructionConst.POP2;
83      StackInstruction DUP = InstructionConst.DUP;
84      StackInstruction DUP_X1 = InstructionConst.DUP_X1;
85      StackInstruction DUP_X2 = InstructionConst.DUP_X2;
86      StackInstruction DUP2 = InstructionConst.DUP2;
87      StackInstruction DUP2_X1 = InstructionConst.DUP2_X1;
88      StackInstruction DUP2_X2 = InstructionConst.DUP2_X2;
89      StackInstruction SWAP = InstructionConst.SWAP;
90      ArithmeticInstruction IADD = InstructionConst.IADD;
91      ArithmeticInstruction LADD = InstructionConst.LADD;
92      ArithmeticInstruction FADD = InstructionConst.FADD;
93      ArithmeticInstruction DADD = InstructionConst.DADD;
94      ArithmeticInstruction ISUB = InstructionConst.ISUB;
95      ArithmeticInstruction LSUB = InstructionConst.LSUB;
96      ArithmeticInstruction FSUB = InstructionConst.FSUB;
97      ArithmeticInstruction DSUB = InstructionConst.DSUB;
98      ArithmeticInstruction IMUL = InstructionConst.IMUL;
99      ArithmeticInstruction LMUL = InstructionConst.LMUL;
100     ArithmeticInstruction FMUL = InstructionConst.FMUL;
101     ArithmeticInstruction DMUL = InstructionConst.DMUL;
102     ArithmeticInstruction IDIV = InstructionConst.IDIV;
103     ArithmeticInstruction LDIV = InstructionConst.LDIV;
104     ArithmeticInstruction FDIV = InstructionConst.FDIV;
105     ArithmeticInstruction DDIV = InstructionConst.DDIV;
106     ArithmeticInstruction IREM = InstructionConst.IREM;
107     ArithmeticInstruction LREM = InstructionConst.LREM;
108     ArithmeticInstruction FREM = InstructionConst.FREM;
109     ArithmeticInstruction DREM = InstructionConst.DREM;
110     ArithmeticInstruction INEG = InstructionConst.INEG;
111     ArithmeticInstruction LNEG = InstructionConst.LNEG;
112     ArithmeticInstruction FNEG = InstructionConst.FNEG;
113     ArithmeticInstruction DNEG = InstructionConst.DNEG;
114     ArithmeticInstruction ISHL = InstructionConst.ISHL;
115     ArithmeticInstruction LSHL = InstructionConst.LSHL;
116     ArithmeticInstruction ISHR = InstructionConst.ISHR;
117     ArithmeticInstruction LSHR = InstructionConst.LSHR;
118     ArithmeticInstruction IUSHR = InstructionConst.IUSHR;
119     ArithmeticInstruction LUSHR = InstructionConst.LUSHR;
120     ArithmeticInstruction IAND = InstructionConst.IAND;
121     ArithmeticInstruction LAND = InstructionConst.LAND;
122     ArithmeticInstruction IOR = InstructionConst.IOR;
123     ArithmeticInstruction LOR = InstructionConst.LOR;
124     ArithmeticInstruction IXOR = InstructionConst.IXOR;
125     ArithmeticInstruction LXOR = InstructionConst.LXOR;
126     ConversionInstruction I2L = InstructionConst.I2L;
127     ConversionInstruction I2F = InstructionConst.I2F;
128     ConversionInstruction I2D = InstructionConst.I2D;
129     ConversionInstruction L2I = InstructionConst.L2I;
130     ConversionInstruction L2F = InstructionConst.L2F;
131     ConversionInstruction L2D = InstructionConst.L2D;
132     ConversionInstruction F2I = InstructionConst.F2I;
133     ConversionInstruction F2L = InstructionConst.F2L;
134     ConversionInstruction F2D = InstructionConst.F2D;
135     ConversionInstruction D2I = InstructionConst.D2I;
136     ConversionInstruction D2L = InstructionConst.D2L;
137     ConversionInstruction D2F = InstructionConst.D2F;
138     ConversionInstruction I2B = InstructionConst.I2B;
139     ConversionInstruction I2C = InstructionConst.I2C;
140     ConversionInstruction I2S = InstructionConst.I2S;
141     Instruction LCMP = InstructionConst.LCMP;
142     Instruction FCMPL = InstructionConst.FCMPL;
143     Instruction FCMPG = InstructionConst.FCMPG;
144     Instruction DCMPL = InstructionConst.DCMPL;
145     Instruction DCMPG = InstructionConst.DCMPG;
146     ReturnInstruction IRETURN = InstructionConst.IRETURN;
147     ReturnInstruction LRETURN = InstructionConst.LRETURN;
148     ReturnInstruction FRETURN = InstructionConst.FRETURN;
149     ReturnInstruction DRETURN = InstructionConst.DRETURN;
150     ReturnInstruction ARETURN = InstructionConst.ARETURN;
151     ReturnInstruction RETURN = InstructionConst.RETURN;
152     Instruction ARRAYLENGTH = InstructionConst.ARRAYLENGTH;
153     Instruction ATHROW = InstructionConst.ATHROW;
154     Instruction MONITORENTER = InstructionConst.MONITORENTER;
155     Instruction MONITOREXIT = InstructionConst.MONITOREXIT;
156 
157     /**
158      * You can use these constants in multiple places safely, if you can guarantee that you will never alter their internal
159      * values, for example call setIndex().
160      */
161     LocalVariableInstruction THIS = InstructionConst.THIS;
162     LocalVariableInstruction ALOAD_0 = InstructionConst.ALOAD_0;
163     LocalVariableInstruction ALOAD_1 = InstructionConst.ALOAD_1;
164     LocalVariableInstruction ALOAD_2 = InstructionConst.ALOAD_2;
165     LocalVariableInstruction ILOAD_0 = InstructionConst.ILOAD_0;
166     LocalVariableInstruction ILOAD_1 = InstructionConst.ILOAD_1;
167     LocalVariableInstruction ILOAD_2 = InstructionConst.ILOAD_2;
168     LocalVariableInstruction ASTORE_0 = InstructionConst.ASTORE_0;
169     LocalVariableInstruction ASTORE_1 = InstructionConst.ASTORE_1;
170     LocalVariableInstruction ASTORE_2 = InstructionConst.ASTORE_2;
171     LocalVariableInstruction ISTORE_0 = InstructionConst.ISTORE_0;
172     LocalVariableInstruction ISTORE_1 = InstructionConst.ISTORE_1;
173     LocalVariableInstruction ISTORE_2 = InstructionConst.ISTORE_2;
174 
175     /**
176      * Gets object via its opcode, for immutable instructions like branch instructions entries are set to null.
177      */
178     Instruction[] INSTRUCTIONS = InstructionConst.INSTRUCTIONS;
179 
180     /**
181      * Interfaces may have no static initializers, so we simulate this with an inner class.
182      */
183     Clinit bla = new Clinit();
184 }