}
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)+") ";
}
}
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);
if( state.DISJOINTWRITEINITCONTEXTS ) {
writeInitialContexts();
+
}
if( state.DISJOINT_WRITE_ALL_NODE_FINAL_GRAPHS ) {
"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<RefEdge> refItr = hrn.iteratorToReferencers();
+ while( refItr.hasNext() ) {
+ RefSrcNode rsn = refItr.next().getSrc();
+ if( rsn instanceof VariableNode ) {
+ s += " "+rsn+"\n";
+ }
+ }
+
+ return s;
+ }
}
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 \
#
--- /dev/null
+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
--- /dev/null
+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();
+ }
+}