bits to help investigate node count changing
authorjjenista <jjenista>
Tue, 24 Jan 2012 17:52:19 +0000 (17:52 +0000)
committerjjenista <jjenista>
Tue, 24 Jan 2012 17:52:19 +0000 (17:52 +0000)
Robust/src/Analysis/Disjoint/AllocSite.java
Robust/src/Analysis/Disjoint/DisjointAnalysis.java
Robust/src/Analysis/Disjoint/ReachGraph.java
Robust/src/Benchmarks/oooJava/master-makefile
Robust/src/Tests/disjoint/strong-up-change-node-count/makefile [new file with mode: 0644]
Robust/src/Tests/disjoint/strong-up-change-node-count/test.java [new file with mode: 0644]

index b41a5405918cbe62005ed066ec65c4f447b1d515..fbf6711236bc38edc5d2093428a2f6016b547ddc 100644 (file)
@@ -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)+") ";
     }
index 3023faf5d59f7b3f1028050bac5475a48727ffc1..689b53303f4e83a801603192792c006ee80ab3bd 100644 (file)
@@ -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 ) {
index 1e065cd9cec19c141c6bd91b49fae0b10410537e..6c0e1c882c243a64cd2fdebf0fbd54368557b017 100644 (file)
@@ -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<RefEdge> refItr = hrn.iteratorToReferencers();
+    while( refItr.hasNext() ) {
+      RefSrcNode rsn = refItr.next().getSrc();
+      if( rsn instanceof VariableNode ) {
+        s += "    "+rsn+"\n";
+      }
+    }
+    
+    return s;
+  }
 }
index 679ef949a0c52ac33a85054867a6e7fbaf7aa728..fe3e170209ac7f5b7bec99634d6af9e2e788785d 100644 (file)
@@ -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 (file)
index 0000000..e313115
--- /dev/null
@@ -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 (file)
index 0000000..c390478
--- /dev/null
@@ -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();
+  }
+}