bug fixes and optimizations
authorbdemsky <bdemsky>
Thu, 25 Mar 2010 22:15:29 +0000 (22:15 +0000)
committerbdemsky <bdemsky>
Thu, 25 Mar 2010 22:15:29 +0000 (22:15 +0000)
Robust/src/Analysis/Disjoint/DisjointAnalysis.java
Robust/src/Analysis/Disjoint/PointerMethod.java

index 487242984016f247c802c9e178a843b8c24705b5..da618c502e1699b890628f9e25f3b2bf48f402de 100644 (file)
@@ -429,6 +429,8 @@ public class DisjointAnalysis {
   protected Hashtable<Descriptor, ReachGraph>
   mapDescriptorToReachGraph;
 
+  protected PointerMethod pm;
+
 
   // allocate various structures that are not local
   // to a single class method--should be done once
@@ -512,6 +514,8 @@ public class DisjointAnalysis {
     this.stopAfterCapture        = state.DISJOINTSNAPSTOPAFTER;
     this.snapVisitCounter        = 1; // count visits from 1 (user will write 1, means 1st visit)
     this.snapNodeCounter         = 0; // count nodes from 0
+    this.pm=new PointerMethod();
+
            
     // set some static configuration for ReachGraphs
     ReachGraph.allocationDepth = allocationDepth;
@@ -656,7 +660,7 @@ public class DisjointAnalysis {
     } else {
       fm = state.getMethodFlat( d );
     }
-      
+    pm.analyzeMethod(fm);
     // intraprocedural work set
     Set<FlatNode> flatNodesToVisit = new HashSet<FlatNode>();
     flatNodesToVisit.add( fm );
@@ -692,8 +696,8 @@ public class DisjointAnalysis {
       }
 
       // start by merging all node's parents' graphs
-      for( int i = 0; i < fn.numPrev(); ++i ) {
-       FlatNode pn = fn.getPrev( i );
+      for( int i = 0; i < pm.numPrev(fn); ++i ) {
+       FlatNode pn = pm.getPrev(fn,i);
        if( mapFlatNodeToReachGraph.containsKey( pn ) ) {
          ReachGraph rgParent = mapFlatNodeToReachGraph.get( pn );
          rg.merge( rgParent );
@@ -727,8 +731,8 @@ public class DisjointAnalysis {
       if( !rg.equals( rgPrev ) ) {
        mapFlatNodeToReachGraph.put( fn, rg );
 
-       for( int i = 0; i < fn.numNext(); i++ ) {
-         FlatNode nn = fn.getNext( i );
+       for( int i = 0; i < pm.numNext(fn); i++ ) {
+         FlatNode nn = pm.getNext(fn, i);
          flatNodesToVisit.add( nn );
        }
       }
@@ -1888,6 +1892,7 @@ private void buildAllocationSiteSet(Descriptor d) {
       assert d instanceof TaskDescriptor;
       fm = state.getMethodFlat( (TaskDescriptor) d);
     }
+    pm.analyzeMethod(fm);
 
     // visit every node in this FlatMethod's IR graph
     // and make a set of the allocation sites from the
@@ -1906,8 +1911,8 @@ private void buildAllocationSiteSet(Descriptor d) {
       toVisit.remove(n);
       visited.add(n);
 
-      for( int i = 0; i < n.numNext(); ++i ) {
-       FlatNode child = n.getNext(i);
+      for( int i = 0; i < pm.numNext(n); ++i ) {
+       FlatNode child = pm.getNext(n, i);
        if( !visited.contains(child) ) {
          toVisit.add(child);
        }
index 19ab62b6f55e76207e4da2f65c696f1fba8802a2..c7b1d91916065ccad1f18af1b35068c7152f87b2 100644 (file)
@@ -26,7 +26,8 @@ public class PointerMethod {
       HashSet<FlatNode> myset=new HashSet<FlatNode>();
       if (!analysisCares(fn)) {
        for(int i=0;i<fn.numPrev();i++) {
-         myset.addAll(map.get(fn.getPrev(i)));
+         if (map.containsKey(fn.getPrev(i)))
+           myset.addAll(map.get(fn.getPrev(i)));
        }
       } else {
        myset.add(fn);
@@ -59,7 +60,11 @@ public class PointerMethod {
   }
 
   public int numNext(FlatNode fn) {
-    return nextmap.get(fn).size();
+    Vector<FlatNode> vfn=nextmap.get(fn);
+    if (vfn==null)
+      return 0;
+    else 
+      return vfn.size();
   }
 
   public FlatNode getNext(FlatNode fn, int i) {