Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

InstructionConstants.java

00001 package de.fub.bytecode.generic;
00002 
00003 import de.fub.bytecode.Constants;
00004 
00005 /** 
00006  * This interface contains shareable instruction objects.
00007  *
00008  * In order to save memory you can use some instructions multiply,
00009  * since they have an immutable state and are directly derived from
00010  * Instruction.  I.e. they have no instance fields that could be
00011  * changed. Since some of these instructions like ICONST_0 occur
00012  * very frequently this can save a lot of time and space. This
00013  * feature is an adaptation of the FlyWeight design pattern, we
00014  * just use an array instead of a factory.
00015  *
00016  * The Instructions can also accessed directly under their names, so
00017  * it's possible to write il.append(Instruction.ICONST_0);
00018  *
00019  * @version $Id: InstructionConstants.java,v 1.1.1.1 2002/01/24 03:41:40 pserver Exp $
00020  * @author  <A HREF="http://www.inf.fu-berlin.de/~dahm">M. Dahm</A>
00021  */
00022 public interface InstructionConstants {
00023   /** Predefined instruction objects
00024    */
00025   public static final Instruction           NOP          = new NOP();
00026   public static final Instruction           ACONST_NULL  = new ACONST_NULL();
00027   public static final Instruction           ICONST_M1    = new ICONST(-1);
00028   public static final Instruction           ICONST_0     = new ICONST(0);
00029   public static final Instruction           ICONST_1     = new ICONST(1);
00030   public static final Instruction           ICONST_2     = new ICONST(2);
00031   public static final Instruction           ICONST_3     = new ICONST(3);
00032   public static final Instruction           ICONST_4     = new ICONST(4);
00033   public static final Instruction           ICONST_5     = new ICONST(5);
00034   public static final Instruction           LCONST_0     = new LCONST(0);
00035   public static final Instruction           LCONST_1     = new LCONST(1);
00036   public static final Instruction           FCONST_0     = new FCONST(0);
00037   public static final Instruction           FCONST_1     = new FCONST(1);
00038   public static final Instruction           FCONST_2     = new FCONST(2);
00039   public static final Instruction           DCONST_0     = new DCONST(0);
00040   public static final Instruction           DCONST_1     = new DCONST(1);
00041   public static final ArrayInstruction      IALOAD       = new IALOAD();
00042   public static final ArrayInstruction      LALOAD       = new LALOAD();
00043   public static final ArrayInstruction      FALOAD       = new FALOAD();
00044   public static final ArrayInstruction      DALOAD       = new DALOAD();
00045   public static final ArrayInstruction      AALOAD       = new AALOAD();
00046   public static final ArrayInstruction      BALOAD       = new BALOAD();
00047   public static final ArrayInstruction      CALOAD       = new CALOAD();
00048   public static final ArrayInstruction      SALOAD       = new SALOAD();
00049   public static final ArrayInstruction      IASTORE      = new IASTORE();
00050   public static final ArrayInstruction      LASTORE      = new LASTORE();
00051   public static final ArrayInstruction      FASTORE      = new FASTORE();
00052   public static final ArrayInstruction      DASTORE      = new DASTORE();
00053   public static final ArrayInstruction      AASTORE      = new AASTORE();
00054   public static final ArrayInstruction      BASTORE      = new BASTORE();
00055   public static final ArrayInstruction      CASTORE      = new CASTORE();
00056   public static final ArrayInstruction      SASTORE      = new SASTORE();
00057   public static final StackInstruction      POP          = new POP();
00058   public static final StackInstruction      POP2         = new POP2();
00059   public static final StackInstruction      DUP          = new DUP();
00060   public static final StackInstruction      DUP_X1       = new DUP_X1();
00061   public static final StackInstruction      DUP_X2       = new DUP_X2();
00062   public static final StackInstruction      DUP2         = new DUP2();
00063   public static final StackInstruction      DUP2_X1      = new DUP2_X1();
00064   public static final StackInstruction      DUP2_X2      = new DUP2_X2();
00065   public static final StackInstruction      SWAP         = new SWAP();
00066   public static final ArithmeticInstruction IADD         = new IADD();
00067   public static final ArithmeticInstruction LADD         = new LADD();
00068   public static final ArithmeticInstruction FADD         = new FADD();
00069   public static final ArithmeticInstruction DADD         = new DADD();
00070   public static final ArithmeticInstruction ISUB         = new ISUB();
00071   public static final ArithmeticInstruction LSUB         = new LSUB();
00072   public static final ArithmeticInstruction FSUB         = new FSUB();
00073   public static final ArithmeticInstruction DSUB         = new DSUB();
00074   public static final ArithmeticInstruction IMUL         = new IMUL();
00075   public static final ArithmeticInstruction LMUL         = new LMUL();
00076   public static final ArithmeticInstruction FMUL         = new FMUL();
00077   public static final ArithmeticInstruction DMUL         = new DMUL();
00078   public static final ArithmeticInstruction IDIV         = new IDIV();
00079   public static final ArithmeticInstruction LDIV         = new LDIV();
00080   public static final ArithmeticInstruction FDIV         = new FDIV();
00081   public static final ArithmeticInstruction DDIV         = new DDIV();
00082   public static final ArithmeticInstruction IREM         = new IREM();
00083   public static final ArithmeticInstruction LREM         = new LREM();
00084   public static final ArithmeticInstruction FREM         = new FREM();
00085   public static final ArithmeticInstruction DREM         = new DREM();
00086   public static final ArithmeticInstruction INEG         = new INEG();
00087   public static final ArithmeticInstruction LNEG         = new LNEG();
00088   public static final ArithmeticInstruction FNEG         = new FNEG();
00089   public static final ArithmeticInstruction DNEG         = new DNEG();
00090   public static final ArithmeticInstruction ISHL         = new ISHL();
00091   public static final ArithmeticInstruction LSHL         = new LSHL();
00092   public static final ArithmeticInstruction ISHR         = new ISHR();
00093   public static final ArithmeticInstruction LSHR         = new LSHR();
00094   public static final ArithmeticInstruction IUSHR        = new IUSHR();
00095   public static final ArithmeticInstruction LUSHR        = new LUSHR();
00096   public static final ArithmeticInstruction IAND         = new IAND();
00097   public static final ArithmeticInstruction LAND         = new LAND();
00098   public static final ArithmeticInstruction IOR          = new IOR();
00099   public static final ArithmeticInstruction LOR          = new LOR();
00100   public static final ArithmeticInstruction IXOR         = new IXOR();
00101   public static final ArithmeticInstruction LXOR         = new LXOR();
00102   public static final ConversionInstruction I2L          = new I2L();
00103   public static final ConversionInstruction I2F          = new I2F();
00104   public static final ConversionInstruction I2D          = new I2D();
00105   public static final ConversionInstruction L2I          = new L2I();
00106   public static final ConversionInstruction L2F          = new L2F();
00107   public static final ConversionInstruction L2D          = new L2D();
00108   public static final ConversionInstruction F2I          = new F2I();
00109   public static final ConversionInstruction F2L          = new F2L();
00110   public static final ConversionInstruction F2D          = new F2D();
00111   public static final ConversionInstruction D2I          = new D2I();
00112   public static final ConversionInstruction D2L          = new D2L();
00113   public static final ConversionInstruction D2F          = new D2F();
00114   public static final ConversionInstruction I2B          = new I2B();
00115   public static final ConversionInstruction I2C          = new I2C();
00116   public static final ConversionInstruction I2S          = new I2S();
00117   public static final Instruction           LCMP         = new LCMP();
00118   public static final Instruction           FCMPL        = new FCMPL();
00119   public static final Instruction           FCMPG        = new FCMPG();
00120   public static final Instruction           DCMPL        = new DCMPL();
00121   public static final Instruction           DCMPG        = new DCMPG();
00122   public static final ReturnInstruction     IRETURN      = new IRETURN();
00123   public static final ReturnInstruction     LRETURN      = new LRETURN();
00124   public static final ReturnInstruction     FRETURN      = new FRETURN();
00125   public static final ReturnInstruction     DRETURN      = new DRETURN();
00126   public static final ReturnInstruction     ARETURN      = new ARETURN();
00127   public static final ReturnInstruction     RETURN       = new RETURN();
00128   public static final Instruction           ARRAYLENGTH  = new ARRAYLENGTH();
00129   public static final Instruction           ATHROW       = new ATHROW();
00130   public static final Instruction           MONITORENTER = new MONITORENTER();
00131   public static final Instruction           MONITOREXIT  = new MONITOREXIT();
00132 
00133   /** You can use these constants in multiple places safely, if you can guarantee
00134    * that you will never alter their internal values, e.g. call setIndex().
00135    */
00136   public static final LocalVariableInstruction THIS    = new ALOAD(0);
00137   public static final LocalVariableInstruction ALOAD_0 = THIS;
00138   public static final LocalVariableInstruction ALOAD_1 = new ALOAD(1);
00139   public static final LocalVariableInstruction ALOAD_2 = new ALOAD(2);
00140   public static final LocalVariableInstruction ILOAD_0 = new ILOAD(0);
00141   public static final LocalVariableInstruction ILOAD_1 = new ILOAD(1);
00142   public static final LocalVariableInstruction ILOAD_2 = new ILOAD(2);
00143   public static final LocalVariableInstruction ASTORE_0 = new ASTORE(0);
00144   public static final LocalVariableInstruction ASTORE_1 = new ASTORE(1);
00145   public static final LocalVariableInstruction ASTORE_2 = new ASTORE(2);
00146   public static final LocalVariableInstruction ISTORE_0 = new ISTORE(0);
00147   public static final LocalVariableInstruction ISTORE_1 = new ISTORE(1);
00148   public static final LocalVariableInstruction ISTORE_2 = new ISTORE(2);
00149 
00150 
00151   /** Get object via its opcode, for immutable instructions like
00152    * branch instructions entries are set to null.
00153    */
00154   public static final Instruction[] INSTRUCTIONS = new Instruction[256];
00155   
00156   /** Interfaces may have no static initializers, so we simulate this
00157    * with an inner class.
00158    */
00159   static final Clinit bla = new Clinit();
00160 
00161   static class Clinit {
00162     Clinit() {
00163       INSTRUCTIONS[Constants.NOP] = NOP;
00164       INSTRUCTIONS[Constants.ACONST_NULL] = ACONST_NULL;
00165       INSTRUCTIONS[Constants.ICONST_M1] = ICONST_M1;
00166       INSTRUCTIONS[Constants.ICONST_0] = ICONST_0;
00167       INSTRUCTIONS[Constants.ICONST_1] = ICONST_1;
00168       INSTRUCTIONS[Constants.ICONST_2] = ICONST_2;
00169       INSTRUCTIONS[Constants.ICONST_3] = ICONST_3;
00170       INSTRUCTIONS[Constants.ICONST_4] = ICONST_4;
00171       INSTRUCTIONS[Constants.ICONST_5] = ICONST_5;
00172       INSTRUCTIONS[Constants.LCONST_0] = LCONST_0;
00173       INSTRUCTIONS[Constants.LCONST_1] = LCONST_1;
00174       INSTRUCTIONS[Constants.FCONST_0] = FCONST_0;
00175       INSTRUCTIONS[Constants.FCONST_1] = FCONST_1;
00176       INSTRUCTIONS[Constants.FCONST_2] = FCONST_2;
00177       INSTRUCTIONS[Constants.DCONST_0] = DCONST_0;
00178       INSTRUCTIONS[Constants.DCONST_1] = DCONST_1;
00179       INSTRUCTIONS[Constants.IALOAD] = IALOAD;
00180       INSTRUCTIONS[Constants.LALOAD] = LALOAD;
00181       INSTRUCTIONS[Constants.FALOAD] = FALOAD;
00182       INSTRUCTIONS[Constants.DALOAD] = DALOAD;
00183       INSTRUCTIONS[Constants.AALOAD] = AALOAD;
00184       INSTRUCTIONS[Constants.BALOAD] = BALOAD;
00185       INSTRUCTIONS[Constants.CALOAD] = CALOAD;
00186       INSTRUCTIONS[Constants.SALOAD] = SALOAD;
00187       INSTRUCTIONS[Constants.IASTORE] = IASTORE;
00188       INSTRUCTIONS[Constants.LASTORE] = LASTORE;
00189       INSTRUCTIONS[Constants.FASTORE] = FASTORE;
00190       INSTRUCTIONS[Constants.DASTORE] = DASTORE;
00191       INSTRUCTIONS[Constants.AASTORE] = AASTORE;
00192       INSTRUCTIONS[Constants.BASTORE] = BASTORE;
00193       INSTRUCTIONS[Constants.CASTORE] = CASTORE;
00194       INSTRUCTIONS[Constants.SASTORE] = SASTORE;
00195       INSTRUCTIONS[Constants.POP] = POP;
00196       INSTRUCTIONS[Constants.POP2] = POP2;
00197       INSTRUCTIONS[Constants.DUP] = DUP;
00198       INSTRUCTIONS[Constants.DUP_X1] = DUP_X1;
00199       INSTRUCTIONS[Constants.DUP_X2] = DUP_X2;
00200       INSTRUCTIONS[Constants.DUP2] = DUP2;
00201       INSTRUCTIONS[Constants.DUP2_X1] = DUP2_X1;
00202       INSTRUCTIONS[Constants.DUP2_X2] = DUP2_X2;
00203       INSTRUCTIONS[Constants.SWAP] = SWAP;
00204       INSTRUCTIONS[Constants.IADD] = IADD;
00205       INSTRUCTIONS[Constants.LADD] = LADD;
00206       INSTRUCTIONS[Constants.FADD] = FADD;
00207       INSTRUCTIONS[Constants.DADD] = DADD;
00208       INSTRUCTIONS[Constants.ISUB] = ISUB;
00209       INSTRUCTIONS[Constants.LSUB] = LSUB;
00210       INSTRUCTIONS[Constants.FSUB] = FSUB;
00211       INSTRUCTIONS[Constants.DSUB] = DSUB;
00212       INSTRUCTIONS[Constants.IMUL] = IMUL;
00213       INSTRUCTIONS[Constants.LMUL] = LMUL;
00214       INSTRUCTIONS[Constants.FMUL] = FMUL;
00215       INSTRUCTIONS[Constants.DMUL] = DMUL;
00216       INSTRUCTIONS[Constants.IDIV] = IDIV;
00217       INSTRUCTIONS[Constants.LDIV] = LDIV;
00218       INSTRUCTIONS[Constants.FDIV] = FDIV;
00219       INSTRUCTIONS[Constants.DDIV] = DDIV;
00220       INSTRUCTIONS[Constants.IREM] = IREM;
00221       INSTRUCTIONS[Constants.LREM] = LREM;
00222       INSTRUCTIONS[Constants.FREM] = FREM;
00223       INSTRUCTIONS[Constants.DREM] = DREM;
00224       INSTRUCTIONS[Constants.INEG] = INEG;
00225       INSTRUCTIONS[Constants.LNEG] = LNEG;
00226       INSTRUCTIONS[Constants.FNEG] = FNEG;
00227       INSTRUCTIONS[Constants.DNEG] = DNEG;
00228       INSTRUCTIONS[Constants.ISHL] = ISHL;
00229       INSTRUCTIONS[Constants.LSHL] = LSHL;
00230       INSTRUCTIONS[Constants.ISHR] = ISHR;
00231       INSTRUCTIONS[Constants.LSHR] = LSHR;
00232       INSTRUCTIONS[Constants.IUSHR] = IUSHR;
00233       INSTRUCTIONS[Constants.LUSHR] = LUSHR;
00234       INSTRUCTIONS[Constants.IAND] = IAND;
00235       INSTRUCTIONS[Constants.LAND] = LAND;
00236       INSTRUCTIONS[Constants.IOR] = IOR;
00237       INSTRUCTIONS[Constants.LOR] = LOR;
00238       INSTRUCTIONS[Constants.IXOR] = IXOR;
00239       INSTRUCTIONS[Constants.LXOR] = LXOR;
00240       INSTRUCTIONS[Constants.I2L] = I2L;
00241       INSTRUCTIONS[Constants.I2F] = I2F;
00242       INSTRUCTIONS[Constants.I2D] = I2D;
00243       INSTRUCTIONS[Constants.L2I] = L2I;
00244       INSTRUCTIONS[Constants.L2F] = L2F;
00245       INSTRUCTIONS[Constants.L2D] = L2D;
00246       INSTRUCTIONS[Constants.F2I] = F2I;
00247       INSTRUCTIONS[Constants.F2L] = F2L;
00248       INSTRUCTIONS[Constants.F2D] = F2D;
00249       INSTRUCTIONS[Constants.D2I] = D2I;
00250       INSTRUCTIONS[Constants.D2L] = D2L;
00251       INSTRUCTIONS[Constants.D2F] = D2F;
00252       INSTRUCTIONS[Constants.I2B] = I2B;
00253       INSTRUCTIONS[Constants.I2C] = I2C;
00254       INSTRUCTIONS[Constants.I2S] = I2S;
00255       INSTRUCTIONS[Constants.LCMP] = LCMP;
00256       INSTRUCTIONS[Constants.FCMPL] = FCMPL;
00257       INSTRUCTIONS[Constants.FCMPG] = FCMPG;
00258       INSTRUCTIONS[Constants.DCMPL] = DCMPL;
00259       INSTRUCTIONS[Constants.DCMPG] = DCMPG;
00260       INSTRUCTIONS[Constants.IRETURN] = IRETURN;
00261       INSTRUCTIONS[Constants.LRETURN] = LRETURN;
00262       INSTRUCTIONS[Constants.FRETURN] = FRETURN;
00263       INSTRUCTIONS[Constants.DRETURN] = DRETURN;
00264       INSTRUCTIONS[Constants.ARETURN] = ARETURN;
00265       INSTRUCTIONS[Constants.RETURN] = RETURN;
00266       INSTRUCTIONS[Constants.ARRAYLENGTH] = ARRAYLENGTH;
00267       INSTRUCTIONS[Constants.ATHROW] = ATHROW;
00268       INSTRUCTIONS[Constants.MONITORENTER] = MONITORENTER;
00269       INSTRUCTIONS[Constants.MONITOREXIT] = MONITOREXIT;
00270     }
00271   }
00272 }

Generated at Thu Feb 7 06:47:38 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001