From: jjenista Date: Tue, 24 Jan 2012 17:52:19 +0000 (+0000) Subject: bits to help investigate node count changing X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ae9c382ded0b5299b161e70f379f5747915c6997;p=IRC.git bits to help investigate node count changing --- diff --git a/Robust/src/Analysis/Disjoint/AllocSite.java b/Robust/src/Analysis/Disjoint/AllocSite.java index b41a5405..fbf67112 100644 --- a/Robust/src/Analysis/Disjoint/AllocSite.java +++ b/Robust/src/Analysis/Disjoint/AllocSite.java @@ -276,7 +276,11 @@ public class AllocSite extends Canonical implements Alloc { } public String toStringWithIDs() { - String s = "allocSite"+id+" "; + return "allocSite"+id+" "+toStringJustIDs(); + } + + public String toStringJustIDs() { + String s = ""; for( int i = 0; i < ithOldest.size(); ++i ) { s += i+"("+ithOldest.get(i)+") "; } diff --git a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java index 3023faf5..689b5330 100644 --- a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java +++ b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java @@ -932,6 +932,15 @@ public class DisjointAnalysis implements HeapAnalysis { } if( state.DISJOINT_COUNT_GRAPH_ELEMENTS ) { treport += "\n"+getPartial( mdSourceEntry ).countGraphElements()+"\n"; + getPartial( mdSourceEntry ).writeGraph( "countElementsGraph", + true, + true, + true, + false, + true, + true, + true ); + getPartial( mdSourceEntry ).writeNodes( "countElementsNodeListing.txt" ); } String justtime = String.format("%.2f", dt); System.out.println(treport); @@ -948,6 +957,7 @@ public class DisjointAnalysis implements HeapAnalysis { if( state.DISJOINTWRITEINITCONTEXTS ) { writeInitialContexts(); + } if( state.DISJOINT_WRITE_ALL_NODE_FINAL_GRAPHS ) { diff --git a/Robust/src/Analysis/Disjoint/ReachGraph.java b/Robust/src/Analysis/Disjoint/ReachGraph.java index 1e065cd9..6c0e1c88 100644 --- a/Robust/src/Analysis/Disjoint/ReachGraph.java +++ b/Robust/src/Analysis/Disjoint/ReachGraph.java @@ -5446,4 +5446,61 @@ public class ReachGraph { "Edge non-zero tuples = "+numEdgeStateNonzero+"\n"+ "################################################\n"; } + + + public void writeNodes( String filename ) { + + try { + + BufferedWriter bw = new BufferedWriter( new FileWriter( filename ) ); + + for( AllocSite as : allocSites ) { + bw.write( "--------------------------\n" ); + + // allocation site ID, full type, assigned heap node IDs + bw.write( as.toStringVerbose()+"\n"+ + " "+as.toStringJustIDs()+"\n" ); + + // which of the nodes are actually in this graph? + for( int i = 0; i < allocationDepth; ++i ) { + Integer id = as.getIthOldest( i ); + String s = writeNodeFormat( id ); + if( s != null ) { + bw.write( s ); + } + } + Integer id = as.getSummary(); + String s = writeNodeFormat( id ); + if( s != null ) { + bw.write( s ); + } + } + + bw.close(); + + } catch( IOException e ) { + System.out.println( "Error writing nodes to file: "+filename ); + } + } + + private String writeNodeFormat( Integer id ) { + String s = null; + + if( !id2hrn.containsKey( id ) ) { + return s; + } + + s = " "+id+" is present and refrenced by variables:\n"; + + HeapRegionNode hrn = id2hrn.get( id ); + Iterator refItr = hrn.iteratorToReferencers(); + while( refItr.hasNext() ) { + RefSrcNode rsn = refItr.next().getSrc(); + if( rsn instanceof VariableNode ) { + s += " "+rsn+"\n"; + } + } + + return s; + } } diff --git a/Robust/src/Benchmarks/oooJava/master-makefile b/Robust/src/Benchmarks/oooJava/master-makefile index 679ef949..fe3e1702 100644 --- a/Robust/src/Benchmarks/oooJava/master-makefile +++ b/Robust/src/Benchmarks/oooJava/master-makefile @@ -79,9 +79,10 @@ DISJOINT= -disjoint -disjoint-k 1 -enable-assertions $(DRELEASEMODE) #-disjoint- DISJOINTDEBUG= -disjoint -disjoint-k 1 -enable-assertions $(DRELEASEMODE) \ -justanalyze \ - -disjoint-count-graph-elements -# -disjoint-disable-global-sweep \ -# -disjoint-disable-strong-update + -disjoint-count-graph-elements \ + -disjoint-disable-strong-update \ + -disjoint-disable-global-sweep + # -disjoint-summarize-per-class # -disjoint-disable-predicates \ # diff --git a/Robust/src/Tests/disjoint/strong-up-change-node-count/makefile b/Robust/src/Tests/disjoint/strong-up-change-node-count/makefile new file mode 100644 index 00000000..e3131157 --- /dev/null +++ b/Robust/src/Tests/disjoint/strong-up-change-node-count/makefile @@ -0,0 +1,32 @@ +PROGRAM=test + +SOURCE_FILES=$(PROGRAM).java + +BUILDSCRIPT=~/research/Robust/src/buildscript +BSFLAGS= -joptimize \ + -mainclass Test \ + -justanalyze -disjoint -disjoint-k 1 -disjoint-write-dots final \ + -disjoint-alias-file aliases.txt normal -enable-assertions \ + -disjoint-count-graph-elements +#-flatirusermethods + +all: $(PROGRAM).bin + +view: PNGs + eog *.png & + +PNGs: DOTs + d2p *COMPLETE*.dot + +DOTs: $(PROGRAM).bin + +$(PROGRAM).bin: $(SOURCE_FILES) + $(BUILDSCRIPT) $(BSFLAGS) -o $(PROGRAM) $(SOURCE_FILES) + +clean: + rm -f $(PROGRAM).bin + rm -fr tmpbuilddirectory + rm -f *~ + rm -f *.dot + rm -f *.png + rm -f aliases.txt diff --git a/Robust/src/Tests/disjoint/strong-up-change-node-count/test.java b/Robust/src/Tests/disjoint/strong-up-change-node-count/test.java new file mode 100644 index 00000000..c3904780 --- /dev/null +++ b/Robust/src/Tests/disjoint/strong-up-change-node-count/test.java @@ -0,0 +1,17 @@ +public class Foo { + public Foo() {} + public Foo f; +} + +public class Test { + static public void main( String[] args ) { + Foo a = disjoint A new Foo(); + genreach r2; + Foo b = createFoo(); + genreach r3; + } + + static public Foo createFoo() { + return disjoint B new Foo(); + } +}