cpaturing some makefile updates and have OoOJava print number of sites disjoint reach...
[IRC.git] / Robust / src / Analysis / Disjoint / DisjointAnalysis.java
index 8a7e763e6f91f68319d678cf9bc9255f4b36d76b..129bffd2ddafff07ed8f643d16c9c1ecb83dde25 100644 (file)
@@ -273,8 +273,15 @@ public class DisjointAnalysis {
 
     bw.close();
   }
+
+
        
   // this version of writeAllSharing is for Java programs that have no tasks
+  // ***********************************
+  // WARNING: THIS DOES NOT DO THE RIGHT THING, REPORTS 0 ALWAYS!
+  // It should use mayBothReachTarget and mayManyReachTarget like
+  // OoOJava does to query analysis results
+  // ***********************************
   public void writeAllSharingJava(String outputFile, 
                                   String timeReport,
                                   String justTime,
@@ -612,7 +619,20 @@ public class DisjointAnalysis {
                            RBlockRelationAnalysis rra,
                            RBlockStatusAnalysis rsa
                            ) {
-    init( s, tu, cg, l, ar, sitesToFlag, rra, rsa );
+    init( s, tu, cg, l, ar, sitesToFlag, rra, rsa, false );
+  }
+
+  public DisjointAnalysis( State            s,
+                          TypeUtil         tu,
+                          CallGraph        cg,
+                          Liveness         l,
+                          ArrayReferencees ar,
+                           Set<FlatNew> sitesToFlag,
+                           RBlockRelationAnalysis rra,
+                           RBlockStatusAnalysis rsa,
+                           boolean suppressOutput
+                           ) {
+    init( s, tu, cg, l, ar, sitesToFlag, rra, rsa, suppressOutput );
   }
   
   protected void init( State            state,
@@ -622,7 +642,8 @@ public class DisjointAnalysis {
                        ArrayReferencees arrayReferencees,
                        Set<FlatNew> sitesToFlag,
                        RBlockRelationAnalysis rra,
-                       RBlockStatusAnalysis rsa
+                       RBlockStatusAnalysis rsa,
+                       boolean suppressOutput
                        ) {
          
     analysisComplete = false;
@@ -645,8 +666,8 @@ public class DisjointAnalysis {
     this.releaseMode             = state.DISJOINTRELEASEMODE;
     this.determinismDesired      = state.DISJOINTDETERMINISM;
 
-    this.writeFinalDOTs          = state.DISJOINTWRITEDOTS && !state.DISJOINTWRITEALL;
-    this.writeAllIncrementalDOTs = state.DISJOINTWRITEDOTS &&  state.DISJOINTWRITEALL;
+    this.writeFinalDOTs          = state.DISJOINTWRITEDOTS && !state.DISJOINTWRITEALL && !suppressOutput;
+    this.writeAllIncrementalDOTs = state.DISJOINTWRITEDOTS &&  state.DISJOINTWRITEALL && !suppressOutput;
 
     this.takeDebugSnapshots      = state.DISJOINTSNAPSYMBOL != null;
     this.descSymbolDebug         = state.DISJOINTSNAPSYMBOL;
@@ -695,26 +716,34 @@ public class DisjointAnalysis {
 
     analysisComplete=true;
 
+
     double timeEndAnalysis = (double) System.nanoTime();
     double dt = (timeEndAnalysis - timeStartAnalysis)/(Math.pow( 10.0, 9.0 ) );
-    String treport = String.format( "The reachability analysis took %.3f sec.", dt );
+
+    String treport;
+    if( sitesToFlag != null ) {
+      treport = String.format( "Disjoint reachability analysis flagged %d sites and took %.3f sec.", sitesToFlag.size(), dt );
+    } else {
+      treport = String.format( "Disjoint reachability analysis took %.3f sec.", dt );
+    }
     String justtime = String.format( "%.2f", dt );
     System.out.println( treport );
 
+
     try {
       if( writeFinalDOTs && !writeAllIncrementalDOTs ) {
         writeFinalGraphs();      
       }
 
-      if( state.DISJOINTWRITEIHMS ) {
+      if( state.DISJOINTWRITEIHMS && !suppressOutput ) {
         writeFinalIHMs();
       }
 
-      if( state.DISJOINTWRITEINITCONTEXTS ) {
+      if( state.DISJOINTWRITEINITCONTEXTS && !suppressOutput ) {
         writeInitialContexts();
       }
 
-      if( state.DISJOINTALIASFILE != null ) {
+      if( state.DISJOINTALIASFILE != null && !suppressOutput ) {
         if( state.TASK ) {
           writeAllSharing(state.DISJOINTALIASFILE, treport, justtime, state.DISJOINTALIASTAB, state.lines);
         } else {
@@ -730,9 +759,6 @@ public class DisjointAnalysis {
       throw new Error( "IO Exception while writing disjointness analysis output." );
     }
 
-    if( doEffectsAnalysis ) {
-      effectsAnalysis.writeEffects( "effects.txt" );
-    }
   }
 
 
@@ -1352,7 +1378,8 @@ public class DisjointAnalysis {
         rg.removeAllStallSiteTaints();
 
         // inject taints for in-set vars      
-        rg.taintInSetVars( sese );                         
+        rg.taintInSetVars( sese );
+
       }
       break;
 
@@ -1385,8 +1412,7 @@ public class DisjointAnalysis {
       FlatCall         fc       = (FlatCall) fn;
       MethodDescriptor mdCallee = fc.getMethod();
       FlatMethod       fmCallee = state.getMethodFlat( mdCallee );
-
-
+  
       boolean debugCallSite =
         mdCaller.getSymbol().equals( state.DISJOINTDEBUGCALLER ) &&
         mdCallee.getSymbol().equals( state.DISJOINTDEBUGCALLEE );
@@ -2464,6 +2490,10 @@ getFlaggedAllocationSitesReachableFromTaskPRIVATE(TaskDescriptor td) {
     return effectsAnalysis;
   }
   
+  public ReachGraph getReachGraph(Descriptor d){
+    return mapDescriptorToCompleteReachGraph.get(d);
+  }
+  
   
   // get successive captures of the analysis state, use compiler
   // flags to control