defreach experiment
authorjjenista <jjenista>
Mon, 9 Jan 2012 19:10:15 +0000 (19:10 +0000)
committerjjenista <jjenista>
Mon, 9 Jan 2012 19:10:15 +0000 (19:10 +0000)
Robust/src/Analysis/Disjoint/DisjointAnalysis.java
Robust/src/IR/State.java
Robust/src/Main/Main.java
Robust/src/buildscript

index b8dac1f9d7fb69cd754b8817c828112d04f51f5b..335a35340ab59170c940fe9fe90b3012c9590597 100644 (file)
@@ -15,6 +15,7 @@ import java.io.*;
 
 public class DisjointAnalysis implements HeapAnalysis {
 
+
   ///////////////////////////////////////////
   //
   //  Public interface to discover possible
@@ -889,6 +890,10 @@ public class DisjointAnalysis implements HeapAnalysis {
     } else {
       treport = String.format("Disjoint reachability analysis took %.3f sec.", dt);
     }
+    if( state.DISJOINT_COUNT_VISITS ) {
+      treport += "\nFixed point algorithm visited "+totalMethodVisits+
+        " methods and "+totalNodeVisits+" nodes.";
+    }
     String justtime = String.format("%.2f", dt);
     System.out.println(treport);
 
@@ -1115,6 +1120,10 @@ public class DisjointAnalysis implements HeapAnalysis {
   protected ReachGraph analyzeMethod(Descriptor d)
   throws java.io.IOException {
 
+    if( state.DISJOINT_COUNT_VISITS ) {
+      ++totalMethodVisits;
+    }
+
     // get the flat code for this descriptor
     FlatMethod fm;
     if( d == mdAnalysisEntry ) {
@@ -1290,6 +1299,11 @@ public class DisjointAnalysis implements HeapAnalysis {
                   ) throws java.io.IOException {
 
 
+    if( state.DISJOINT_COUNT_VISITS ) {
+      ++totalNodeVisits;
+    }
+
+
     // any variables that are no longer live should be
     // nullified in the graph to reduce edges
     //rg.nullifyDeadVars( liveness.getLiveInTemps( fmContaining, fn ) );
@@ -3251,4 +3265,9 @@ public class DisjointAnalysis implements HeapAnalysis {
 
     return rgAtExit.canPointTo( x, arrayElementFieldName, x.getType().dereference() );
   }
+
+  
+  // to evaluate convergence behavior
+  private static long totalMethodVisits = 0;
+  private static long totalNodeVisits   = 0;
 }
index 7f7544822b6c7db1cdc0c9a42a91b7ae24224272..f9b7be76169f3a930a0187a480501002266300f1 100644 (file)
@@ -132,6 +132,8 @@ public class State {
 
   public boolean DO_DEFINITE_REACH_ANALYSIS=false;
 
+  public boolean DISJOINT_COUNT_VISITS=false;
+
 
   public boolean OOOJAVA=false;
   public boolean OOODEBUG=false;
index 8ac20190f1b54a9400814f8f6daf6f1fff41b3b0..1277bafacd79f0528c14524338dbd81af4c33d02 100644 (file)
@@ -295,6 +295,10 @@ public class Main {
         state.DO_DEFINITE_REACH_ANALYSIS = true;
 
 
+      } else if( option.equals("-count-visits") ) {
+        state.DISJOINT_COUNT_VISITS = true;
+
+
       } else if (option.equals("-optional"))
         state.OPTIONAL=true;
       else if (option.equals("-optimize"))
index 4ea2b894da3c7f6cc4b4d7b8300cf5607f01ac84..b797433aeb4c6273c11c158c00fd693f48904e20 100755 (executable)
@@ -51,6 +51,7 @@ echo -disjoint-dvisit-pqueue use prio. q strat to visit descriptors
 echo -disjoint-desire-determinism set above interproc for determinism
 echo -disjoint-debug-scheduling debug when methods are scheduled for analysis
 echo -do-definite-reach-analysis enable improved precision for disjoint reachability analysis
+echo -count-visits for counting visits in the fixed point algorithm to evaluate convergence behavior
 echo
 echo -pointsto-check-v-runtime check allocation site of pointer targets at runtime to help verify heap analysis results
 echo