From b55ec248ddcd89e7362f85019f6014b1b8de80ee Mon Sep 17 00:00:00 2001 From: bdemsky Date: Thu, 24 Mar 2011 06:33:59 +0000 Subject: [PATCH] initial taint should have null whereDefined so we don't get fake cycles --- .../Disjoint/StateMachineForEffects.java | 9 +++++++-- Robust/src/Analysis/Pointer/Pointer.java | 16 ++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Robust/src/Analysis/Disjoint/StateMachineForEffects.java b/Robust/src/Analysis/Disjoint/StateMachineForEffects.java index 701a9016..af0c6e9a 100644 --- a/Robust/src/Analysis/Disjoint/StateMachineForEffects.java +++ b/Robust/src/Analysis/Disjoint/StateMachineForEffects.java @@ -16,6 +16,7 @@ import IR.Flat.*; ////////////////////////////////////////////// public class StateMachineForEffects { + public final static FlatNode startNode=new FlatNop(); // states in the machine are uniquely identified // by a flat node (program point) @@ -36,6 +37,8 @@ public class StateMachineForEffects { public void addEffect( FlatNode fnState, Effect e ) { + if (fnState==null) + fnState=startNode; SMFEState state = getState( fnState ); state.addEffect( e ); } @@ -43,11 +46,13 @@ public class StateMachineForEffects { public void addTransition( FlatNode fnFrom, FlatNode fnTo, Effect e ) { - + if (fnFrom==null) + fnFrom=startNode; + assert fn2state.containsKey( fnFrom ); SMFEState stateFrom = getState( fnFrom ); SMFEState stateTo = getState( fnTo ); - + stateFrom.addTransition( e, stateTo ); } diff --git a/Robust/src/Analysis/Pointer/Pointer.java b/Robust/src/Analysis/Pointer/Pointer.java index 07b57389..8e44798b 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 (true) { + if (false) { int debugindex=0; for(Map.Entry e:bbgraphMap.entrySet()) { Graph g=e.getValue(); @@ -444,7 +444,7 @@ public class Pointer implements HeapAnalysis{ if (delta.getInit()) { removeInitTaints(null, delta, graph); for (TempDescriptor tmp:sese.getInVarSet()) { - Taint taint=Taint.factory(sese, null, tmp, AllocFactory.dummySite, sese, ReachGraph.predsEmpty); + Taint taint=Taint.factory(sese, null, tmp, AllocFactory.dummySite, null, ReachGraph.predsEmpty); MySet edges=GraphManip.getEdges(graph, delta, tmp); for(Edge e:edges) { Edge newe=e.addTaint(taint); @@ -454,7 +454,7 @@ public class Pointer implements HeapAnalysis{ } else { removeDiffTaints(null, delta); for (TempDescriptor tmp:sese.getInVarSet()) { - Taint taint=Taint.factory(sese, null, tmp, AllocFactory.dummySite, sese, ReachGraph.predsEmpty); + Taint taint=Taint.factory(sese, null, tmp, AllocFactory.dummySite, null, ReachGraph.predsEmpty); MySet edges=GraphManip.getDiffEdges(delta, tmp); for(Edge e:edges) { Edge newe=e.addTaint(taint); @@ -1372,7 +1372,7 @@ public class Pointer implements HeapAnalysis{ MySet dstEdges=GraphManip.getEdges(graph, delta, dst); if (OoOJava&&!accessible.isAccessible(node, dst)) { - Taint dstStallTaint=Taint.factory(node, dst, AllocFactory.dummySite, node, ReachGraph.predsEmpty); + Taint dstStallTaint=Taint.factory(node, dst, AllocFactory.dummySite, null, ReachGraph.predsEmpty); dstEdges=Edge.taintAll(dstEdges, dstStallTaint); updateVarDelta(graph, delta, dst, dstEdges, null); } @@ -1387,7 +1387,7 @@ public class Pointer implements HeapAnalysis{ MySet srcEdges=GraphManip.getEdges(graph, delta, src); if (OoOJava&&!accessible.isAccessible(node, src)) { - Taint srcStallTaint=Taint.factory(node, src, AllocFactory.dummySite, node, ReachGraph.predsEmpty); + Taint srcStallTaint=Taint.factory(node, src, AllocFactory.dummySite, null, ReachGraph.predsEmpty); srcEdges=Edge.taintAll(srcEdges, srcStallTaint); updateVarDelta(graph, delta, src, srcEdges, null); } @@ -1408,7 +1408,7 @@ public class Pointer implements HeapAnalysis{ MySet newDstEdges=GraphManip.getDiffEdges(delta, dst); if (OoOJava&&!accessible.isAccessible(node, dst)) { - Taint dstStallTaint=Taint.factory(node, dst, AllocFactory.dummySite, node, ReachGraph.predsEmpty); + Taint dstStallTaint=Taint.factory(node, dst, AllocFactory.dummySite, null, ReachGraph.predsEmpty); newDstEdges=Edge.taintAll(newDstEdges, dstStallTaint); updateVarDelta(graph, delta, dst, newDstEdges, null); } @@ -1429,7 +1429,7 @@ public class Pointer implements HeapAnalysis{ HashSet dstNodes=GraphManip.getNodes(graph, delta, dst); if (OoOJava&&!accessible.isAccessible(node, src)) { - Taint srcStallTaint=Taint.factory(node, src, AllocFactory.dummySite, node, ReachGraph.predsEmpty); + Taint srcStallTaint=Taint.factory(node, src, AllocFactory.dummySite, null, ReachGraph.predsEmpty); newSrcEdges=Edge.taintAll(newSrcEdges, srcStallTaint); updateVarDelta(graph, delta, src, newSrcEdges, null); } @@ -1531,7 +1531,7 @@ public class Pointer implements HeapAnalysis{ dst=ffn.getDst(); } if (OoOJava&&!accessible.isAccessible(node, src)) { - taint=TaintSet.factory(Taint.factory(node, src, AllocFactory.dummySite, node, ReachGraph.predsEmpty)); + taint=TaintSet.factory(Taint.factory(node, src, AllocFactory.dummySite, null, ReachGraph.predsEmpty)); } //Do nothing for non pointers -- 2.34.1