From: bdemsky Date: Thu, 27 Jan 2011 19:46:30 +0000 (+0000) Subject: more changes X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b71409cec839a1111d6d232635c06e3bd40607af;p=IRC.git more changes --- diff --git a/Robust/src/Analysis/Pointer/Delta.java b/Robust/src/Analysis/Pointer/Delta.java index 842b6f7e..a0a49c72 100644 --- a/Robust/src/Analysis/Pointer/Delta.java +++ b/Robust/src/Analysis/Pointer/Delta.java @@ -36,11 +36,11 @@ public class Delta { return block; } - public void setBlock(BBLock block) { + public void setBlock(BBlock block) { this.block=block; } - public Delta diffBlock(BBLock bblock) { + public Delta diffBlock(BBlock bblock) { Delta newdelta=new Delta(); newdelta.baseheapedge=baseheapedge; newdelta.basevaredge=basevaredge; diff --git a/Robust/src/Analysis/Pointer/Pointer.java b/Robust/src/Analysis/Pointer/Pointer.java index 93e80bd5..a1269846 100644 --- a/Robust/src/Analysis/Pointer/Pointer.java +++ b/Robust/src/Analysis/Pointer/Pointer.java @@ -57,36 +57,37 @@ public class Pointer { delta=applyInitDelta(delta, bblock); Graph graph=bbgraphMap.get(bblock); + Graph nodeGraph=null; //Compute delta at exit of each node for(int i=0; i tmpSet=new HashSet(); tmpSet.addAll(graph.varMap.keySet()); tmpSet.addAll(graph.parent.varMap.keySet()); //Next build the temp map part of the delta - for(tmp:tmpSet) { + for(TempDescriptor tmp:tmpSet) { HashSet edgeSet=new HashSet(); /* 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); + newDelta.varedgeadd.put(tmp, edgeSet); } //Next compute the set of src allocnodes @@ -94,18 +95,67 @@ public class Pointer { nodeSet.addAll(graph.nodeMap.keySet()); nodeSet.addAll(graph.parent.nodeMap.keySet()); - for(node:nodeSet) { + for(AllocNode node:nodeSet) { HashSet edgeSet=new HashSet(); /* 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); + newDelta.heapedgeadd.put(node, edgeSet); } } else { - - + /* We can break the old delta...it is done being used */ + /* First we will build variable edges */ + HashSet tmpSet=new HashSet(); + tmpSet.addAll(delta.basevaredge.keySet()); + tmpSet.addAll(delta.varedgeadd.keySet()); + for(TempDescriptor tmp:tmpSet) { + /* Start with the new incoming edges */ + HashSet newbaseedge=delta.basevaredge.get(tmp); + /* Remove the remove set */ + newbaseedge.removeAll(delta.varedgeremove.get(tmp)); + /* Add in the new set*/ + newbaseedge.addAll(delta.varedgeadd.get(tmp)); + /* Store the results */ + newDelta.varedgeadd.put(tmp, newbaseedge); + } + + /* Next we build heap edges */ + HashSet nodeSet=new HashSet(); + nodeSet.addAll(delta.baseheapedge.keySet()); + nodeSet.addAll(delta.heapedgeadd.keySet()); + nodeSet.addAll(delta.heapedgeremove.keySet()); + for(AllocNode node:nodeSet) { + /* Start with the new incoming edges */ + HashSet newheapedge=(HashSet) delta.baseheapedge.get(node).clone(); + /* Remove the remove set */ + newheapedge.removeAll(delta.heapedgeremove.get(node)); + /* Add in the add set */ + newheapedge.addAll(delta.heapedgeadd.get(node)); + newDelta.heapedgeadd.put(node, newheapedge); + + /* Also need to subtract off some edges */ + HashSet removeset=delta.heapedgeremove.get(node); + /* Remove the newly created edges..no need to propagate a diff for those */ + removeset.removeAll(delta.baseheapedge.get(node)); + newDelta.heapedgeremove.put(node, removeset); + } + } + /* Now we need to propagate newdelta */ + if (!newDelta.heapedgeadd.isEmpty()||!newDelta.heapedgeremove.isEmpty()||!newDelta.varedgeadd.isEmpty()) { + /* We have a delta to propagate */ + BBlock curr=delta.getBlock(); + Vector blockvector=curr.next(); + for(int i=0;i