working on bugs, sharing file output updates
authorjjenista <jjenista>
Fri, 2 Apr 2010 22:02:31 +0000 (22:02 +0000)
committerjjenista <jjenista>
Fri, 2 Apr 2010 22:02:31 +0000 (22:02 +0000)
Robust/src/Analysis/Disjoint/AllocSite.java
Robust/src/Analysis/Disjoint/DisjointAnalysis.java
Robust/src/Analysis/Disjoint/HeapRegionNode.java
Robust/src/Analysis/Disjoint/ReachGraph.java
Robust/src/Benchmarks/disjoint/makefile
Robust/src/Main/Main.java

index 37b07b21b0691c8ad72b05bf6c55ffedd6001b9b..c0dcf3abf50f339a63f6799f0ab001147dd0395c 100644 (file)
@@ -43,20 +43,32 @@ public class AllocSite extends Canonical {
   protected Integer         summary;
   protected FlatNew         flatNew;
   protected String          disjointId;
-  protected boolean         flag;
+  protected boolean         isFlagged;
+
+
+  public static AllocSite factory( int     allocationDepth, 
+                                   FlatNew flatNew, 
+                                   String  disjointId
+                                   ) {
+    AllocSite out = new AllocSite( allocationDepth,
+                                   flatNew,
+                                   disjointId );
+    out = (AllocSite) Canonical.makeCanonical( out );
+    return out;
+  }
 
 
-  public AllocSite( int     allocationDepth, 
-                    FlatNew flatNew, 
-                    String  disjointId
-                    ) {
+  protected AllocSite( int     allocationDepth, 
+                       FlatNew flatNew, 
+                       String  disjointId
+                       ) {
 
     assert allocationDepth >= 1;
 
     this.allocationDepth = allocationDepth;
     this.flatNew         = flatNew;
     this.disjointId      = disjointId;
-    this.flag            = false;
+    this.isFlagged       = disjointId != null;
 
     ithOldest = new Vector<Integer>( allocationDepth );
     id        = generateUniqueAllocSiteID();
@@ -254,10 +266,10 @@ public class AllocSite extends Canonical {
   }
   
   public void setFlag( boolean flag ) {
-    this.flag = flag;
+    this.isFlagged = flag;
   }
   
   public boolean getFlag() {
-    return flag;
+    return isFlagged;
   }
 }
index 152ddd8090cefe6a3a4692946075d8ab34c3fe10..952d237736918eedc66ee9420cbd852fc1c3f6bf 100644 (file)
@@ -93,10 +93,10 @@ public class DisjointAnalysis {
                return out;
        }
        
-  // use the methods given above to check every possible alias
+  // use the methods given above to check every possible sharing class
   // between task parameters and flagged allocation sites reachable
   // from the task
-  public void writeAllAliases(String outputFile, 
+  public void writeAllSharing(String outputFile, 
                               String timeReport,
                               String justTime,
                               boolean tabularOutput,
@@ -113,9 +113,9 @@ public class DisjointAnalysis {
       bw.write(timeReport + "\n");
     }
 
-    int numAlias = 0;
+    int numSharing = 0;
 
-    // look through every task for potential aliases
+    // look through every task for potential sharing
     Iterator taskItr = state.getTaskSymbolTable().getDescriptorsIterator();
     while (taskItr.hasNext()) {
       TaskDescriptor td = (TaskDescriptor) taskItr.next();
@@ -128,10 +128,10 @@ public class DisjointAnalysis {
 
       Set<HeapRegionNode> common;
 
-      // for each task parameter, check for aliases with
+      // for each task parameter, check for sharing classes with
       // other task parameters and every allocation site
       // reachable from this task
-      boolean foundSomeAlias = false;
+      boolean foundSomeSharing = false;
 
       FlatMethod fm = state.getMethodFlat(td);
       for (int i = 0; i < fm.numParameters(); ++i) {
@@ -142,7 +142,7 @@ public class DisjointAnalysis {
           continue;
         }
                           
-        // for the ith parameter check for aliases to all
+        // for the ith parameter check for sharing classes to all
         // higher numbered parameters
         for (int j = i + 1; j < fm.numParameters(); ++j) {
 
@@ -155,18 +155,17 @@ public class DisjointAnalysis {
 
           common = hasPotentialSharing(td, i, j);
           if (!common.isEmpty()) {
-            foundSomeAlias = true;
+            foundSomeSharing = true;
+            ++numSharing;
             if (!tabularOutput) {
-              bw.write("Potential alias between parameters " + i
+              bw.write("Potential sharing between parameters " + i
                        + " and " + j + ".\n");
               bw.write(prettyPrintNodeSet(common) + "\n");
-            } else {
-              ++numAlias;
             }
           }
         }
 
-        // for the ith parameter, check for aliases against
+        // for the ith parameter, check for sharing classes against
         // the set of allocation sites reachable from this
         // task context
         Iterator allocItr = allocSites.iterator();
@@ -174,19 +173,18 @@ public class DisjointAnalysis {
           AllocSite as = (AllocSite) allocItr.next();
           common = hasPotentialSharing(td, i, as);
           if (!common.isEmpty()) {
-            foundSomeAlias = true;
+            foundSomeSharing = true;
+            ++numSharing;
             if (!tabularOutput) {
-              bw.write("Potential alias between parameter " + i
+              bw.write("Potential sharing between parameter " + i
                        + " and " + as.getFlatNew() + ".\n");
               bw.write(prettyPrintNodeSet(common) + "\n");
-            } else {
-              ++numAlias;
             }
           }
         }
       }
 
-      // for each allocation site check for aliases with
+      // for each allocation site check for sharing classes with
       // other allocation sites in the context of execution
       // of this task
       HashSet<AllocSite> outerChecked = new HashSet<AllocSite>();
@@ -202,14 +200,13 @@ public class DisjointAnalysis {
             common = hasPotentialSharing(td, as1, as2);
 
             if (!common.isEmpty()) {
-              foundSomeAlias = true;
+              foundSomeSharing = true;
+              ++numSharing;
               if (!tabularOutput) {
-                bw.write("Potential alias between "
+                bw.write("Potential sharing between "
                          + as1.getFlatNew() + " and "
                          + as2.getFlatNew() + ".\n");
                 bw.write(prettyPrintNodeSet(common) + "\n");
-              } else {
-                ++numAlias;
               }
             }
           }
@@ -218,9 +215,9 @@ public class DisjointAnalysis {
         outerChecked.add(as1);
       }
 
-      if (!foundSomeAlias) {
+      if (!foundSomeSharing) {
         if (!tabularOutput) {
-          bw.write("No aliases between flagged objects in Task " + td
+          bw.write("No sharing between flagged objects in Task " + td
                    + ".\n");
         }
       }
@@ -228,15 +225,17 @@ public class DisjointAnalysis {
 
                
     if (tabularOutput) {
-      bw.write(" & " + numAlias + " & " + justTime + " & " + numLines
+      bw.write(" & " + numSharing + " & " + justTime + " & " + numLines
                + " & " + numMethodsAnalyzed() + " \\\\\n");
-    }          
+    } else {
+      bw.write("\nNumber sharing classes: "+numSharing);
+    }
 
     bw.close();
   }
        
-  // this version of writeAllAliases is for Java programs that have no tasks
-  public void writeAllAliasesJava(String outputFile, 
+  // this version of writeAllSharing is for Java programs that have no tasks
+  public void writeAllSharingJava(String outputFile, 
                                   String timeReport,
                                   String justTime,
                                   boolean tabularOutput,
@@ -247,18 +246,20 @@ public class DisjointAnalysis {
 
     assert !state.TASK;
 
+    int numSharing = 0;
+
     BufferedWriter bw = new BufferedWriter(new FileWriter(outputFile));
     
     bw.write("Conducting disjoint reachability analysis with allocation depth = "
              + allocationDepth + "\n");
     bw.write(timeReport + "\n\n");
 
-    boolean foundSomeAlias = false;
+    boolean foundSomeSharing = false;
 
     Descriptor d = typeUtil.getMain();
     HashSet<AllocSite> allocSites = getFlaggedAllocationSites(d);
 
-    // for each allocation site check for aliases with
+    // for each allocation site check for sharing classes with
     // other allocation sites in the context of execution
     // of this task
     HashSet<AllocSite> outerChecked = new HashSet<AllocSite>();
@@ -275,11 +276,12 @@ public class DisjointAnalysis {
                                                            as1, as2);
 
           if (!common.isEmpty()) {
-            foundSomeAlias = true;
-            bw.write("Potential alias between "
+            foundSomeSharing = true;
+            bw.write("Potential sharing between "
                      + as1.getDisjointAnalysisId() + " and "
                      + as2.getDisjointAnalysisId() + ".\n");
             bw.write(prettyPrintNodeSet(common) + "\n");
+            ++numSharing;
           }
         }
       }
@@ -287,8 +289,10 @@ public class DisjointAnalysis {
       outerChecked.add(as1);
     }
 
-    if (!foundSomeAlias) {
-      bw.write("No aliases between flagged objects found.\n");
+    if (!foundSomeSharing) {
+      bw.write("No sharing classes between flagged objects found.\n");
+    } else {
+      bw.write("\nNumber sharing classes: "+numSharing);
     }
 
     bw.write("Number of methods analyzed: "+numMethodsAnalyzed()+"\n");
@@ -422,7 +426,7 @@ public class DisjointAnalysis {
   // nodes as back edge's in future implementations
   protected Hashtable<FlatNode, ReachGraph>
     mapBackEdgeToMonotone;
-  
+
 
   public static final String arrayElementFieldName = "___element_";
   static protected Hashtable<TypeDescriptor, FieldDescriptor>
@@ -578,9 +582,9 @@ public class DisjointAnalysis {
 
     if( state.DISJOINTALIASFILE != null ) {
       if( state.TASK ) {
-        writeAllAliases(state.DISJOINTALIASFILE, treport, justtime, state.DISJOINTALIASTAB, state.lines);
+        writeAllSharing(state.DISJOINTALIASFILE, treport, justtime, state.DISJOINTALIASTAB, state.lines);
       } else {
-        writeAllAliasesJava(state.DISJOINTALIASFILE, 
+        writeAllSharingJava(state.DISJOINTALIASFILE, 
                             treport, 
                             justtime, 
                             state.DISJOINTALIASTAB, 
@@ -1498,10 +1502,15 @@ public class DisjointAnalysis {
     heapsFromCallers.put( fc, rg );
   }
 
-private AllocSite createParameterAllocSite(ReachGraph rg, TempDescriptor tempDesc) {
+  private AllocSite createParameterAllocSite( ReachGraph     rg, 
+                                              TempDescriptor tempDesc
+                                              ) {
     
-    // create temp descriptor for each parameter variable
-    FlatNew flatNew = new FlatNew(tempDesc.getType(), tempDesc, false);
+    FlatNew flatNew = new FlatNew( tempDesc.getType(), // type
+                                   tempDesc,           // param temp
+                                   false,              // global alloc?
+                                   "param"+tempDesc    // disjoint site ID string
+                                   );
     // create allocation site
     AllocSite as = (AllocSite) Canonical.makeCanonical(new AllocSite( allocationDepth, flatNew, flatNew.getDisjointId()));
     for (int i = 0; i < allocationDepth; ++i) {
@@ -1516,7 +1525,7 @@ private AllocSite createParameterAllocSite(ReachGraph rg, TempDescriptor tempDes
     
     return as;
     
-}
+  }
 
 private Set<FieldDescriptor> getFieldSetTobeAnalyzed(TypeDescriptor typeDesc){
        
index 05a51adef7d6eac400960a6bba715791cf87ed57..1a2cab1dde4202109502541e006d0dd8c8ff2a3d 100644 (file)
@@ -117,6 +117,12 @@ public class HeapRegionNode extends RefSrcNode {
     }
 
     assert isSingleObject == hrn.isSingleObject();
+
+    if( isFlagged != hrn.isFlagged ) {
+      System.out.println( this.toStringDOT(true)+"\ndoesn't match\n"+hrn.toStringDOT(true) );
+      //throw new Exception("flagged regions don't match");
+    }
+
     assert isFlagged      == hrn.isFlagged();
     assert isNewSummary   == hrn.isNewSummary();
     assert isOutOfContext == hrn.isOutOfContext();
index 3645338efa767b43e96fd1a3ab2c78c870c483e3..2ff8e0c8376ac40fd8e54533c52167835578ff9c 100644 (file)
@@ -116,6 +116,15 @@ public class ReachGraph {
       markForAnalysis = true;
     }
 
+
+    if( allocSite == null ) {
+      assert !markForAnalysis;
+
+    } else if( markForAnalysis != allocSite.getFlag() ) {
+      assert false;
+    }
+
+
     if( id == null ) {
       id = DisjointAnalysis.generateUniqueHeapRegionNodeID();
     }
@@ -795,7 +804,7 @@ public class ReachGraph {
       }
       
       if( as.getFlag() ){
-        hasFlags = as.getFlag();
+        hasFlags = true;
       }
 
       String strDesc = as.toStringForDOT()+"\\nsummary";
@@ -840,7 +849,7 @@ public class ReachGraph {
       }
       
       if( as.getFlag() ){
-        hasFlags = as.getFlag();
+        hasFlags = true;
       }
 
       String strDesc = as.toStringForDOT()+"\\n"+i+" oldest";
@@ -3423,6 +3432,17 @@ public class ReachGraph {
                                        hrnA.getPreds()
                                        )
                        );
+
+
+
+        if( !hrnA.equals( hrnB ) ) {
+          rg.writeGraph( "graphA" );
+          this.writeGraph( "graphB" );
+          throw new Error( "flagged not matching" );
+        }
+
+
+
       }
     }
 
index 39ec62e50edf03f98eecd011132d3140c0e2b886..9265730d6d40ebd1c23da67847cc3f1560ba0c20 100644 (file)
@@ -8,7 +8,7 @@ BUILDSCRIPT=~/research/Robust/src/buildscript
 ##
 #################################################
 #DEBUGFLAGS= -disjoint-debug-callsite setClusters innerKMeansSetting 20
-DEBUGFLAGS= -disjoint-debug-callsite ensureCapacity addElement 100
+#DEBUGFLAGS= -disjoint-debug-callsite ensureCapacity addElement 100
 
 
 #################################################
@@ -46,6 +46,13 @@ all:
 bamboo:
        $(BUILDSCRIPT) $(BAMBOOFLAGS) $(DEBUGMODE)   $(VISITMODE) $(BSFLAGS) $(DEBUGFLAGS) $(SNAPFLAGS) *.java
 
+bamboo-s:
+       $(BUILDSCRIPT) $(BAMBOOFLAGS) $(DEBUGMODE) -disjoint-dvisit-stack  $(BSFLAGS) $(DEBUGFLAGS) $(SNAPFLAGS) *.java
+
+bamboo-q:
+       $(BUILDSCRIPT) $(BAMBOOFLAGS) $(DEBUGMODE) -disjoint-dvisit-pqueue $(BSFLAGS) $(DEBUGFLAGS) $(SNAPFLAGS) *.java
+
+
 bamboo-release:
        $(BUILDSCRIPT) $(BAMBOOFLAGS) $(RELEASEMODE) $(VISITMODE) $(BSFLAGS) $(DEBUGFLAGS) $(SNAPFLAGS) *.java
 
index d7f6175c4939792e70b604ec5f7b8f040afd9c1f..7dee49c0cf83c8e9a3f9fec0877f44709b36b85d 100644 (file)
@@ -222,9 +222,11 @@ public class Main {
 
       } else if( option.equals( "-disjoint-dvisit-stack" ) ) {
         state.DISJOINTDVISITSTACK = true;      
+        state.DISJOINTDVISITPQUE  = false;
 
       } else if( option.equals( "-disjoint-dvisit-pqueue" ) ) {
-        state.DISJOINTDVISITPQUE = true;
+        state.DISJOINTDVISITPQUE  = true;
+        state.DISJOINTDVISITSTACK = false;      
       }