From: jjenista Date: Wed, 28 Nov 2007 22:24:28 +0000 (+0000) Subject: Found a bug in OwnershipGraph.java when writing out the .dot file. If X-Git-Tag: preEdgeChange~353 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6e12ddb6312d62dad20b4024954aa2505f7fdfe5;p=IRC.git Found a bug in OwnershipGraph.java when writing out the .dot file. If a heap region that is listed as a heap root, such as an incoming parameter, and some other heap region creates a reference to it, then it will be traversed twice, once from it's own heap root starting point, and once when the referencing heap region's heap root is traversed. Altered the graph writing code to use a shared hashset to decide if a heap region has been visited. --- diff --git a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java index 10854040..bccf240a 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java +++ b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java @@ -85,8 +85,7 @@ public class OwnershipGraph { OwnershipHeapRegionNode ohrnSrc = null; Iterator srcRegionsItr = srcln.iteratorToReachableRegions(); while( srcRegionsItr.hasNext() ) { - ohrnSrc = (OwnershipHeapRegionNode)srcRegionsItr.next(); - + ohrnSrc = (OwnershipHeapRegionNode)srcRegionsItr.next(); ohrn.addReachableRegion( ohrnSrc ); } } @@ -404,12 +403,14 @@ public class OwnershipGraph { BufferedWriter bw = new BufferedWriter( new FileWriter( graphName+".dot" ) ); bw.write( "digraph "+graphName+" {\n" ); + HashSet visited = new HashSet(); + Set s = heapRoots.entrySet(); Iterator i = s.iterator(); while( i.hasNext() ) { Map.Entry me = (Map.Entry) i.next(); OwnershipHeapRegionNode ohrn = (OwnershipHeapRegionNode) me.getValue(); - traverseHeapNodesTop( VISIT_OHRN_WRITE_FULL, ohrn, bw, null ); + traverseHeapNodes( VISIT_OHRN_WRITE_FULL, ohrn, bw, null, visited ); } s = td2ln.entrySet(); @@ -435,6 +436,8 @@ public class OwnershipGraph { BufferedWriter bw = new BufferedWriter( new FileWriter( graphName+".dot" ) ); bw.write( "graph "+graphName+" {\n" ); + HashSet visited = new HashSet(); + // find linked regions for( int i = 0; i < analysisRegionLabels.size(); ++i ) { TempDescriptor td = analysisRegionLabels.get( i ); @@ -446,7 +449,7 @@ public class OwnershipGraph { while( heapRegionsItr.hasNext() ) { ohrn = (OwnershipHeapRegionNode)heapRegionsItr.next(); - traverseHeapNodesTop( VISIT_OHRN_WRITE_CONDENSED, ohrn, bw, td ); + traverseHeapNodes( VISIT_OHRN_WRITE_CONDENSED, ohrn, bw, td, visited ); } } @@ -464,6 +467,7 @@ public class OwnershipGraph { bw.close(); } + /* protected void traverseHeapNodesTop( int mode, OwnershipHeapRegionNode ohrn, BufferedWriter bw, @@ -472,6 +476,7 @@ public class OwnershipGraph { HashSet visited = new HashSet(); traverseHeapNodes( mode, ohrn, bw, td, visited ); } + */ protected void traverseHeapNodes( int mode, OwnershipHeapRegionNode ohrn, diff --git a/Robust/src/Tests/OwnershipAnalysisTest/test01/makefile b/Robust/src/Tests/OwnershipAnalysisTest/test01/makefile index 72b2f27e..2ff00ccb 100644 --- a/Robust/src/Tests/OwnershipAnalysisTest/test01/makefile +++ b/Robust/src/Tests/OwnershipAnalysisTest/test01/makefile @@ -8,7 +8,9 @@ BSFLAGS= -recover -flatirtasks -ownership -enable-assertions all: view view: PNGs - eog *.png & + eog *flatIRGraph*.png & + eog *FN*.png & + eog *Ownership*.png & PNGs: DOTs rm -f *Startup*.dot