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