more changes
authorbdemsky <bdemsky>
Thu, 27 Jan 2011 00:54:44 +0000 (00:54 +0000)
committerbdemsky <bdemsky>
Thu, 27 Jan 2011 00:54:44 +0000 (00:54 +0000)
Robust/src/Analysis/Pointer/Delta.java
Robust/src/Analysis/Pointer/Pointer.java

index e7e7be70808fbda346e67138b8fe7d56016c4b39..842b6f7e0ca56d02c87bac55a1fad17324ac6c88 100644 (file)
@@ -29,10 +29,29 @@ public class Delta {
     this.block=block;
   }
 
+  private Delta() {
+  }
+
   public BBlock getBlock() {
     return block;
   }
 
+  public void setBlock(BBLock block) {
+    this.block=block;
+  }
+
+  public Delta diffBlock(BBLock bblock) {
+    Delta newdelta=new Delta();
+    newdelta.baseheapedge=baseheapedge;
+    newdelta.basevaredge=basevaredge;
+    newdelta.heapedgeadd=heapedgeadd;
+    newdelta.heapedgeremove=heapedgeremove;
+    newdelta.varedgeadd=varedgeadd;
+    newdelta.varedgeremove=varedgeremove;
+    newdelta.block=bblock;
+    return newdelta;
+  }
+
   public boolean getInit() {
     return init;
   }
index de72c8982d2e44507673c5d0891ae20df87515af..93e80bd5b145e5370a960dbb2e7affaafce4553d 100644 (file)
@@ -66,10 +66,49 @@ public class Pointer {
        Graph nodeGraph=graphMap.get(currNode);
        delta=processNode(currNode, delta, nodeGraph);
       }
-      //XXXX: Need to generate new delta
+      generateFinalDelta(nodeGraph, delta)
     }    
   }
 
+  void generateFinalDelta(Delta delta, Graph graph) {
+    Delta newDelta=new Delta(null, false);
+    if (delta.isInit()) {
+      //First compute the set of temps
+      HashSet<TempDescriptor> tmpSet=new HashSet<TempDescriptor>();
+      tmpSet.addAll(graph.varMap.keySet());
+      tmpSet.addAll(graph.parent.varMap.keySet());
+
+      //Next build the temp map part of the delta
+      for(tmp:tmpSet) {
+       HashSet<Edge> edgeSet=new HashSet<Edge>();
+       /* Get target set */
+       if (graph.varMap.containsKey(tmp))
+         edgeSet.addAll(graph.varMap.get(tmp));
+       else
+         edgeSet.addAll(graph.parent.varMap.get(tmp));
+       newdelta.varedgeadd.put(tmp, edgeset);
+      }
+
+      //Next compute the set of src allocnodes
+      HashSet<AllocNode> nodeSet=new HashSet<AllocNode>();
+      nodeSet.addAll(graph.nodeMap.keySet());
+      nodeSet.addAll(graph.parent.nodeMap.keySet());
+
+      for(node:nodeSet) {
+       HashSet<Edge> edgeSet=new HashSet<Edge>();
+       /* Get edge set */
+       if (graph.nodeMap.containsKey(node))
+         edgeSet.addAll(graph.nodeMap.get(node));
+       else
+         edgeSet.addAll(graph.parent.nodeMap.get(node));
+       newdelta.heapedgeadd.put(node, edgeset);
+      }
+    } else {
+      
+      
+    }
+  }
+
   Delta processNode(FlatNode node, Delta delta, Graph newgraph) {
     switch(node.kind()) {
     case FKind.FlatNew:
@@ -81,15 +120,15 @@ public class Pointer {
     case FKind.FlatOpNode:
       return processCopyNode(node, delta, newgraph);
     case FKind.FlatSetFieldNode:
+    case FKind.FlatSetElementNode:
       return processSetFieldElementNode(node, delta, newgraph);
     case FKind.FlatMethod:
     case FKind.FlatCall:
     case FKind.FlatReturnNode:
-    case FKind.FlatSetElementNode:
     case FKind.FlatExit:
+
     case FKind.FlatSESEEnterNode:
     case FKind.FlatSESEExitNode:
-
       throw new Error("Unimplemented node:"+node);
     default:
       throw new Error("Unrecognized node:"+node);