bug fixes
authorjjenista <jjenista>
Thu, 25 Mar 2010 01:26:34 +0000 (01:26 +0000)
committerjjenista <jjenista>
Thu, 25 Mar 2010 01:26:34 +0000 (01:26 +0000)
Robust/src/Analysis/Disjoint/AllocSite.java
Robust/src/Analysis/Disjoint/DisjointAnalysis.java
Robust/src/Analysis/Disjoint/ExistPredSet.java
Robust/src/Analysis/Disjoint/ReachGraph.java
Robust/src/Benchmarks/Ownership/makefile
Robust/src/Benchmarks/disjoint/makefile

index c890f372591547947d28c8af0fa1026a2ddfe6ab..ee97eb522ca3e0ee9be9917e9210e6bf352de1c0 100644 (file)
@@ -227,7 +227,7 @@ public class AllocSite extends Canonical {
   }
 
   public String toStringWithIDs() {
-    String s = "allocSite ";
+    String s = "allocSite"+id+" ";
     for( int i = 0; i < ithOldest.size(); ++i ) {
       s += i+"("+ithOldest.get( i )+") ";
     }
index d8faa20cbf7a1d344fa5320500f44809b370208b..aac392edc292482c69be9cf192b189fd6768ab20 100644 (file)
@@ -1124,7 +1124,7 @@ public class DisjointAnalysis {
       rg.writeGraph( d+"COMPLETE"+String.format( "%05d", n ),
                      true,   // write labels (variables)
                      true,   // selectively hide intermediate temp vars
-                     true,   // prune unreachable heap regions
+                     false,  // prune unreachable heap regions
                      false,  // hide subset reachability states
                      true ); // hide edge taints
       
@@ -1894,7 +1894,7 @@ getFlaggedAllocationSitesReachableFromTaskPRIVATE(TaskDescriptor td) {
       rg.writeGraph( graphName,
                      true,  // write labels (variables)
                      true,  // selectively hide intermediate temp vars
-                     true,  // prune unreachable heap regions
+                     false, // prune unreachable heap regions
                      false, // hide subset reachability states
                      true );// hide edge taints
     }
index 5f3757e40cfee5cd510344e6523970deb3a57557..3d9ae6bee3a70892546f376f694342ffb90938b0 100644 (file)
@@ -84,6 +84,11 @@ public class ExistPredSet extends Canonical {
   }
 
 
+  public boolean isEmpty() {
+    return preds.isEmpty();
+  }
+
+
   public boolean equals( Object o ) {
     if( o == null ) {
       return false;
index 9adbdad45f44a89554b5a4ba24adb7aacd4462ef..d1259c1487c46d1555c8c370b5ed5c5f678b987b 100644 (file)
@@ -79,6 +79,8 @@ public class ReachGraph {
     return this.id2hrn.get( hrn.getID() ) == hrn;
   }
 
+  
+
 
 
   // the reason for this method is to have the option
@@ -140,7 +142,7 @@ public class ReachGraph {
     }
 
     assert preds != null;
-    
+
     HeapRegionNode hrn = new HeapRegionNode( id,
                                             isSingleObject,
                                             markForAnalysis,
@@ -1911,11 +1913,12 @@ public class ReachGraph {
   // useful since many graphs writes in the method call debug code
   private static boolean resolveMethodDebugDOTwriteLabels     = true;
   private static boolean resolveMethodDebugDOTselectTemps     = true;
-  private static boolean resolveMethodDebugDOTpruneGarbage    = true;
+  private static boolean resolveMethodDebugDOTpruneGarbage    = false;
   private static boolean resolveMethodDebugDOThideSubsetReach = false;
   private static boolean resolveMethodDebugDOThideEdgeTaints  = true;
 
   static String debugGraphPrefix;
+  static int debugCallSiteVisits = 0;
   static int debugCallSiteVisitsUntilExit = 0;
   
 
@@ -1928,7 +1931,7 @@ public class ReachGraph {
                        ) {
 
     if( writeDebugDOTs ) {
-      debugGraphPrefix = String.format( "call%02d", debugCallSiteVisitsUntilExit );
+      debugGraphPrefix = String.format( "call%02d", debugCallSiteVisits );
       
       rgCallee.writeGraph( debugGraphPrefix+"callee", 
                            resolveMethodDebugDOTwriteLabels,    
@@ -1947,6 +1950,7 @@ public class ReachGraph {
     }
 
 
+
     // method call transfer function steps:
     // 1. Use current callee-reachable heap (CRH) to test callee 
     //    predicates and mark what will be coming in.
@@ -2033,7 +2037,21 @@ public class ReachGraph {
         HeapRegionNode hrnSrcCallee = (HeapRegionNode) rsnCallee;
         boolean matchedOutOfContext = false;
 
-        if( hrnSrcCallee.isOutOfContext() ) {          
+        if( !hrnSrcCallee.isOutOfContext() ) {          
+
+          predsIfSatis = 
+            hrnSrcCallee.getPreds().isSatisfiedBy( this,
+                                                   callerNodeIDsCopiedToCallee
+                                                   );          
+          if( predsIfSatis != null ) {
+            calleeNodesSatisfied.put( hrnSrcCallee, predsIfSatis );
+          } else {
+            // otherwise forget this edge
+            continue;
+          }          
+      
+        } else {
+          // hrnSrcCallee is out-of-context
 
           assert !calleeEdges2oocCallerSrcMatches.containsKey( reCallee );
 
@@ -2309,6 +2327,13 @@ public class ReachGraph {
       Set<RefSrcNode> oocCallers = 
         calleeEdges2oocCallerSrcMatches.get( reCallee );
 
+      if( rsnCallee instanceof HeapRegionNode ) {
+        HeapRegionNode hrnCalleeSrc = (HeapRegionNode) rsnCallee;
+        if( hrnCalleeSrc.isOutOfContext() ) {
+          assert oocCallers != null;
+        }
+      }
+
       
       if( oocCallers == null ) {
         // there are no out-of-context matches, so it's
@@ -2331,6 +2356,7 @@ public class ReachGraph {
 
         } else {
           // otherwise source is in context, one region
+          
           HeapRegionNode hrnSrcCallee = (HeapRegionNode) rsnCallee;
 
           // translate an in-context node to shadow
@@ -2343,23 +2369,7 @@ public class ReachGraph {
           HeapRegionNode hrnSrcCallerShadow =
             this.id2hrn.get( hrnIDSrcShadow );
           
-          if( hrnSrcCallerShadow == null ) {
-            hrnSrcCallerShadow =
-              createNewHeapRegionNode( hrnIDSrcShadow,                // id or null to generate a new one 
-                                       hrnSrcCallee.isSingleObject(), // single object?                 
-                                       hrnSrcCallee.isNewSummary(),   // summary?       
-                                       hrnSrcCallee.isFlagged(),      // flagged?
-                                       false,                         // out-of-context?
-                                       hrnSrcCallee.getType(),        // type                           
-                                       hrnSrcCallee.getAllocSite(),   // allocation site                        
-                                       toCallerContext( hrnSrcCallee.getInherent(),
-                                                        calleeStatesSatisfied ),    // inherent reach
-                                       toCallerContext( hrnSrcCallee.getAlpha(),
-                                                        calleeStatesSatisfied ),       // current reach                 
-                                       predsEmpty,                    // predicates
-                                       hrnSrcCallee.getDescription()  // description
-                                       );                                        
-          }
+          assert hrnSrcCallerShadow != null;        
           
           rsnCallers.add( hrnSrcCallerShadow );
         }
@@ -2725,8 +2735,8 @@ public class ReachGraph {
                   resolveMethodDebugDOThideSubsetReach,
                   resolveMethodDebugDOThideEdgeTaints );
 
-      --debugCallSiteVisitsUntilExit;
-      if( debugCallSiteVisitsUntilExit <= 0 ) {
+      ++debugCallSiteVisits;
+      if( debugCallSiteVisits >= debugCallSiteVisitsUntilExit ) {
         System.out.println( "!!! Exiting after requested visits to call site. !!!" );
         System.exit( 0 );
       }
@@ -3091,14 +3101,11 @@ public class ReachGraph {
               B = boldBooc.get( rtOld.getHrnID() ); 
             } else {
 
-
               if( !id2hrn.containsKey( rtOld.getHrnID() ) ) {
-                System.out.println( "\nLooking for "+rtOld );
-                writeGraph( "dbgz" );
+                // let symbols not in the graph get pruned
+                break;
               }
 
-
-              assert id2hrn.containsKey( rtOld.getHrnID() );
               B = boldBic.get( rtOld.getHrnID() ); 
             }
 
@@ -3272,6 +3279,63 @@ public class ReachGraph {
   }  
 
 
+  // a useful assertion for debugging:
+  // every in-context tuple on any edge or
+  // any node should name a node that is
+  // part of the graph
+  public boolean inContextTuplesInGraph() {
+    Iterator hrnItr = id2hrn.entrySet().iterator();
+    while( hrnItr.hasNext() ) {
+      Map.Entry      me  = (Map.Entry)      hrnItr.next();
+      HeapRegionNode hrn = (HeapRegionNode) me.getValue();
+
+      {
+        Iterator<ReachState> stateItr = hrn.getAlpha().iterator();
+        while( stateItr.hasNext() ) {
+          ReachState state = stateItr.next();
+          
+          Iterator<ReachTuple> rtItr = state.iterator();
+          while( rtItr.hasNext() ) {
+            ReachTuple rt = rtItr.next();
+            
+            if( !rt.isOutOfContext() ) {
+              if( !id2hrn.containsKey( rt.getHrnID() ) ) {
+                System.out.println( rt.getHrnID()+" is missing" );
+                return false;
+              }
+            }
+          }
+        }
+      }
+
+      Iterator<RefEdge> edgeItr = hrn.iteratorToReferencers();
+      while( edgeItr.hasNext() ) {
+        RefEdge edge = edgeItr.next();
+
+        Iterator<ReachState> stateItr = edge.getBeta().iterator();
+        while( stateItr.hasNext() ) {
+          ReachState state = stateItr.next();
+        
+          Iterator<ReachTuple> rtItr = state.iterator();
+          while( rtItr.hasNext() ) {
+            ReachTuple rt = rtItr.next();
+            
+            if( !rt.isOutOfContext() ) {
+              if( !id2hrn.containsKey( rt.getHrnID() ) ) {
+                System.out.println( rt.getHrnID()+" is missing" );
+                return false;
+              }
+            }
+          }
+        }
+      }
+    }
+
+    return true;
+  }
+
+
+
 
   ////////////////////////////////////////////////////
   // high-level merge operations
index 0efaf50e9ea8696f0bc5133d008950244e83398e..0a4bf1e7c57e4be4775b1a9dc7c51ff39814bcbb 100644 (file)
@@ -1,5 +1,6 @@
 BUILDSCRIPT=~/research/Robust/src/buildscript
-BSFLAGS= -recover -justanalyze -ownership -ownaliasfiletab aliases.txt -enable-assertions #-ownwritedots final #-flatirtasks
+#BSFLAGS= -recover -justanalyze -ownership -ownaliasfiletab aliases.txt -enable-assertions #-ownwritedots final #-flatirtasks
+BSFLAGS= -recover -justanalyze -ownership -ownaliasfile aliases.txt -enable-assertions #-ownwritedots final #-flatirtasks
 AD1= -ownallocdepth 1
 AD3= -ownallocdepth 3
 AD5= -ownallocdepth 5
index ba99f112368c461628fca5b0afd98fb3b9dded19..5d223bfaebca799a1bf6f60a5a22385922d3cbe8 100644 (file)
@@ -3,11 +3,14 @@ BUILDSCRIPT=~/research/Robust/src/buildscript
 #DEBUGFLAGS= -disjoint-debug-callsite MDRunner t3 100
 #DEBUGFLAGS= -disjoint-debug-callsite calcGoodFeature calcGoodFeatureTask 100
 #DEBUGFLAGS= -disjoint-debug-callsite getRows calcGoodFeature 4
+#DEBUGFLAGS= -disjoint-debug-callsite setKMeans t3 500
 
 #SNAPFLAGS= -disjoint-debug-snap-method calcGoodFeatureTask 5 10 true
 #SNAPFLAGS= -disjoint-debug-snap-method calcGoodFeature 5 1 true
 
-BSFLAGS= -recover -justanalyze -disjoint -disjoint-k 1 -disjoint-write-dots final -disjoint-alias-file aliases.txt normal -enable-assertions
+#SNAPFLAGS= -disjoint-debug-snap-method t3 5 20 true
+
+BSFLAGS= -recover -justanalyze -disjoint -disjoint-k 1 -disjoint-write-dots all -disjoint-alias-file aliases.txt normal -enable-assertions
 
 all:
        $(BUILDSCRIPT) $(BSFLAGS) $(DEBUGFLAGS) $(SNAPFLAGS) *.java