From: bdemsky Date: Tue, 22 Mar 2011 22:33:47 +0000 (+0000) Subject: bug fixes X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b40bad43bbb9ffc69dff38c386264d05bc55ba41;p=IRC.git bug fixes --- diff --git a/Robust/src/Analysis/Pointer/GraphManip.java b/Robust/src/Analysis/Pointer/GraphManip.java index 34b3d1bc..d8c66f8a 100644 --- a/Robust/src/Analysis/Pointer/GraphManip.java +++ b/Robust/src/Analysis/Pointer/GraphManip.java @@ -246,19 +246,12 @@ public class GraphManip { return edgeset; } - static MySet dereference(Graph graph, Delta delta, TempDescriptor dst, MySet srcEdges, FieldDescriptor fd, FlatNode fn, TaintSet taint) { + static MySet dereference(Graph graph, Delta delta, TempDescriptor dst, MySet srcEdges, FieldDescriptor fd, FlatNode fn) { MySet edgeset=new MySet(); - if (taint!=null) { - edgeset.addAll(Edge.taintAll(srcEdges, taint)); - } for(Edge edge:srcEdges) { TaintSet ts=edge.getTaints(); if (ts!=null) { ts=ts.reTaint(fn); - if (taint!=null) - ts=ts.merge(taint); - } else { - ts=taint; } MySet removeedges=delta.heapedgeremove.get(edge.dst); for(Edge e:graph.getEdges(edge.dst)) { @@ -290,16 +283,13 @@ public class GraphManip { return edgeset; } - static MySet diffDereference(Delta delta, TempDescriptor dst, MySet srcEdges, FieldDescriptor fd, FlatNode fn, TaintSet taint) { + static MySet diffDereference(Delta delta, TempDescriptor dst, MySet srcEdges, FieldDescriptor fd, FlatNode fn) { MySet edgeset=new MySet(); for(Edge edge:srcEdges) { TaintSet ts=edge.getTaints(); if (ts!=null) { - if (taint!=null) - ts=ts.merge(taint); ts=ts.reTaint(fn); - } else - ts=taint; + } MySet removeedges=delta.heapedgeremove.get(edge.dst); if (delta.baseheapedge.containsKey(edge.dst)) { for(Edge e:delta.baseheapedge.get(edge.dst)) { diff --git a/Robust/src/Analysis/Pointer/Pointer.java b/Robust/src/Analysis/Pointer/Pointer.java index 4666894a..e85a6387 100644 --- a/Robust/src/Analysis/Pointer/Pointer.java +++ b/Robust/src/Analysis/Pointer/Pointer.java @@ -171,7 +171,7 @@ public class Pointer implements HeapAnalysis{ } //DEBUG - if (false) { + if (true) { int debugindex=0; for(Map.Entry e:bbgraphMap.entrySet()) { Graph g=e.getValue(); @@ -1299,25 +1299,30 @@ public class Pointer implements HeapAnalysis{ fd=ffn.getField(); dst=ffn.getDst(); } - //Do nothing for non pointers - if (!src.getType().isPtr()) - return delta; if (delta.getInit()) { - MySet srcEdges=GraphManip.getEdges(graph, delta, src); MySet dstEdges=GraphManip.getEdges(graph, delta, dst); - if (OoOJava&&!accessible.isAccessible(node, src)) { - Taint srcStallTaint=Taint.factory(node, src, AllocFactory.dummySite, node, ReachGraph.predsEmpty); - srcEdges=Edge.taintAll(srcEdges, srcStallTaint); - updateVarDelta(graph, delta, src, srcEdges, null); - } - if (OoOJava&&!accessible.isAccessible(node, dst)) { Taint dstStallTaint=Taint.factory(node, dst, AllocFactory.dummySite, node, ReachGraph.predsEmpty); dstEdges=Edge.taintAll(dstEdges, dstStallTaint); updateVarDelta(graph, delta, dst, dstEdges, null); } + if (OoOJava) { + effectsAnalysis.analyzeFlatSetFieldNode(dstEdges, fd, node); + } + + //Do nothing for non pointers + if (!src.getType().isPtr()) { + return delta; + } + + MySet srcEdges=GraphManip.getEdges(graph, delta, src); + if (OoOJava&&!accessible.isAccessible(node, src)) { + Taint srcStallTaint=Taint.factory(node, src, AllocFactory.dummySite, node, ReachGraph.predsEmpty); + srcEdges=Edge.taintAll(srcEdges, srcStallTaint); + updateVarDelta(graph, delta, src, srcEdges, null); + } MySet edgesToAdd=GraphManip.genEdges(dstEdges, fd, srcEdges); MySet edgesToRemove=null; @@ -1328,27 +1333,12 @@ public class Pointer implements HeapAnalysis{ } else graph.strongUpdateSet=new MySet(); - if (OoOJava) { - effectsAnalysis.analyzeFlatSetFieldNode(dstEdges, fd, node); - } - /* Update diff */ updateHeapDelta(graph, delta, edgesToAdd, edgesToRemove); applyDiffs(graph, delta); } else { - /* First look at new sources */ - MySet edgesToAdd=new MySet(); - MySet newSrcEdges=GraphManip.getDiffEdges(delta, src); - MySet srcEdges=GraphManip.getEdges(graph, delta, src); - HashSet dstNodes=GraphManip.getNodes(graph, delta, dst); MySet newDstEdges=GraphManip.getDiffEdges(delta, dst); - if (OoOJava&&!accessible.isAccessible(node, src)) { - Taint srcStallTaint=Taint.factory(node, src, AllocFactory.dummySite, node, ReachGraph.predsEmpty); - newSrcEdges=Edge.taintAll(newSrcEdges, srcStallTaint); - updateVarDelta(graph, delta, src, newSrcEdges, null); - } - if (OoOJava&&!accessible.isAccessible(node, dst)) { Taint dstStallTaint=Taint.factory(node, dst, AllocFactory.dummySite, node, ReachGraph.predsEmpty); newDstEdges=Edge.taintAll(newDstEdges, dstStallTaint); @@ -1359,6 +1349,23 @@ public class Pointer implements HeapAnalysis{ effectsAnalysis.analyzeFlatSetFieldNode(newDstEdges, fd, node); } + if (!src.getType().isPtr()) { + return delta; + } + + /* Next look at new sources */ + + MySet edgesToAdd=new MySet(); + MySet newSrcEdges=GraphManip.getDiffEdges(delta, src); + MySet srcEdges=GraphManip.getEdges(graph, delta, src); + HashSet dstNodes=GraphManip.getNodes(graph, delta, dst); + + if (OoOJava&&!accessible.isAccessible(node, src)) { + Taint srcStallTaint=Taint.factory(node, src, AllocFactory.dummySite, node, ReachGraph.predsEmpty); + newSrcEdges=Edge.taintAll(newSrcEdges, srcStallTaint); + updateVarDelta(graph, delta, src, newSrcEdges, null); + } + MySet edgesToRemove=null; if (newDstEdges.size()!=0) { if (dstNodes.size()>1&&!dstNodes.iterator().next().isSummary()&&fd!=null) { @@ -1460,24 +1467,40 @@ public class Pointer implements HeapAnalysis{ } //Do nothing for non pointers - if (!dst.getType().isPtr()) - return delta; if (delta.getInit()) { MySet srcedges=GraphManip.getEdges(graph, delta, src); - MySet edgesToAdd=GraphManip.dereference(graph, delta, dst, srcedges, fd, node, taint); - MySet edgesToRemove=GraphManip.getEdges(graph, delta, dst); - if (OoOJava) + if (OoOJava) { + if (taint!=null) { + srcedges=Edge.taintAll(srcedges, taint); + updateVarDelta(graph, delta, src, srcedges, null); + } effectsAnalysis.analyzeFlatFieldNode(srcedges, fd, node); + } + if (!dst.getType().isPtr()) + return delta; + + MySet edgesToAdd=GraphManip.dereference(graph, delta, dst, srcedges, fd, node); + MySet edgesToRemove=GraphManip.getEdges(graph, delta, dst); updateVarDelta(graph, delta, dst, edgesToAdd, edgesToRemove); applyDiffs(graph, delta); } else { + MySet newsrcedges=GraphManip.getDiffEdges(delta, src); + if (OoOJava) { + if (taint!=null) { + newsrcedges=Edge.taintAll(newsrcedges, taint); + updateVarDelta(graph, delta, src, newsrcedges, null); + } + effectsAnalysis.analyzeFlatFieldNode(newsrcedges, fd, node); + } + if (!dst.getType().isPtr()) + return delta; + /* First compute new objects we read fields of */ MySet allsrcedges=GraphManip.getEdges(graph, delta, src); - MySet edgesToAdd=GraphManip.diffDereference(delta, dst, allsrcedges, fd, node, taint); + MySet edgesToAdd=GraphManip.diffDereference(delta, dst, allsrcedges, fd, node); /* Next compute new targets of fields */ - MySet newsrcedges=GraphManip.getDiffEdges(delta, src); - MySet newfdedges=GraphManip.dereference(graph, delta, dst, newsrcedges, fd, node, taint); + MySet newfdedges=GraphManip.dereference(graph, delta, dst, newsrcedges, fd, node); /* Compute the union, and then the set of edges */ Edge.mergeEdgesInto(edgesToAdd, newfdedges); @@ -1485,8 +1508,6 @@ public class Pointer implements HeapAnalysis{ /* Compute set of edges to remove */ MySet edgesToRemove=GraphManip.getDiffEdges(delta, dst); - if (OoOJava) - effectsAnalysis.analyzeFlatFieldNode(newsrcedges, fd, node); /* Update diff */ updateVarDelta(graph, delta, dst, edgesToAdd, edgesToRemove);