changes
[IRC.git] / Robust / src / Analysis / Pointer / Pointer.java
index ed5e4f4e5d35310e2e6f0d9c486f1cc35b8eef79..13dd2844ff3f4bd0be105a997a9cb6d39727c301 100644 (file)
@@ -147,26 +147,44 @@ public class Pointer implements HeapAnalysis{
       if (!init&&delta.isEmpty())
        continue nextdelta;
       
+      int lasti=-1;
       //Compute delta at exit of each node
       for(int i=startindex; i<nodes.size();i++) {
        FlatNode currNode=nodes.get(i);
        //System.out.println("Start Processing "+currNode);
+
        if (!graphMap.containsKey(currNode)) {
-         if (isNEEDED(currNode))
+         if (isNEEDED(currNode)) {
            graphMap.put(currNode, new Graph(graph));
-         else {
-           if (i==(nodes.size()-1)&&isINACC(currNode)) {
-             mustProcess.add(currNode);
-             graphMap.put(currNode, new Graph(graph));
-           } else if (i==0) {
-             //base graph works for us
-             graphMap.put(currNode, new Graph(graph));
-           } else {
-             //just use previous graph
-             graphMap.put(currNode, graphMap.get(nodes.get(i-1)));
+         } else {
+           boolean fallthru=true;
+           if (isINACC(currNode)&&((lasti==-1)||(lasti==i))) {
+             if (lasti==-1) {
+               for(lasti=nodes.size()-1;lasti>=i;lasti--) {
+                 FlatNode scurrNode=nodes.get(lasti);
+                 if (isNEEDED(scurrNode)||isINACC(scurrNode)) {
+                   break;
+                 }
+               }
+             }
+             if (i==lasti) {
+               mustProcess.add(currNode);
+               graphMap.put(currNode, new Graph(graph));
+               fallthru=false;
+             }
+           }
+           if (fallthru) {
+             if (i==0) {
+               //base graph works for us
+               graphMap.put(currNode, new Graph(graph));
+             } else {
+               //just use previous graph
+               graphMap.put(currNode, graphMap.get(nodes.get(i-1)));
+             }
            }
          }
        }
+
        nodeGraph=graphMap.get(currNode);
        delta=processNode(bblock, i, currNode, delta, nodeGraph);
        //System.out.println("Processing "+currNode+" and generating delta:");
@@ -176,7 +194,7 @@ public class Pointer implements HeapAnalysis{
     }
 
     //DEBUG
-    if (true) {
+    if (false) {
       int debugindex=0;
       for(Map.Entry<BBlock, Graph> e:bbgraphMap.entrySet()) {
        Graph g=e.getValue();
@@ -185,7 +203,7 @@ public class Pointer implements HeapAnalysis{
       }
       
       for(FlatMethod fm:blockMap.keySet()) {
-       System.out.println(fm.printMethod(accessible.inAccessible));
+       System.out.println(fm.printMethod());
       }
       for(Map.Entry<FlatNode, Graph> e:graphMap.entrySet()) {
        FlatNode fn=e.getKey();