]> source.dussan.org Git - aspectj.git/commitdiff
359159: modified Constants initialization
authoraclement <aclement>
Wed, 28 Sep 2011 01:14:54 +0000 (01:14 +0000)
committeraclement <aclement>
Wed, 28 Sep 2011 01:14:54 +0000 (01:14 +0000)
bcel-builder/src/org/aspectj/apache/bcel/Constants.java
bcel-builder/src/org/aspectj/apache/bcel/ConstantsInitializer.java [new file with mode: 0644]
bcel-builder/src/org/aspectj/apache/bcel/generic/Type.java

index de498b241c5f4e842385a6a0acadcdf204523c85..a46daf157ec59de4c20c3013817ac937cf0d3fd5 100644 (file)
@@ -59,7 +59,7 @@ import org.aspectj.apache.bcel.generic.Type;
 /**
  * Constants for the project, mostly defined in the JVM specification.
  * 
- * @version $Id: Constants.java,v 1.6 2009/09/14 20:29:10 aclement Exp $
+ * @version $Id: Constants.java,v 1.7 2011/09/28 01:14:54 aclement Exp $
  * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
  */
 public interface Constants {
@@ -472,301 +472,7 @@ public interface Constants {
 
        public static final Class<Throwable>[][] instExcs = new Class[256][];
 
-       static final Clinit _unused = new Clinit();
-
-       static class Clinit {
-
-               static {
-                       types[ILOAD] = Type.INT;
-                       types[ISTORE] = Type.INT;
-                       types[ILOAD_0] = Type.INT;
-                       types[ISTORE_0] = Type.INT;
-                       types[ILOAD_1] = Type.INT;
-                       types[ISTORE_1] = Type.INT;
-                       types[ILOAD_2] = Type.INT;
-                       types[ISTORE_2] = Type.INT;
-                       types[ILOAD_3] = Type.INT;
-                       types[ISTORE_3] = Type.INT;
-                       types[LLOAD] = Type.LONG;
-                       types[LSTORE] = Type.LONG;
-                       types[LLOAD_0] = Type.LONG;
-                       types[LSTORE_0] = Type.LONG;
-                       types[LLOAD_1] = Type.LONG;
-                       types[LSTORE_1] = Type.LONG;
-                       types[LLOAD_2] = Type.LONG;
-                       types[LSTORE_2] = Type.LONG;
-                       types[LLOAD_3] = Type.LONG;
-                       types[LSTORE_3] = Type.LONG;
-                       types[DLOAD] = Type.DOUBLE;
-                       types[DSTORE] = Type.DOUBLE;
-                       types[DLOAD_0] = Type.DOUBLE;
-                       types[DSTORE_0] = Type.DOUBLE;
-                       types[DLOAD_1] = Type.DOUBLE;
-                       types[DSTORE_1] = Type.DOUBLE;
-                       types[DLOAD_2] = Type.DOUBLE;
-                       types[DSTORE_2] = Type.DOUBLE;
-                       types[DLOAD_3] = Type.DOUBLE;
-                       types[DSTORE_3] = Type.DOUBLE;
-                       types[FLOAD] = Type.FLOAT;
-                       types[FSTORE] = Type.FLOAT;
-                       types[FLOAD_0] = Type.FLOAT;
-                       types[FSTORE_0] = Type.FLOAT;
-                       types[FLOAD_1] = Type.FLOAT;
-                       types[FSTORE_1] = Type.FLOAT;
-                       types[FLOAD_2] = Type.FLOAT;
-                       types[FSTORE_2] = Type.FLOAT;
-                       types[FLOAD_3] = Type.FLOAT;
-                       types[FSTORE_3] = Type.FLOAT;
-                       types[ALOAD] = Type.OBJECT;
-                       types[ASTORE] = Type.OBJECT;
-                       types[ALOAD_0] = Type.OBJECT;
-                       types[ASTORE_0] = Type.OBJECT;
-                       types[ALOAD_1] = Type.OBJECT;
-                       types[ASTORE_1] = Type.OBJECT;
-                       types[ALOAD_2] = Type.OBJECT;
-                       types[ASTORE_2] = Type.OBJECT;
-                       types[ALOAD_3] = Type.OBJECT;
-                       types[ASTORE_3] = Type.OBJECT;
-
-                       // INSTRUCTION_FLAGS - set for all
-                       instFlags[NOP] = 0;
-                       instFlags[ACONST_NULL] = PUSH_INST;
-                       instFlags[ICONST_M1] = PUSH_INST | CONSTANT_INST;
-                       instFlags[ICONST_0] = PUSH_INST | CONSTANT_INST;
-                       instFlags[ICONST_1] = PUSH_INST | CONSTANT_INST;
-                       instFlags[ICONST_2] = PUSH_INST | CONSTANT_INST;
-                       instFlags[ICONST_3] = PUSH_INST | CONSTANT_INST;
-                       instFlags[ICONST_4] = PUSH_INST | CONSTANT_INST;
-                       instFlags[ICONST_5] = PUSH_INST | CONSTANT_INST;
-                       instFlags[LCONST_0] = PUSH_INST | CONSTANT_INST;
-                       instFlags[LCONST_1] = PUSH_INST | CONSTANT_INST;
-                       instFlags[FCONST_0] = PUSH_INST | CONSTANT_INST;
-                       instFlags[FCONST_1] = PUSH_INST | CONSTANT_INST;
-                       instFlags[FCONST_2] = PUSH_INST | CONSTANT_INST;
-                       instFlags[DCONST_0] = PUSH_INST | CONSTANT_INST;
-                       instFlags[DCONST_1] = PUSH_INST | CONSTANT_INST;
-
-                       instFlags[BIPUSH] = PUSH_INST | CONSTANT_INST;
-                       instFlags[SIPUSH] = PUSH_INST | CONSTANT_INST;
-
-                       instFlags[LDC] = EXCEPTION_THROWER | PUSH_INST | CP_INST | INDEXED;
-
-                       instFlags[LDC_W] = EXCEPTION_THROWER | PUSH_INST | CP_INST | INDEXED;
-
-                       instFlags[LDC2_W] = EXCEPTION_THROWER | PUSH_INST | CP_INST | INDEXED;
-
-                       // the next five could be 'wide' prefixed and so have longer lengths
-                       instFlags[ILOAD] = INDEXED | LOAD_INST | PUSH_INST | LV_INST;
-                       instFlags[LLOAD] = INDEXED | LOAD_INST | PUSH_INST | LV_INST;
-                       instFlags[FLOAD] = INDEXED | LOAD_INST | PUSH_INST | LV_INST;
-                       instFlags[DLOAD] = INDEXED | LOAD_INST | PUSH_INST | LV_INST;
-                       instFlags[ALOAD] = INDEXED | LOAD_INST | PUSH_INST | LV_INST;
-                       for (int ii = ILOAD_0; ii <= ALOAD_3; ii++) {
-                               instFlags[ii] = INDEXED | LOAD_INST | PUSH_INST | LV_INST;
-                       }
-
-                       // the next five could be 'wide' prefixed and so have longer lengths
-                       instFlags[ISTORE] = INDEXED | STORE_INST | POP_INST | LV_INST;
-                       instFlags[LSTORE] = INDEXED | STORE_INST | POP_INST | LV_INST;
-                       instFlags[FSTORE] = INDEXED | STORE_INST | POP_INST | LV_INST;
-                       instFlags[DSTORE] = INDEXED | STORE_INST | POP_INST | LV_INST;
-                       instFlags[ASTORE] = INDEXED | STORE_INST | POP_INST | LV_INST;
-                       for (int ii = ISTORE_0; ii <= ASTORE_3; ii++) {
-                               instFlags[ii] = INDEXED | STORE_INST | POP_INST | LV_INST;
-                       }
-
-                       instFlags[IDIV] = EXCEPTION_THROWER;
-                       instExcs[IDIV] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.ARITHMETIC_EXCEPTION };
-                       instFlags[IREM] = EXCEPTION_THROWER;
-                       instExcs[IREM] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.ARITHMETIC_EXCEPTION };
-                       instFlags[LDIV] = EXCEPTION_THROWER;
-                       instExcs[LDIV] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.ARITHMETIC_EXCEPTION };
-                       instFlags[LREM] = EXCEPTION_THROWER;
-                       instExcs[LREM] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.ARITHMETIC_EXCEPTION };
-
-                       instFlags[ARRAYLENGTH] = EXCEPTION_THROWER;
-                       instExcs[ARRAYLENGTH] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.NULL_POINTER_EXCEPTION };
-                       instFlags[ATHROW] = EXCEPTION_THROWER;
-                       instExcs[ATHROW] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.THROWABLE };
-
-                       instFlags[AALOAD] = EXCEPTION_THROWER;
-                       instExcs[AALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
-                       instFlags[IALOAD] = EXCEPTION_THROWER;
-                       instExcs[IALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
-                       instFlags[BALOAD] = EXCEPTION_THROWER;
-                       instExcs[BALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
-                       instFlags[FALOAD] = EXCEPTION_THROWER;
-                       instExcs[FALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
-                       instFlags[DALOAD] = EXCEPTION_THROWER;
-                       instExcs[DALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
-                       instFlags[CALOAD] = EXCEPTION_THROWER;
-                       instExcs[CALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
-                       instFlags[LALOAD] = EXCEPTION_THROWER;
-                       instExcs[LALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
-                       instFlags[SALOAD] = EXCEPTION_THROWER;
-                       instExcs[SALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
-
-                       instFlags[AASTORE] = EXCEPTION_THROWER;
-                       instExcs[AASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
-                       instFlags[IASTORE] = EXCEPTION_THROWER;
-                       instExcs[IASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
-                       instFlags[BASTORE] = EXCEPTION_THROWER;
-                       instExcs[BASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
-                       instFlags[FASTORE] = EXCEPTION_THROWER;
-                       instExcs[FASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
-                       instFlags[DASTORE] = EXCEPTION_THROWER;
-                       instExcs[DASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
-                       instFlags[CASTORE] = EXCEPTION_THROWER;
-                       instExcs[CASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
-                       instFlags[LASTORE] = EXCEPTION_THROWER;
-                       instExcs[LASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
-                       instFlags[SASTORE] = EXCEPTION_THROWER;
-                       instExcs[SASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
-
-                       // stack instructions
-                       instFlags[DUP] = PUSH_INST | STACK_INST;
-                       instFlags[DUP_X1] = STACK_INST; // TODO fixme - aren't these two push/stack producers? (although peculiar ones...)
-                       instFlags[DUP_X2] = STACK_INST;
-                       instFlags[DUP2] = PUSH_INST | STACK_INST;
-                       instFlags[DUP2_X1] = STACK_INST; // TODO fixme - aren't these two push/stack producers? (although peculiar ones...)
-                       instFlags[DUP2_X2] = STACK_INST;
-                       instFlags[POP] = STACK_INST | POP_INST;
-                       instFlags[POP2] = STACK_INST | POP_INST;
-                       instFlags[SWAP] = STACK_INST;
-
-                       instFlags[MONITORENTER] = EXCEPTION_THROWER;
-                       instExcs[MONITORENTER] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.NULL_POINTER_EXCEPTION };
-                       instFlags[MONITOREXIT] = EXCEPTION_THROWER;
-                       instExcs[MONITOREXIT] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.NULL_POINTER_EXCEPTION };
-
-                       // branching instructions
-                       instFlags[GOTO] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION;
-                       instFlags[GOTO_W] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION;
-                       instFlags[JSR] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION | JSR_INSTRUCTION;
-                       instFlags[JSR_W] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION | JSR_INSTRUCTION;
-
-                       instFlags[IFGT] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION | NEGATABLE | IF_INST;
-                       instFlags[IFLE] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION | NEGATABLE | IF_INST;
-                       instFlags[IFNE] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION | NEGATABLE | IF_INST;
-                       instFlags[IFEQ] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION | NEGATABLE | IF_INST;
-                       instFlags[IFGE] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION | NEGATABLE | IF_INST;
-                       instFlags[IFLT] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION | NEGATABLE | IF_INST;
-                       instFlags[IFNULL] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION | NEGATABLE | IF_INST;
-                       instFlags[IFNONNULL] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION | NEGATABLE | IF_INST;
-                       instFlags[IF_ACMPEQ] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION | NEGATABLE | IF_INST;
-                       instFlags[IF_ACMPNE] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION | NEGATABLE | IF_INST;
-                       instFlags[IF_ICMPEQ] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION | NEGATABLE | IF_INST;
-                       instFlags[IF_ICMPGE] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION | NEGATABLE | IF_INST;
-                       instFlags[IF_ICMPGT] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION | NEGATABLE | IF_INST;
-                       instFlags[IF_ICMPLE] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION | NEGATABLE | IF_INST;
-                       instFlags[IF_ICMPLT] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION | NEGATABLE | IF_INST;
-                       instFlags[IF_ICMPNE] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION | NEGATABLE | IF_INST;
-
-                       instFlags[LOOKUPSWITCH] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION;
-                       instFlags[TABLESWITCH] = BRANCH_INSTRUCTION | TARGETER_INSTRUCTION;
-
-                       // fixme these class arrays should be constants
-                       instFlags[ARETURN] = RET_INST | EXCEPTION_THROWER;
-                       instExcs[ARETURN] = new Class[] { ExceptionConstants.ILLEGAL_MONITOR_STATE };
-                       instFlags[DRETURN] = RET_INST | EXCEPTION_THROWER;
-                       instExcs[DRETURN] = new Class[] { ExceptionConstants.ILLEGAL_MONITOR_STATE };
-                       instFlags[FRETURN] = RET_INST | EXCEPTION_THROWER;
-                       instExcs[FRETURN] = new Class[] { ExceptionConstants.ILLEGAL_MONITOR_STATE };
-                       instFlags[IRETURN] = RET_INST | EXCEPTION_THROWER;
-                       instExcs[IRETURN] = new Class[] { ExceptionConstants.ILLEGAL_MONITOR_STATE };
-                       instFlags[LRETURN] = RET_INST | EXCEPTION_THROWER;
-                       instExcs[LRETURN] = new Class[] { ExceptionConstants.ILLEGAL_MONITOR_STATE };
-                       instFlags[RETURN] = RET_INST | EXCEPTION_THROWER;
-                       instExcs[RETURN] = new Class[] { ExceptionConstants.ILLEGAL_MONITOR_STATE };
-
-                       instFlags[NEW] = LOADCLASS_INST | EXCEPTION_THROWER | CP_INST | INDEXED;
-                       instExcs[NEW] = ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION_FOR_ALLOCATIONS;
-                       instFlags[NEWARRAY] = EXCEPTION_THROWER;
-                       instExcs[NEWARRAY] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.NEGATIVE_ARRAY_SIZE_EXCEPTION };
-
-                       types[IINC] = Type.INT;
-                       instFlags[IINC] = LV_INST | INDEXED;
-                       instFlags[RET] = INDEXED;
-
-                       instFlags[ANEWARRAY] = CP_INST | LOADCLASS_INST | EXCEPTION_THROWER | INDEXED;
-                       instExcs[ANEWARRAY] = ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION_ANEWARRAY;
-                       instFlags[CHECKCAST] = CP_INST | LOADCLASS_INST | EXCEPTION_THROWER | INDEXED;
-                       instExcs[CHECKCAST] = ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION_CHECKCAST;
-                       instFlags[INSTANCEOF] = CP_INST | LOADCLASS_INST | EXCEPTION_THROWER | INDEXED;
-                       instExcs[INSTANCEOF] = ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION;
-                       instFlags[MULTIANEWARRAY] = CP_INST | LOADCLASS_INST | EXCEPTION_THROWER | INDEXED;
-                       instExcs[MULTIANEWARRAY] = ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION_ANEWARRAY; // fixme i think this is a
-                       // stackproducer, old
-                       // bcel says no...
-
-                       instFlags[GETFIELD] = EXCEPTION_THROWER | CP_INST | LOADCLASS_INST | INDEXED;
-                       instExcs[GETFIELD] = ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION_GETFIELD_PUTFIELD;
-                       instFlags[GETSTATIC] = PUSH_INST | EXCEPTION_THROWER | LOADCLASS_INST | CP_INST | INDEXED;
-                       instExcs[GETSTATIC] = ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION_GETSTATIC_PUTSTATIC;
-                       instFlags[PUTFIELD] = POP_INST | EXCEPTION_THROWER | LOADCLASS_INST | CP_INST | INDEXED;
-                       instExcs[PUTFIELD] = ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION_GETFIELD_PUTFIELD;
-                       instFlags[PUTSTATIC] = EXCEPTION_THROWER | POP_INST | CP_INST | LOADCLASS_INST | INDEXED;
-                       instExcs[PUTSTATIC] = ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION_GETSTATIC_PUTSTATIC;
-
-                       instFlags[INVOKEINTERFACE] = EXCEPTION_THROWER | CP_INST | LOADCLASS_INST | INDEXED;
-                       instExcs[INVOKEINTERFACE] = ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION_INVOKEINTERFACE;
-                       instFlags[INVOKESPECIAL] = EXCEPTION_THROWER | CP_INST | LOADCLASS_INST | INDEXED;
-                       instExcs[INVOKESPECIAL] = ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION_INVOKESPECIAL_INVOKEVIRTUAL;
-                       instFlags[INVOKESTATIC] = EXCEPTION_THROWER | CP_INST | LOADCLASS_INST | INDEXED;
-                       instExcs[INVOKESTATIC] = ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION_INVOKESTATIC;
-                       instFlags[INVOKEVIRTUAL] = EXCEPTION_THROWER | CP_INST | LOADCLASS_INST | INDEXED;
-                       instExcs[INVOKEVIRTUAL] = ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION_INVOKESPECIAL_INVOKEVIRTUAL;
-
-                       char[] lengths = // . = varies in length, / = undefined
-                       ("1111111111111111" + // nop > dconst_1
-                                       "2323322222111111" + // bipush > lload_1
-                                       "1111111111111111" + // lload_2 > laload
-                                       "1111112222211111" + // faload > lstore_0
-                                       "1111111111111111" + // lstore_1 > iastore
-                                       "1111111111111111" + // lastore > swap
-                                       "1111111111111111" + // iadd > ddiv
-                                       "1111111111111111" + // irem > land
-                                       "1111311111111111" + // ior > d2l
-                                       "1111111113333333" + // d2f > if_icmpeq
-                                       "3333333332..1111" + // if_icmpne > dreturn
-                                       "1133333335/32311" + // areturn > athrow
-                                       "3311.433551/////").toCharArray(); // checkcast >
-                       int count = 0;
-                       for (; count < lengths.length; count++) {
-                               iLen[count] = (byte) (lengths[count] - 48);
-                       }
-                       while (count < 256) {
-                               iLen[count] = UNDEFINED;
-                               count++;
-                       }
-                       iLen[BREAKPOINT] = 1;
-                       iLen[IMPDEP1] = 1;
-                       iLen[IMPDEP2] = 1;
-
-                       char[] producesOnStack = ("0111111112211122" + // nop > dconst_1
-                                       "1111212121111122" + // bipush > lload_1
-                                       "2211112222111112" + // lload_2 > laload
-                                       "1211110000000000" + // faload > lstore_0
-                                       "0000000000000000" + // lstore_1 > iastore
-                                       "0000000002344562" + // lastore > swap
-                                       "1212121212121212" + // iadd > ddiv
-                                       "1212121212121212" + // irem > land
-                                       "1212021211212212" + // ior > d2l
-                                       "1111111110000000" + // d2f > if_icmpeq
-                                       "0000000010000000" + // if_icmpne > dreturn
-                                       "00.0.0..../11111" + // areturn > athrow
-                                       "11000100010/").toCharArray(); // checkcast >
-                       count = 0;
-                       for (; count < producesOnStack.length; count++) {
-                               stackEntriesProduced[count] = (byte) (producesOnStack[count] - 48);
-                       }
-                       while (count < 256) {
-                               iLen[count] = UNDEFINED;
-                               count++;
-                       }
-
-               }
-       }
+       static final Object _unused = ConstantsInitializer.initialize();
 
        /**
         * How the byte code operands are to be interpreted.
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/ConstantsInitializer.java b/bcel-builder/src/org/aspectj/apache/bcel/ConstantsInitializer.java
new file mode 100644 (file)
index 0000000..2196df3
--- /dev/null
@@ -0,0 +1,389 @@
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ *    "Apache BCEL" must not be used to endorse or promote products
+ *    derived from this software without prior written permission. For
+ *    written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    "Apache BCEL", nor may "Apache" appear in their name, without
+ *    prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.aspectj.apache.bcel;
+
+import org.aspectj.apache.bcel.generic.Type;
+
+public class ConstantsInitializer {
+
+       public static Object initialize() {
+               Constants.types[Constants.ILOAD] = Type.INT;
+               Constants.types[Constants.ISTORE] = Type.INT;
+               Constants.types[Constants.ILOAD_0] = Type.INT;
+               Constants.types[Constants.ISTORE_0] = Type.INT;
+               Constants.types[Constants.ILOAD_1] = Type.INT;
+               Constants.types[Constants.ISTORE_1] = Type.INT;
+               Constants.types[Constants.ILOAD_2] = Type.INT;
+               Constants.types[Constants.ISTORE_2] = Type.INT;
+               Constants.types[Constants.ILOAD_3] = Type.INT;
+               Constants.types[Constants.ISTORE_3] = Type.INT;
+               Constants.types[Constants.LLOAD] = Type.LONG;
+               Constants.types[Constants.LSTORE] = Type.LONG;
+               Constants.types[Constants.LLOAD_0] = Type.LONG;
+               Constants.types[Constants.LSTORE_0] = Type.LONG;
+               Constants.types[Constants.LLOAD_1] = Type.LONG;
+               Constants.types[Constants.LSTORE_1] = Type.LONG;
+               Constants.types[Constants.LLOAD_2] = Type.LONG;
+               Constants.types[Constants.LSTORE_2] = Type.LONG;
+               Constants.types[Constants.LLOAD_3] = Type.LONG;
+               Constants.types[Constants.LSTORE_3] = Type.LONG;
+               Constants.types[Constants.DLOAD] = Type.DOUBLE;
+               Constants.types[Constants.DSTORE] = Type.DOUBLE;
+               Constants.types[Constants.DLOAD_0] = Type.DOUBLE;
+               Constants.types[Constants.DSTORE_0] = Type.DOUBLE;
+               Constants.types[Constants.DLOAD_1] = Type.DOUBLE;
+               Constants.types[Constants.DSTORE_1] = Type.DOUBLE;
+               Constants.types[Constants.DLOAD_2] = Type.DOUBLE;
+               Constants.types[Constants.DSTORE_2] = Type.DOUBLE;
+               Constants.types[Constants.DLOAD_3] = Type.DOUBLE;
+               Constants.types[Constants.DSTORE_3] = Type.DOUBLE;
+               Constants.types[Constants.FLOAD] = Type.FLOAT;
+               Constants.types[Constants.FSTORE] = Type.FLOAT;
+               Constants.types[Constants.FLOAD_0] = Type.FLOAT;
+               Constants.types[Constants.FSTORE_0] = Type.FLOAT;
+               Constants.types[Constants.FLOAD_1] = Type.FLOAT;
+               Constants.types[Constants.FSTORE_1] = Type.FLOAT;
+               Constants.types[Constants.FLOAD_2] = Type.FLOAT;
+               Constants.types[Constants.FSTORE_2] = Type.FLOAT;
+               Constants.types[Constants.FLOAD_3] = Type.FLOAT;
+               Constants.types[Constants.FSTORE_3] = Type.FLOAT;
+               Constants.types[Constants.ALOAD] = Type.OBJECT;
+               Constants.types[Constants.ASTORE] = Type.OBJECT;
+               Constants.types[Constants.ALOAD_0] = Type.OBJECT;
+               Constants.types[Constants.ASTORE_0] = Type.OBJECT;
+               Constants.types[Constants.ALOAD_1] = Type.OBJECT;
+               Constants.types[Constants.ASTORE_1] = Type.OBJECT;
+               Constants.types[Constants.ALOAD_2] = Type.OBJECT;
+               Constants.types[Constants.ASTORE_2] = Type.OBJECT;
+               Constants.types[Constants.ALOAD_3] = Type.OBJECT;
+               Constants.types[Constants.ASTORE_3] = Type.OBJECT;
+
+               // INSTRUCTION_FLAGS - set for all
+               Constants.instFlags[Constants.NOP] = 0;
+               Constants.instFlags[Constants.ACONST_NULL] = Constants.PUSH_INST;
+               Constants.instFlags[Constants.ICONST_M1] = Constants.PUSH_INST | Constants.CONSTANT_INST;
+               Constants.instFlags[Constants.ICONST_0] = Constants.PUSH_INST | Constants.CONSTANT_INST;
+               Constants.instFlags[Constants.ICONST_1] = Constants.PUSH_INST | Constants.CONSTANT_INST;
+               Constants.instFlags[Constants.ICONST_2] = Constants.PUSH_INST | Constants.CONSTANT_INST;
+               Constants.instFlags[Constants.ICONST_3] = Constants.PUSH_INST | Constants.CONSTANT_INST;
+               Constants.instFlags[Constants.ICONST_4] = Constants.PUSH_INST | Constants.CONSTANT_INST;
+               Constants.instFlags[Constants.ICONST_5] = Constants.PUSH_INST | Constants.CONSTANT_INST;
+               Constants.instFlags[Constants.LCONST_0] = Constants.PUSH_INST | Constants.CONSTANT_INST;
+               Constants.instFlags[Constants.LCONST_1] = Constants.PUSH_INST | Constants.CONSTANT_INST;
+               Constants.instFlags[Constants.FCONST_0] = Constants.PUSH_INST | Constants.CONSTANT_INST;
+               Constants.instFlags[Constants.FCONST_1] = Constants.PUSH_INST | Constants.CONSTANT_INST;
+               Constants.instFlags[Constants.FCONST_2] = Constants.PUSH_INST | Constants.CONSTANT_INST;
+               Constants.instFlags[Constants.DCONST_0] = Constants.PUSH_INST | Constants.CONSTANT_INST;
+               Constants.instFlags[Constants.DCONST_1] = Constants.PUSH_INST | Constants.CONSTANT_INST;
+
+               Constants.instFlags[Constants.BIPUSH] = Constants.PUSH_INST | Constants.CONSTANT_INST;
+               Constants.instFlags[Constants.SIPUSH] = Constants.PUSH_INST | Constants.CONSTANT_INST;
+
+               Constants.instFlags[Constants.LDC] = Constants.EXCEPTION_THROWER | Constants.PUSH_INST | Constants.CP_INST
+                               | Constants.INDEXED;
+
+               Constants.instFlags[Constants.LDC_W] = Constants.EXCEPTION_THROWER | Constants.PUSH_INST | Constants.CP_INST
+                               | Constants.INDEXED;
+
+               Constants.instFlags[Constants.LDC2_W] = Constants.EXCEPTION_THROWER | Constants.PUSH_INST | Constants.CP_INST
+                               | Constants.INDEXED;
+
+               // the next five could be 'wide' prefixed and so have longer lengths
+               Constants.instFlags[Constants.ILOAD] = Constants.INDEXED | Constants.LOAD_INST | Constants.PUSH_INST | Constants.LV_INST;
+               Constants.instFlags[Constants.LLOAD] = Constants.INDEXED | Constants.LOAD_INST | Constants.PUSH_INST | Constants.LV_INST;
+               Constants.instFlags[Constants.FLOAD] = Constants.INDEXED | Constants.LOAD_INST | Constants.PUSH_INST | Constants.LV_INST;
+               Constants.instFlags[Constants.DLOAD] = Constants.INDEXED | Constants.LOAD_INST | Constants.PUSH_INST | Constants.LV_INST;
+               Constants.instFlags[Constants.ALOAD] = Constants.INDEXED | Constants.LOAD_INST | Constants.PUSH_INST | Constants.LV_INST;
+               for (int ii = Constants.ILOAD_0; ii <= Constants.ALOAD_3; ii++) {
+                       Constants.instFlags[ii] = Constants.INDEXED | Constants.LOAD_INST | Constants.PUSH_INST | Constants.LV_INST;
+               }
+
+               // the next five could be 'wide' prefixed and so have longer lengths
+               Constants.instFlags[Constants.ISTORE] = Constants.INDEXED | Constants.STORE_INST | Constants.POP_INST | Constants.LV_INST;
+               Constants.instFlags[Constants.LSTORE] = Constants.INDEXED | Constants.STORE_INST | Constants.POP_INST | Constants.LV_INST;
+               Constants.instFlags[Constants.FSTORE] = Constants.INDEXED | Constants.STORE_INST | Constants.POP_INST | Constants.LV_INST;
+               Constants.instFlags[Constants.DSTORE] = Constants.INDEXED | Constants.STORE_INST | Constants.POP_INST | Constants.LV_INST;
+               Constants.instFlags[Constants.ASTORE] = Constants.INDEXED | Constants.STORE_INST | Constants.POP_INST | Constants.LV_INST;
+               for (int ii = Constants.ISTORE_0; ii <= Constants.ASTORE_3; ii++) {
+                       Constants.instFlags[ii] = Constants.INDEXED | Constants.STORE_INST | Constants.POP_INST | Constants.LV_INST;
+               }
+
+               Constants.instFlags[Constants.IDIV] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.IDIV] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.ARITHMETIC_EXCEPTION };
+               Constants.instFlags[Constants.IREM] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.IREM] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.ARITHMETIC_EXCEPTION };
+               Constants.instFlags[Constants.LDIV] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.LDIV] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.ARITHMETIC_EXCEPTION };
+               Constants.instFlags[Constants.LREM] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.LREM] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.ARITHMETIC_EXCEPTION };
+
+               Constants.instFlags[Constants.ARRAYLENGTH] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.ARRAYLENGTH] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.NULL_POINTER_EXCEPTION };
+               Constants.instFlags[Constants.ATHROW] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.ATHROW] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.THROWABLE };
+
+               Constants.instFlags[Constants.AALOAD] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.AALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
+               Constants.instFlags[Constants.IALOAD] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.IALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
+               Constants.instFlags[Constants.BALOAD] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.BALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
+               Constants.instFlags[Constants.FALOAD] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.FALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
+               Constants.instFlags[Constants.DALOAD] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.DALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
+               Constants.instFlags[Constants.CALOAD] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.CALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
+               Constants.instFlags[Constants.LALOAD] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.LALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
+               Constants.instFlags[Constants.SALOAD] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.SALOAD] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
+
+               Constants.instFlags[Constants.AASTORE] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.AASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
+               Constants.instFlags[Constants.IASTORE] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.IASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
+               Constants.instFlags[Constants.BASTORE] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.BASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
+               Constants.instFlags[Constants.FASTORE] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.FASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
+               Constants.instFlags[Constants.DASTORE] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.DASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
+               Constants.instFlags[Constants.CASTORE] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.CASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
+               Constants.instFlags[Constants.LASTORE] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.LASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
+               Constants.instFlags[Constants.SASTORE] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.SASTORE] = org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
+
+               // stack instructions
+               Constants.instFlags[Constants.DUP] = Constants.PUSH_INST | Constants.STACK_INST;
+               Constants.instFlags[Constants.DUP_X1] = Constants.STACK_INST; // TODO fixme - aren't these two push/stack producers?
+                                                                                                                                               // (although peculiar ones...)
+               Constants.instFlags[Constants.DUP_X2] = Constants.STACK_INST;
+               Constants.instFlags[Constants.DUP2] = Constants.PUSH_INST | Constants.STACK_INST;
+               Constants.instFlags[Constants.DUP2_X1] = Constants.STACK_INST; // TODO fixme - aren't these two push/stack producers?
+                                                                                                                                               // (although peculiar ones...)
+               Constants.instFlags[Constants.DUP2_X2] = Constants.STACK_INST;
+               Constants.instFlags[Constants.POP] = Constants.STACK_INST | Constants.POP_INST;
+               Constants.instFlags[Constants.POP2] = Constants.STACK_INST | Constants.POP_INST;
+               Constants.instFlags[Constants.SWAP] = Constants.STACK_INST;
+
+               Constants.instFlags[Constants.MONITORENTER] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.MONITORENTER] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.NULL_POINTER_EXCEPTION };
+               Constants.instFlags[Constants.MONITOREXIT] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.MONITOREXIT] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.NULL_POINTER_EXCEPTION };
+
+               // branching instructions
+               Constants.instFlags[Constants.GOTO] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION;
+               Constants.instFlags[Constants.GOTO_W] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION;
+               Constants.instFlags[Constants.JSR] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
+                               | Constants.JSR_INSTRUCTION;
+               Constants.instFlags[Constants.JSR_W] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
+                               | Constants.JSR_INSTRUCTION;
+
+               Constants.instFlags[Constants.IFGT] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION | Constants.NEGATABLE
+                               | Constants.IF_INST;
+               Constants.instFlags[Constants.IFLE] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION | Constants.NEGATABLE
+                               | Constants.IF_INST;
+               Constants.instFlags[Constants.IFNE] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION | Constants.NEGATABLE
+                               | Constants.IF_INST;
+               Constants.instFlags[Constants.IFEQ] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION | Constants.NEGATABLE
+                               | Constants.IF_INST;
+               Constants.instFlags[Constants.IFGE] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION | Constants.NEGATABLE
+                               | Constants.IF_INST;
+               Constants.instFlags[Constants.IFLT] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION | Constants.NEGATABLE
+                               | Constants.IF_INST;
+               Constants.instFlags[Constants.IFNULL] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION | Constants.NEGATABLE
+                               | Constants.IF_INST;
+               Constants.instFlags[Constants.IFNONNULL] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
+                               | Constants.NEGATABLE | Constants.IF_INST;
+               Constants.instFlags[Constants.IF_ACMPEQ] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
+                               | Constants.NEGATABLE | Constants.IF_INST;
+               Constants.instFlags[Constants.IF_ACMPNE] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
+                               | Constants.NEGATABLE | Constants.IF_INST;
+               Constants.instFlags[Constants.IF_ICMPEQ] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
+                               | Constants.NEGATABLE | Constants.IF_INST;
+               Constants.instFlags[Constants.IF_ICMPGE] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
+                               | Constants.NEGATABLE | Constants.IF_INST;
+               Constants.instFlags[Constants.IF_ICMPGT] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
+                               | Constants.NEGATABLE | Constants.IF_INST;
+               Constants.instFlags[Constants.IF_ICMPLE] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
+                               | Constants.NEGATABLE | Constants.IF_INST;
+               Constants.instFlags[Constants.IF_ICMPLT] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
+                               | Constants.NEGATABLE | Constants.IF_INST;
+               Constants.instFlags[Constants.IF_ICMPNE] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION
+                               | Constants.NEGATABLE | Constants.IF_INST;
+
+               Constants.instFlags[Constants.LOOKUPSWITCH] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION;
+               Constants.instFlags[Constants.TABLESWITCH] = Constants.BRANCH_INSTRUCTION | Constants.TARGETER_INSTRUCTION;
+
+               // fixme these class arrays should be constants
+               Constants.instFlags[Constants.ARETURN] = Constants.RET_INST | Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.ARETURN] = new Class[] { ExceptionConstants.ILLEGAL_MONITOR_STATE };
+               Constants.instFlags[Constants.DRETURN] = Constants.RET_INST | Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.DRETURN] = new Class[] { ExceptionConstants.ILLEGAL_MONITOR_STATE };
+               Constants.instFlags[Constants.FRETURN] = Constants.RET_INST | Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.FRETURN] = new Class[] { ExceptionConstants.ILLEGAL_MONITOR_STATE };
+               Constants.instFlags[Constants.IRETURN] = Constants.RET_INST | Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.IRETURN] = new Class[] { ExceptionConstants.ILLEGAL_MONITOR_STATE };
+               Constants.instFlags[Constants.LRETURN] = Constants.RET_INST | Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.LRETURN] = new Class[] { ExceptionConstants.ILLEGAL_MONITOR_STATE };
+               Constants.instFlags[Constants.RETURN] = Constants.RET_INST | Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.RETURN] = new Class[] { ExceptionConstants.ILLEGAL_MONITOR_STATE };
+
+               Constants.instFlags[Constants.NEW] = Constants.LOADCLASS_INST | Constants.EXCEPTION_THROWER | Constants.CP_INST
+                               | Constants.INDEXED;
+               Constants.instExcs[Constants.NEW] = ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION_FOR_ALLOCATIONS;
+               Constants.instFlags[Constants.NEWARRAY] = Constants.EXCEPTION_THROWER;
+               Constants.instExcs[Constants.NEWARRAY] = new Class[] { org.aspectj.apache.bcel.ExceptionConstants.NEGATIVE_ARRAY_SIZE_EXCEPTION };
+
+               Constants.types[Constants.IINC] = Type.INT;
+               Constants.instFlags[Constants.IINC] = Constants.LV_INST | Constants.INDEXED;
+               Constants.instFlags[Constants.RET] = Constants.INDEXED;
+
+               Constants.instFlags[Constants.ANEWARRAY] = Constants.CP_INST | Constants.LOADCLASS_INST | Constants.EXCEPTION_THROWER
+                               | Constants.INDEXED;
+               Constants.instExcs[Constants.ANEWARRAY] = ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION_ANEWARRAY;
+               Constants.instFlags[Constants.CHECKCAST] = Constants.CP_INST | Constants.LOADCLASS_INST | Constants.EXCEPTION_THROWER
+                               | Constants.INDEXED;
+               Constants.instExcs[Constants.CHECKCAST] = ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION_CHECKCAST;
+               Constants.instFlags[Constants.INSTANCEOF] = Constants.CP_INST | Constants.LOADCLASS_INST | Constants.EXCEPTION_THROWER
+                               | Constants.INDEXED;
+               Constants.instExcs[Constants.INSTANCEOF] = ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION;
+               Constants.instFlags[Constants.MULTIANEWARRAY] = Constants.CP_INST | Constants.LOADCLASS_INST | Constants.EXCEPTION_THROWER
+                               | Constants.INDEXED;
+               Constants.instExcs[Constants.MULTIANEWARRAY] = ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION_ANEWARRAY; // fixme i
+                                                                                                                                                                                                                                                       // think
+                                                                                                                                                                                                                                                       // this
+                                                                                                                                                                                                                                                       // is a
+               // stackproducer, old
+               // bcel says no...
+
+               Constants.instFlags[Constants.GETFIELD] = Constants.EXCEPTION_THROWER | Constants.CP_INST | Constants.LOADCLASS_INST
+                               | Constants.INDEXED;
+               Constants.instExcs[Constants.GETFIELD] = ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION_GETFIELD_PUTFIELD;
+               Constants.instFlags[Constants.GETSTATIC] = Constants.PUSH_INST | Constants.EXCEPTION_THROWER | Constants.LOADCLASS_INST
+                               | Constants.CP_INST | Constants.INDEXED;
+               Constants.instExcs[Constants.GETSTATIC] = ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION_GETSTATIC_PUTSTATIC;
+               Constants.instFlags[Constants.PUTFIELD] = Constants.POP_INST | Constants.EXCEPTION_THROWER | Constants.LOADCLASS_INST
+                               | Constants.CP_INST | Constants.INDEXED;
+               Constants.instExcs[Constants.PUTFIELD] = ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION_GETFIELD_PUTFIELD;
+               Constants.instFlags[Constants.PUTSTATIC] = Constants.EXCEPTION_THROWER | Constants.POP_INST | Constants.CP_INST
+                               | Constants.LOADCLASS_INST | Constants.INDEXED;
+               Constants.instExcs[Constants.PUTSTATIC] = ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION_GETSTATIC_PUTSTATIC;
+
+               Constants.instFlags[Constants.INVOKEINTERFACE] = Constants.EXCEPTION_THROWER | Constants.CP_INST | Constants.LOADCLASS_INST
+                               | Constants.INDEXED;
+               Constants.instExcs[Constants.INVOKEINTERFACE] = ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION_INVOKEINTERFACE;
+               Constants.instFlags[Constants.INVOKESPECIAL] = Constants.EXCEPTION_THROWER | Constants.CP_INST | Constants.LOADCLASS_INST
+                               | Constants.INDEXED;
+               Constants.instExcs[Constants.INVOKESPECIAL] = ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION_INVOKESPECIAL_INVOKEVIRTUAL;
+               Constants.instFlags[Constants.INVOKESTATIC] = Constants.EXCEPTION_THROWER | Constants.CP_INST | Constants.LOADCLASS_INST
+                               | Constants.INDEXED;
+               Constants.instExcs[Constants.INVOKESTATIC] = ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION_INVOKESTATIC;
+               Constants.instFlags[Constants.INVOKEVIRTUAL] = Constants.EXCEPTION_THROWER | Constants.CP_INST | Constants.LOADCLASS_INST
+                               | Constants.INDEXED;
+               Constants.instExcs[Constants.INVOKEVIRTUAL] = ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION_INVOKESPECIAL_INVOKEVIRTUAL;
+
+               char[] lengths = // . = varies in length, / = undefined
+               ("1111111111111111" + // nop > dconst_1
+                               "2323322222111111" + // bipush > lload_1
+                               "1111111111111111" + // lload_2 > laload
+                               "1111112222211111" + // faload > lstore_0
+                               "1111111111111111" + // lstore_1 > iastore
+                               "1111111111111111" + // lastore > swap
+                               "1111111111111111" + // iadd > ddiv
+                               "1111111111111111" + // irem > land
+                               "1111311111111111" + // ior > d2l
+                               "1111111113333333" + // d2f > if_icmpeq
+                               "3333333332..1111" + // if_icmpne > dreturn
+                               "1133333335/32311" + // areturn > athrow
+                               "3311.433551/////").toCharArray(); // checkcast >
+               int count = 0;
+               for (; count < lengths.length; count++) {
+                       Constants.iLen[count] = (byte) (lengths[count] - 48);
+               }
+               while (count < 256) {
+                       Constants.iLen[count] = Constants.UNDEFINED;
+                       count++;
+               }
+               Constants.iLen[Constants.BREAKPOINT] = 1;
+               Constants.iLen[Constants.IMPDEP1] = 1;
+               Constants.iLen[Constants.IMPDEP2] = 1;
+
+               char[] producesOnStack = ("0111111112211122" + // nop > dconst_1
+                               "1111212121111122" + // bipush > lload_1
+                               "2211112222111112" + // lload_2 > laload
+                               "1211110000000000" + // faload > lstore_0
+                               "0000000000000000" + // lstore_1 > iastore
+                               "0000000002344562" + // lastore > swap
+                               "1212121212121212" + // iadd > ddiv
+                               "1212121212121212" + // irem > land
+                               "1212021211212212" + // ior > d2l
+                               "1111111110000000" + // d2f > if_icmpeq
+                               "0000000010000000" + // if_icmpne > dreturn
+                               "00.0.0..../11111" + // areturn > athrow
+                               "11000100010/").toCharArray(); // checkcast >
+               count = 0;
+               for (; count < producesOnStack.length; count++) {
+                       Constants.stackEntriesProduced[count] = (byte) (producesOnStack[count] - 48);
+               }
+               while (count < 256) {
+                       Constants.iLen[count] = Constants.UNDEFINED;
+                       count++;
+               }
+               return null;
+       }
+}
\ No newline at end of file
index d337fc796e8932b423c86e10ff0095715804116d..7662250db71dc6f5e6a7ae4cf26295eb6b6d7840 100644 (file)
@@ -60,6 +60,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.aspectj.apache.bcel.Constants;
+import org.aspectj.apache.bcel.ConstantsInitializer;
 import org.aspectj.apache.bcel.classfile.ClassFormatException;
 import org.aspectj.apache.bcel.classfile.Utility;
 
@@ -67,7 +68,7 @@ import org.aspectj.apache.bcel.classfile.Utility;
  * Abstract super class for all possible java types, namely basic types such as int, object types like String and array types, e.g.
  * int[]
  * 
- * @version $Id: Type.java,v 1.13 2009/10/05 17:35:36 aclement Exp $
+ * @version $Id: Type.java,v 1.14 2011/09/28 01:14:54 aclement Exp $
  * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
  * 
  *         modified: AndyClement 2-mar-05: Removed unnecessary static and optimized
@@ -135,7 +136,7 @@ public abstract class Type {
                commonTypes.put(STRINGBUILDER.getSignature(), STRINGBUILDER);
                commonTypes.put(LIST.getSignature(), LIST);
                commonTypes.put(ITERATOR.getSignature(), ITERATOR);
-
+               ConstantsInitializer.initialize(); // needs calling because it will not have run properly the first time
        }
 
        protected Type(byte t, String s) {