bugfixes
authoradam <adam@megacz.com>
Mon, 27 Jun 2005 08:38:53 +0000 (08:38 +0000)
committeradam <adam@megacz.com>
Mon, 27 Jun 2005 08:38:53 +0000 (08:38 +0000)
darcs-hash:20050627083853-5007d-ed2d851348f873fe00e297f587e420b34f802906.gz

src/org/ibex/classgen/ClassFile.java
src/org/ibex/classgen/MethodGen.java

index 9d1b2b0..2cd4d5f 100644 (file)
@@ -86,7 +86,7 @@ public class ClassFile implements CGConst {
         @see CGConst
     */
     public final MethodGen addMethod(String name, Type ret, Type[] args, int flags) {
         @see CGConst
     */
     public final MethodGen addMethod(String name, Type ret, Type[] args, int flags) {
-        MethodGen mg = new MethodGen(method(name, ret, args), flags);
+        MethodGen mg = new MethodGen(getType().method(name, ret, args), flags);
         methods.addElement(mg);
         return mg;
     }
         methods.addElement(mg);
         return mg;
     }
@@ -215,7 +215,7 @@ public class ClassFile implements CGConst {
         int numFields = i.readShort();
         for(int j=0; j<numFields; j++) fields.addElement(new FieldGen(i, cp));
         int numMethods = i.readShort();
         int numFields = i.readShort();
         for(int j=0; j<numFields; j++) fields.addElement(new FieldGen(i, cp));
         int numMethods = i.readShort();
-        for(int j=0; j<numMethods; j++) methods.addElement(new MethodGen(this.getType(), i, cp);
+        for(int j=0; j<numMethods; j++) methods.addElement(new MethodGen(this.getType(), i, cp));
         attributes = new AttrGen(i, cp);
         
         // FEATURE: Support these
         attributes = new AttrGen(i, cp);
         
         // FEATURE: Support these
index acb6c5c..c25c950 100644 (file)
@@ -38,7 +38,7 @@ public class MethodGen implements CGConst {
         
         if (((flags & INTERFACE) != 0) || (flags & (ABSTRACT|NATIVE)) != 0) size = capacity = -1;
         
         
         if (((flags & INTERFACE) != 0) || (flags & (ABSTRACT|NATIVE)) != 0) size = capacity = -1;
         
-        maxLocals = Math.max(args.length + (flags&STATIC)==0 ? 1 : 0, 4);
+        maxLocals = Math.max(method.getNumArgs() + (flags&STATIC)==0 ? 1 : 0, 4);
     }
 
     MethodGen(Type.Class c, DataInput in, ConstantPool cp) throws IOException {
     }
 
     MethodGen(Type.Class c, DataInput in, ConstantPool cp) throws IOException {
@@ -480,7 +480,7 @@ public class MethodGen implements CGConst {
             int length() { return 12 + targets.length * 4; } // 4bytes/target, hi, lo, default
         }
     
             int length() { return 12 + targets.length * 4; } // 4bytes/target, hi, lo, default
         }
     
-        public static class Lookup extends Table {
+        public static class Lookup extends Switch {
             public final int[] vals;
             public Lookup(int size) {
                 super(size);
             public final int[] vals;
             public Lookup(int size) {
                 super(size);