Shrink the size of the final binary. If it is too large it will have problem executi...
authorjzhou <jzhou>
Sun, 6 Mar 2011 00:24:45 +0000 (00:24 +0000)
committerjzhou <jzhou>
Sun, 6 Mar 2011 00:24:45 +0000 (00:24 +0000)
Robust/src/IR/ClassDescriptor.java
Robust/src/IR/Flat/BuildCode.java
Robust/src/IR/Flat/BuildCodeMGC.java
Robust/src/IR/Flat/BuildCodeMultiCore.java
Robust/src/IR/State.java
Robust/src/IR/Tree/BuildIR.java
Robust/src/IR/Virtual.java

index 4e313bb73fe59dc611e5e0ef981e17397198448e..ae11b75d2a153cd9a5fb7c3e7e8f52af4b588da4 100644 (file)
@@ -24,7 +24,7 @@ public class ClassDescriptor extends Descriptor {
   // for interfaces
   Vector<String> superinterfaces;
   SymbolTable superIFdesc;
-  private boolean isInterface;
+  private int interfaceid;
   
   // for inner classes
   boolean isInnerClass=false;
@@ -53,8 +53,12 @@ public class ClassDescriptor extends Descriptor {
     fields=new SymbolTable();
     fieldvec=new Vector();
     methods=new SymbolTable();
-    this.isInterface = isInterface;
-    classid=UIDCount++;
+    if(isInterface) {
+      this.classid = -2;
+      this.interfaceid = -1;
+    } else {
+      classid=UIDCount++;
+    }
     this.packagename=packagename;
     superinterfaces = new Vector<String>();
     superIFdesc = new SymbolTable();
@@ -63,6 +67,9 @@ public class ClassDescriptor extends Descriptor {
   }
 
   public int getId() {
+    if(this.isInterface()) {
+      return this.interfaceid;
+    }
     return classid;
   }
 
@@ -283,7 +290,11 @@ public class ClassDescriptor extends Descriptor {
   }
   
   public boolean isInterface() {
-    return this.isInterface;
+    return (this.classid == -2);
+  }
+  
+  public void setInterfaceId(int id) {
+    this.interfaceid = id;
   }
   
   public boolean isStatic() {
index 95645565f7062edf86388b419097d925d295d721..d12cc8ad8b8fbcde97ae02dd6bbbcb04eb368465 100644 (file)
@@ -45,6 +45,7 @@ public class BuildCode {
   protected int maxtaskparams=0;
   protected int maxcount=0;
   ClassDescriptor[] cdarray;
+  ClassDescriptor[] ifarray;
   TypeDescriptor[] arraytable;
   SafetyAnalysis sa;
   CallGraph callgraph;
@@ -66,6 +67,7 @@ public class BuildCode {
     fieldorder=new Hashtable();
     flagorder=new Hashtable();
     this.typeutil=typeutil;
+    checkMethods2Gen();
     virtualcalls=new Virtual(state, null);
     printedfieldstbl = new Hashtable<String, ClassDescriptor>();
   }
@@ -248,6 +250,34 @@ public class BuildCode {
     postCodeGenCleanUp();
   }
 
+  /* This method goes though the call graph and check which methods are really
+   * invoked and should be generated
+   */
+  protected void checkMethods2Gen() {
+    MethodDescriptor md=typeutil.getMain();
+    
+    if(md != null) {
+      // check the methods to be generated
+      state.setGenAllMethods(false);
+    } else {
+      // generate all methods
+      return;
+    }
+    this.state.addMethod2gen(md);
+    
+    Iterator it_classes = this.state.getClassSymbolTable().getDescriptorsIterator();
+    while(it_classes.hasNext()) {
+      ClassDescriptor cd = (ClassDescriptor)it_classes.next();
+      Iterator it_methods = cd.getMethodTable().getDescriptorsIterator();
+      while(it_methods.hasNext()) {
+        md = (MethodDescriptor)it_methods.next();
+        if(md.isStaticBlock() || md.getModifiers().isNative() || this.callgraph.getCallerSet(md).size() > 0
+            || (cd.getSymbol().equals("Thread") && md.getSymbol().equals("staticStart"))) {
+          this.state.addMethod2gen(md);
+        }
+      }
+    }
+  }
 
 
   /* This method goes though the call graph and tag those methods that are
@@ -500,6 +530,18 @@ public class BuildCode {
       while(methodit.hasNext()) {
        /* Classify parameters */
        MethodDescriptor md=(MethodDescriptor)methodit.next();
+    Set vec_md = this.state.getMethod2gen().getSet(md.getSymbol());
+    boolean foundmatch = false;
+    for(Iterator matchit=vec_md.iterator(); matchit.hasNext();) {
+      MethodDescriptor matchmd=(MethodDescriptor)matchit.next();
+      if (md.matches(matchmd)) {
+        foundmatch=true;
+        break;
+      }
+    }
+    if(!foundmatch) {
+      continue;
+    }
        FlatMethod fm=state.getMethodFlat(md);
        if (!md.getModifiers().isNative()) {
          generateFlatMethod(fm, outmethod);
@@ -548,7 +590,7 @@ public class BuildCode {
                        (state.getArrayNumber((new TypeDescriptor(TypeDescriptor.BYTE)).makeArray(state).makeArray(state))+state.numClasses()));
 
     outstructs.println("#define NUMCLASSES "+state.numClasses());
-    int totalClassSize = state.numClasses() + state.numArrays();
+    int totalClassSize = state.numClasses() + state.numArrays() + state.numInterfaces();
     outstructs.println("#define TOTALNUMCLASSANDARRAY "+ totalClassSize);
     if (state.TASK) {
       outstructs.println("#define STARTUPTYPE "+typeutil.getClass(TypeUtil.StartupClass).getId());
@@ -878,6 +920,9 @@ public class BuildCode {
     classit=state.getClassSymbolTable().getDescriptorsIterator();
     while(classit.hasNext()) {
       ClassDescriptor cd=(ClassDescriptor)classit.next();
+      if(cd.isInterface()) {
+        continue;
+      }        
       fillinRow(cd, virtualtable, cd.getId());
     }
 
@@ -923,11 +968,20 @@ public class BuildCode {
       MethodDescriptor md=(MethodDescriptor)it.next();
       if (md.isStatic()||md.getReturnType()==null)
        continue;
-      Vector<Integer> numvec = virtualcalls.getMethodNumber(md);
-      for(int i = 0; i < numvec.size(); i++) {
-        int methodnum = numvec.elementAt(i).intValue();
-        virtualtable[rownum][methodnum]=md;
+      Set vec_md = this.state.getMethod2gen().getSet(md.getSymbol());
+      boolean foundmatch = false;
+      for(Iterator matchit=vec_md.iterator(); matchit.hasNext();) {
+        MethodDescriptor matchmd=(MethodDescriptor)matchit.next();
+        if (md.matches(matchmd)) {
+          foundmatch=true;
+          break;
+        }
+      }
+      if(!foundmatch) {
+        continue;
       }
+      int methodnum = virtualcalls.getMethodNumber(md);
+      virtualtable[rownum][methodnum]=md;
     }
   }
 
@@ -941,11 +995,16 @@ public class BuildCode {
 
     Iterator it=state.getClassSymbolTable().getDescriptorsIterator();
     cdarray=new ClassDescriptor[state.numClasses()];
+    ifarray = new ClassDescriptor[state.numInterfaces()];
     cdarray[0] = null;
     int interfaceid = 0;
     while(it.hasNext()) {
       ClassDescriptor cd=(ClassDescriptor)it.next();
-      cdarray[cd.getId()] = cd;
+      if(cd.isInterface()) {
+        ifarray[cd.getId()] = cd;
+      } else {
+        cdarray[cd.getId()] = cd;
+      }
     }
 
     arraytable=new TypeDescriptor[state.numArrays()];
@@ -972,6 +1031,11 @@ public class BuildCode {
       TypeDescriptor arraytd=arraytable[i];
       outclassdefs.println(arraytd.toPrettyString() +"  "+(i+state.numClasses()));
     }
+    
+    for(int i=0; i<state.numInterfaces(); i++) {
+      ClassDescriptor ifcd = ifarray[i];
+      outclassdefs.println(ifcd +"  "+(i+state.numClasses()+state.numArrays()));
+    }
 
     outclassdefs.println("*/");
 
@@ -1001,6 +1065,13 @@ public class BuildCode {
        outclassdefs.print("sizeof("+tdelement.getSafeSymbol()+")");
       needcomma=true;
     }
+    
+    for(int i=0; i<state.numInterfaces(); i++) {
+      if (needcomma)
+        outclassdefs.print(", ");
+      outclassdefs.print("sizeof(struct "+ifarray[i].getSafeSymbol()+")");
+      needcomma=true;
+    }
 
     outclassdefs.println("};");
 
@@ -1010,6 +1081,9 @@ public class BuildCode {
     for(int i=0; i<state.numClasses(); i++) {
       ClassDescriptor cd=cdarray[i];
       ClassDescriptor supercd=i>0 ? cd.getSuperDesc() : null;
+      if(supercd != null && supercd.isInterface()) {
+        throw new Error("Super class can not be interfaces");
+      }
       if (needcomma)
        outclassdefs.print(", ");
       if (supercd==null)
@@ -1046,6 +1120,21 @@ public class BuildCode {
       outclassdefs.print(type);
       needcomma=true;
     }
+    
+    for(int i=0; i<state.numInterfaces(); i++) {
+      ClassDescriptor cd=ifarray[i];
+      ClassDescriptor supercd=cd.getSuperDesc();
+      if(supercd != null && supercd.isInterface()) {
+        throw new Error("Super class can not be interfaces");
+      }
+      if (needcomma)
+    outclassdefs.print(", ");
+      if (supercd==null)
+    outclassdefs.print("-1");
+      else
+    outclassdefs.print(supercd.getId());
+      needcomma=true;
+    }
 
     outclassdefs.println("};");
 
@@ -1275,7 +1364,7 @@ public class BuildCode {
         if(ncomma) {
           output.print(",");
         }
-        output.print(((ClassDescriptor)it_sifs.next()).getId());
+        output.print(((ClassDescriptor)it_sifs.next()).getId()+state.numClasses()+state.numArrays());
       }
       
       output.println("};");
@@ -1332,6 +1421,42 @@ public class BuildCode {
       output.println("};");
     }
     
+    for(int i=0; i<state.numInterfaces(); i++) {
+      ClassDescriptor cn=ifarray[i];
+      if(cn == null) {
+        continue;
+      }
+      output.print("int supertypes" + cn.getSafeSymbol() + "[] = {");
+      boolean ncomma = false;
+      int snum = 0;
+      if((cn != null) && (cn.getSuperDesc() != null)) {
+        snum++;
+      }
+      Iterator it_sifs = cn != null? cn.getSuperInterfaces() : null;
+      while(it_sifs != null && it_sifs.hasNext()) {
+        snum++;
+        it_sifs.next();
+      }
+      output.print(snum);
+      ncomma = true;
+      if ((cn != null) && (cn.getSuperDesc()!=null)) {
+        if(ncomma) {
+          output.print(",");
+        }
+        ClassDescriptor cdsuper=cn.getSuperDesc();
+        output.print(cdsuper.getId());
+      } 
+      it_sifs = cn != null? cn.getSuperInterfaces() : null;
+      while(it_sifs != null && it_sifs.hasNext()) {
+        if(ncomma) {
+          output.print(",");
+        }
+        output.print(((ClassDescriptor)it_sifs.next()).getId()+state.numClasses()+state.numArrays());
+      }
+      
+      output.println("};");
+    }
+    
     output.println("int* supertypes[]={");
     boolean needcomma=false;
     for(int i=0; i<state.numClasses(); i++) {
@@ -1352,6 +1477,14 @@ public class BuildCode {
       needcomma = true;
       output.print("supertypes___arraytype___" + (i+state.numClasses()));
     }
+    
+    for(int i=0; i<state.numInterfaces(); i++) {
+      ClassDescriptor cn=ifarray[i];
+      if (needcomma)
+    output.println(",");
+      needcomma=true;
+      output.print("supertypes" + cn.getSafeSymbol());
+    }
     output.println("};");
   }
 
@@ -1541,7 +1674,18 @@ public class BuildCode {
   protected void generateCallStructsMethods(ClassDescriptor cn, PrintWriter output, PrintWriter headersout) {
     for(Iterator methodit=cn.getMethods(); methodit.hasNext(); ) {
       MethodDescriptor md=(MethodDescriptor)methodit.next();
-      generateMethod(cn, md, headersout, output);
+      Set vec_md = this.state.getMethod2gen().getSet(md.getSymbol());
+      boolean foundmatch = false;
+      for(Iterator matchit=vec_md.iterator(); matchit.hasNext();) {
+        MethodDescriptor matchmd=(MethodDescriptor)matchit.next();
+        if (md.matches(matchmd)) {
+          foundmatch=true;
+          break;
+        }
+      }
+      if(foundmatch) {
+        generateMethod(cn, md, headersout, output);
+      }
     }
   }
 
@@ -2197,11 +2341,15 @@ public class BuildCode {
     int otype;
     if (fion.getType().isArray()) {
       type=state.getArrayNumber(fion.getType())+state.numClasses();
+    } else if (fion.getType().getClassDesc().isInterface()) {
+      type=fion.getType().getClassDesc().getId()+state.numClasses()+state.numArrays();
     } else {
       type=fion.getType().getClassDesc().getId();
     }
     if (fion.getSrc().getType().isArray()) {
       otype=state.getArrayNumber(fion.getSrc().getType())+state.numClasses();
+    } else if (fion.getSrc().getType().getClassDesc().isInterface()) {
+      otype=fion.getSrc().getType().getClassDesc().getId()+state.numClasses()+state.numArrays();
     } else {
       otype=fion.getSrc().getType().getClassDesc().getId();
     }
@@ -2378,7 +2526,7 @@ public class BuildCode {
       }
 
 
-      output.print("))virtualtable["+generateTemp(fm,fc.getThis())+"->type*"+maxcount+"+"+virtualcalls.getMethodNumber(md).elementAt(0)+"])");
+      output.print("))virtualtable["+generateTemp(fm,fc.getThis())+"->type*"+maxcount+"+"+virtualcalls.getMethodNumber(md)+"])");
     }
 
     output.print("(");
index f08ed4bef2b47a84f613e93f4c712c4d69d1fe18..79ce5fcd946ce200c3f59754a566bd507ef56bed 100644 (file)
@@ -93,7 +93,6 @@ public class BuildCodeMGC extends BuildCode {
 
     // Output function prototypes and structures for parameters
     Iterator it=state.getClassSymbolTable().getDescriptorsIterator();
-    int numclasses = this.state.numClasses();
     while(it.hasNext()) {
       ClassDescriptor cn=(ClassDescriptor)it.next();
       super.generateCallStructs(cn, outclassdefs, outstructs, outmethodheader, outglobaldefs, outglobaldefsprim);
@@ -123,7 +122,7 @@ public class BuildCodeMGC extends BuildCode {
     /* Record maximum number of task parameters */
     //outstructs.println("#define MAXTASKPARAMS "+maxtaskparams);
     /* Record maximum number of all types, i.e. length of classsize[] */
-    outstructs.println("#define NUMTYPES "+(state.numClasses() + state.numArrays()));
+    outstructs.println("#define NUMTYPES "+(state.numClasses() + state.numArrays() + state.numInterfaces()));
     /* Record number of total cores */
     outstructs.println("#define NUMCORES "+this.tcoreNum);
     /* Record number of active cores */
@@ -316,7 +315,6 @@ NextMethod:
         outmethod.println(" }");
         
       }
-    } // else TODO normal java version
-    
+    } // else TODO normal java version 
   }
 }
index 7d67c3f0eac1bc933b51119231efb26784c0f92d..7ce0e07d81520aa42115de2fa93a37efecb6b6fd 100644 (file)
@@ -305,7 +305,7 @@ public class BuildCodeMultiCore extends BuildCode {
       /* Record maximum number of task parameters */
       outstructs.println("#define MAXTASKPARAMS "+maxtaskparams);
       /* Record maximum number of all types, i.e. length of classsize[] */
-      outstructs.println("#define NUMTYPES "+(state.numClasses() + state.numArrays()));
+      outstructs.println("#define NUMTYPES "+(state.numClasses() + state.numArrays() + state.numInterfaces()));
       /* Record number of total cores */
       outstructs.println("#define NUMCORES "+this.tcoreNum);
       /* Record number of active cores */
index 30f89e46fbd6b2ced3c49d532325b83370f1c715..54df5b664f5667cccfb7270b31ad92f8c0e37abf 100644 (file)
@@ -16,6 +16,8 @@ public class State {
     this.sclasses=new SymbolTable();
     this.treemethodmap=new Hashtable();
     this.flatmethodmap=new Hashtable();
+    this.genAllMethods = true;
+    this.methods2gen = new SymbolTable();
     this.parsetrees=new HashSet();
     this.arraytypes=new HashSet();
     this.arraytonumber=new Hashtable();
@@ -180,9 +182,12 @@ public class State {
   public Set parsetrees;
   public Hashtable treemethodmap;
   public Hashtable flatmethodmap;
+  SymbolTable methods2gen;
+  boolean genAllMethods;
   private HashSet arraytypes;
   public Hashtable arraytonumber;
   private int numclasses=1; // start from 1 instead of 0 for multicore gc
+  private int numinterfaces = 0;
   private int numtasks=0;
   private int numstaticblocks=0;
   private int arraycount=0;
@@ -239,16 +244,39 @@ public class State {
     if (classes.contains(tdn.getSymbol()))
       throw new Error("Class "+tdn.getSymbol()+" defined twice");
     classes.add(tdn);
-    numclasses++;
+    if(tdn.isInterface()) {
+      numinterfaces++;
+    } else {
+      numclasses++;
+    }
     if((tdn.numstaticfields != 0) || (tdn.numstaticblocks != 0)) {
       sclasses.add(tdn);
     }
   }
   
+  public void setGenAllMethods(boolean flag) {
+    this.genAllMethods = flag;
+  }
+  
+  public void addMethod2gen(MethodDescriptor md) {
+    if(this.genAllMethods) {
+      throw new Error("The state.genAllMethods is TRUE, do not need to check methods to genenrate");
+    }
+    this.methods2gen.add(md);
+  }
+  
+  public SymbolTable getMethod2gen() {
+    return this.methods2gen;
+  }
+  
   public int numClasses() {
     return numclasses;
   }
   
+  public int numInterfaces() {
+    return numinterfaces;
+  }
+  
   public int numStaticBlocks() {
     return numstaticblocks;
   }
index 8ec7fd665adec103045006eb0c3d7587097999ae..742a9da9f2395b3ae8af98f9ef14f687034151b1 100644 (file)
@@ -19,6 +19,16 @@ public class BuildIR {
 
   public void buildtree(ParseNode pn, Set toanalyze) {
     parseFile(pn, toanalyze);
+    
+    // numering the interfaces
+    int if_num = 0;
+    Iterator it_classes = state.getClassSymbolTable().getValueSet().iterator();
+    while(it_classes.hasNext()) {
+      ClassDescriptor cd = (ClassDescriptor)it_classes.next();
+      if(cd.isInterface()) {
+        cd.setInterfaceId(if_num++);
+      }
+    }
   }
 
   Vector singleimports;
index a46b6ad37f616b6f53a6eb0c3b0b7de79eb94b82..52c7310408c3554293531849114d1966ca8644a8 100644 (file)
@@ -1,5 +1,6 @@
 package IR;
 import java.util.*;
+
 import Analysis.Locality.LocalityBinding;
 import Analysis.Locality.LocalityAnalysis;
 
@@ -7,14 +8,15 @@ import Analysis.Locality.LocalityAnalysis;
 public class Virtual {
   State state;
   LocalityAnalysis locality;
-  Hashtable<MethodDescriptor, Vector<Integer>> methodnumber;
+  Hashtable<MethodDescriptor, Integer> methodnumber;
   Hashtable<ClassDescriptor, Integer> classmethodcount;
   Hashtable<LocalityBinding, Integer> localitynumber;
   
   // for interfaces
   int if_starts;
+  SymbolTable if_methods;
 
-  public Vector<Integer> getMethodNumber(MethodDescriptor md) {
+  public Integer getMethodNumber(MethodDescriptor md) {
     return methodnumber.get(md);
   }
 
@@ -30,11 +32,12 @@ public class Virtual {
     this.state=state;
     this.locality=locality;
     this.if_starts = 0;
+    this.if_methods = new SymbolTable();
     classmethodcount=new Hashtable<ClassDescriptor, Integer>();
     if (state.DSM||state.SINGLETM)
       localitynumber=new Hashtable<LocalityBinding, Integer>();
     else
-      methodnumber=new Hashtable<MethodDescriptor, Vector<Integer>>();
+      methodnumber=new Hashtable<MethodDescriptor, Integer>();
     doAnalysis();
   }
 
@@ -111,47 +114,51 @@ public class Virtual {
     if(!cd.isInterface()) {
       return 0;
     }
-    int start = 0;
+    int mnum = 0;
     if (classmethodcount.containsKey(cd))
       return classmethodcount.get(cd).intValue();
     // check the inherited interfaces
     Iterator it_sifs = cd.getSuperInterfaces();
     while(it_sifs.hasNext()) {
       ClassDescriptor superif = (ClassDescriptor)it_sifs.next();
-      start += numberMethodsIF(superif);
+      mnum += numberMethodsIF(superif);
     }
     for(Iterator it=cd.getMethods(); it.hasNext();) {
       MethodDescriptor md=(MethodDescriptor)it.next();
       if (md.isStatic()||md.getReturnType()==null)
         continue;
-      boolean foundmatch=false;
-      // check if there is a matched method in inherited interfaces
-      it_sifs = cd.getSuperInterfaces();
-      while(it_sifs.hasNext() && !foundmatch) {
-        ClassDescriptor superif = (ClassDescriptor)it_sifs.next();
-        Set possiblematches_if=superif.getMethodTable().getSet(md.getSymbol());
-        for(Iterator matchit=possiblematches_if.iterator(); matchit.hasNext();) {
-          MethodDescriptor matchmd=(MethodDescriptor)matchit.next();
-          if (md.matches(matchmd)) {
-            Vector<Integer> num=methodnumber.get(matchmd);
-            if(!methodnumber.containsKey(md)) {
-              methodnumber.put(md, new Vector<Integer>());
-            }
-            Vector<Integer> toadd = methodnumber.get(md);
-            toadd.addAll(num);
-            foundmatch=true;
-          }
+      Set vec_md = this.state.getMethod2gen().getSet(md.getSymbol());
+      boolean foundmatch = false;
+      for(Iterator matchit=vec_md.iterator(); matchit.hasNext();) {
+        MethodDescriptor matchmd=(MethodDescriptor)matchit.next();
+        if (md.matches(matchmd)) {
+          foundmatch=true;
+          break;
         }
       }
       if(!foundmatch) {
-        Vector<Integer> vec = new Vector<Integer>();
-        vec.add(new Integer(if_starts++));
-        methodnumber.put(md, vec);
-        start++;
+        continue;
+      }
+      foundmatch=false;
+      // check if there is a matched method that has been assigned method num
+      Set possiblematches_if = if_methods.getSet(md.getSymbol());
+      for(Iterator matchit=possiblematches_if.iterator(); matchit.hasNext();) {
+        MethodDescriptor matchmd=(MethodDescriptor)matchit.next();
+        if (md.matches(matchmd)) {
+          int num=methodnumber.get(matchmd);
+          methodnumber.put(md, new Integer(num));
+          foundmatch=true;
+          break;
+        }
+      }
+      if(!foundmatch) {
+        methodnumber.put(md, new Integer(if_starts++));
+        if_methods.add(md);
+        mnum++;
       }
     }
-    classmethodcount.put(cd, new Integer(start));
-    return start;
+    classmethodcount.put(cd, new Integer(mnum));
+    return mnum;
   }
 
   private int numberMethods(ClassDescriptor cd) {
@@ -168,41 +175,44 @@ public class Virtual {
       MethodDescriptor md=(MethodDescriptor)it.next();
       if (md.isStatic()||md.getReturnType()==null)
         continue;
-      boolean foundmatch=false;
-      if (superdesc!=null) {
+      Set vec_md = this.state.getMethod2gen().getSet(md.getSymbol());
+      boolean foundmatch = false;
+      for(Iterator matchit=vec_md.iterator(); matchit.hasNext();) {
+        MethodDescriptor matchmd=(MethodDescriptor)matchit.next();
+        if (md.matches(matchmd)) {
+          foundmatch=true;
+          break;
+        }
+      }
+      if(!foundmatch) {
+        continue;
+      }
+      foundmatch=false;
+      // check if there is a matched method in methods defined in interfaces
+      Set possiblematches_if=if_methods.getSet(md.getSymbol());
+      for(Iterator matchit=possiblematches_if.iterator(); matchit.hasNext();) {
+        MethodDescriptor matchmd=(MethodDescriptor)matchit.next();
+        if (md.matches(matchmd)) {
+          int num = methodnumber.get(matchmd);
+          methodnumber.put(md, new Integer(num));
+          foundmatch=true;
+          break;
+        }
+      }
+      if (!foundmatch && superdesc!=null) {
         Set possiblematches=superdesc.getMethodTable().getSet(md.getSymbol());
         for(Iterator matchit=possiblematches.iterator(); matchit.hasNext();) {
           MethodDescriptor matchmd=(MethodDescriptor)matchit.next();
           if (md.matches(matchmd)) {
-            Vector<Integer> num = methodnumber.get(matchmd);
-            methodnumber.put(md, num);
+            int num = methodnumber.get(matchmd);
+            methodnumber.put(md, new Integer(num));
             foundmatch=true;
             break;
           }
         }
       }
-      // check if there is a matched method in inherited interfaces
-      Iterator it_sifs = cd.getSuperInterfaces();
-      while(it_sifs.hasNext()) {
-        ClassDescriptor superif = (ClassDescriptor)it_sifs.next();
-        Set possiblematches_if=superif.getMethodTable().getSet(md.getSymbol());
-        for(Iterator matchit=possiblematches_if.iterator(); matchit.hasNext();) {
-          MethodDescriptor matchmd=(MethodDescriptor)matchit.next();
-          if (md.matches(matchmd)) {
-            Vector<Integer> num = methodnumber.get(matchmd);
-            if(!methodnumber.containsKey(md)) {
-              methodnumber.put(md, new Vector<Integer>());
-            }
-            Vector<Integer> toadd = methodnumber.get(md);
-            toadd.addAll(num);
-            foundmatch=true;
-          }
-        }
-      }
       if (!foundmatch) {
-        Vector<Integer> vec = new Vector<Integer>();
-        vec.add(new Integer(start++));
-        methodnumber.put(md, vec);
+        methodnumber.put(md, new Integer(start++));
         mnum++;
       }
     }