fixed a bug where retrieving the context contribution of a call site returns an empty...
authorjjenista <jjenista>
Wed, 14 Apr 2010 20:13:30 +0000 (20:13 +0000)
committerjjenista <jjenista>
Wed, 14 Apr 2010 20:13:30 +0000 (20:13 +0000)
Robust/src/Analysis/Disjoint/DisjointAnalysis.java
Robust/src/Benchmarks/disjoint/makefile
Robust/src/IR/State.java
Robust/src/Main/Main.java

index 49aebc74717d66b2156e2f2a8a22d927e4caf72f..20bbfdaa361050a00249cd7f6f4717e08aa3bbf2 100644 (file)
@@ -320,6 +320,13 @@ public class DisjointAnalysis {
   // should attempt to be deterministic
   public static boolean determinismDesired;
 
+  // when we want to enforce determinism in the 
+  // analysis we need to sort descriptors rather
+  // than toss them in efficient sets, use this
+  public static DescriptorComparator dComp =
+    new DescriptorComparator();
+
+
   // data from the compiler
   public State            state;
   public CallGraph        callGraph;
@@ -329,7 +336,8 @@ public class DisjointAnalysis {
   public int              allocationDepth;
   
   // data structure for public interface
-  private Hashtable<Descriptor,    HashSet<AllocSite> > mapDescriptorToAllocSiteSet;
+  private Hashtable< Descriptor, HashSet<AllocSite> > 
+    mapDescriptorToAllocSiteSet;
 
   
   // for public interface methods to warn that they
@@ -468,9 +476,7 @@ public class DisjointAnalysis {
     
     if( determinismDesired ) {
       // use an ordered set
-      descriptorsToAnalyze 
-        = new TreeSet<Descriptor>( new DescriptorComparator() );
-      
+      descriptorsToAnalyze = new TreeSet<Descriptor>( dComp );      
     } else {
       // otherwise use a speedy hashset
       descriptorsToAnalyze = new HashSet<Descriptor>();
@@ -623,6 +629,10 @@ public class DisjointAnalysis {
       writeFinalIHMs();
     }
 
+    if( state.DISJOINTWRITEINITCONTEXTS ) {
+      writeInitialContexts();
+    }
+
     if( state.DISJOINTALIASFILE != null ) {
       if( state.TASK ) {
         writeAllSharing(state.DISJOINTALIASFILE, treport, justtime, state.DISJOINTALIASTAB, state.lines);
@@ -794,18 +804,10 @@ public class DisjointAnalysis {
 
         if( state.DISJOINTDVISITSTACKEESONTOP ) {
 
-          if( state.DISJOINTDEBUGSCHEDULING ) {
-            System.out.println( "  contexts changed, scheduling callees for analysis:" );
-          }
-
           depsItr = calleesToEnqueue.iterator();
           while( depsItr.hasNext() ) {
             Descriptor dNext = depsItr.next();
             enqueue( dNext );
-
-            if( state.DISJOINTDEBUGSCHEDULING ) {
-              System.out.println( "    "+dNext );
-            }
           }
           calleesToEnqueue.clear();
         }
@@ -1012,6 +1014,7 @@ public class DisjointAnalysis {
         rg.merge( rgContrib );
       }
 
+
       // additionally, we are enforcing STRICT MONOTONICITY for the
       // method's initial context, so grow the context by whatever
       // the previously computed context was, and put the most
@@ -1179,15 +1182,14 @@ public class DisjointAnalysis {
         // and reschedule the callee for analysis
         addIHMcontribution( mdCallee, fc, heapForThisCall_cur );        
 
+        if( state.DISJOINTDEBUGSCHEDULING ) {
+          System.out.println( "  context changed, scheduling callee: "+mdCallee );
+        }
+
         if( state.DISJOINTDVISITSTACKEESONTOP ) {
           calleesToEnqueue.add( mdCallee );
         } else {
           enqueue( mdCallee );
-
-          if( state.DISJOINTDEBUGSCHEDULING ) {
-            System.out.println( "  context changed, scheduling callee: "+mdCallee );
-          }
-
         }
 
       }
@@ -1197,8 +1199,14 @@ public class DisjointAnalysis {
       // current heap abstraction with any effects from the callee,
       // or if the method is virtual, the effects from any possible
       // callees, so find the set of callees...
-      Set<MethodDescriptor> setPossibleCallees =
-        new HashSet<MethodDescriptor>();
+      Set<MethodDescriptor> setPossibleCallees;
+      if( determinismDesired ) {
+        // use an ordered set
+        setPossibleCallees = new TreeSet<MethodDescriptor>( dComp );        
+      } else {
+        // otherwise use a speedy hashset
+        setPossibleCallees = new HashSet<MethodDescriptor>();
+      }
 
       if( mdCallee.isStatic() ) {        
         setPossibleCallees.add( mdCallee );
@@ -1234,11 +1242,12 @@ public class DisjointAnalysis {
             calleesToEnqueue.add( mdPossible );
           } else {
             enqueue( mdPossible );
-
-            if( state.DISJOINTDEBUGSCHEDULING ) {
-              System.out.println( "  callee hasn't been analyzed, scheduling: "+mdPossible );
-            }
           }
+          
+          if( state.DISJOINTDEBUGSCHEDULING ) {
+            System.out.println( "  callee hasn't been analyzed, scheduling: "+mdPossible );
+          }
+
 
         } else {
           rgCopy.resolveMethodCall( fc, 
@@ -1364,6 +1373,23 @@ public class DisjointAnalysis {
       }
     }
   }
+
+  private void writeInitialContexts() {
+    Set entrySet = mapDescriptorToInitialContext.entrySet();
+    Iterator itr = entrySet.iterator();
+    while( itr.hasNext() ) {
+      Map.Entry  me = (Map.Entry)  itr.next();
+      Descriptor  d = (Descriptor) me.getKey();
+      ReachGraph rg = (ReachGraph) me.getValue();
+
+      rg.writeGraph( "INITIAL"+d,
+                     true,   // write labels (variables)                
+                     true,   // selectively hide intermediate temp vars 
+                     true,   // prune unreachable heap regions          
+                     false,  // hide subset reachability states         
+                     true ); // hide edge taints                        
+    }
+  }
    
 
   protected ReachGraph getPartial( Descriptor d ) {
@@ -1505,9 +1531,7 @@ public class DisjointAnalysis {
 
     if( determinismDesired ) {
       // use an ordered set
-      discovered
-        = new TreeSet<Descriptor>( new DescriptorComparator() );
-      
+      discovered = new TreeSet<Descriptor>( dComp );      
     } else {
       // otherwise use a speedy hashset
       discovered = new HashSet<Descriptor>();
@@ -1644,7 +1668,7 @@ public class DisjointAnalysis {
       getIHMcontributions( d );
 
     if( !heapsFromCallers.containsKey( fc ) ) {
-      heapsFromCallers.put( fc, new ReachGraph() );
+      return null;
     }
 
     return heapsFromCallers.get( fc );
index fc58a8261fb6ced5560c9ed6ce991fcf5a0c0aa5..9e4f5dae61a6d76666c80b11a27e7f1c2f9bac9a 100644 (file)
@@ -18,6 +18,8 @@ BUILDSCRIPT=~/research/Robust/src/buildscript
 
 #DEBUGFLAGS= -disjoint-debug-callsite setPartial reduceOutput 1 20 false
 
+#DEBUGFLAGS= -disjoint-debug-callsite close Transaction 1 20 false
+
 
 #################################################
 ##
@@ -42,6 +44,9 @@ BUILDSCRIPT=~/research/Robust/src/buildscript
 #SNAPFLAGS= -disjoint-debug-snap-method setReduceFinish 5 50 true
 #SNAPFLAGS= -disjoint-debug-snap-method setPartial 1 50 true
 
+#SNAPFLAGS= -disjoint-debug-snap-method Transaction 1 20 true
+#SNAPFLAGS= -disjoint-debug-snap-method close 1 20 true
+
 
 
 
@@ -52,10 +57,10 @@ JAVAFLAGS= -mainclass test
 #VISITMODE= -disjoint-dvisit-pqueue
 VISITMODE= -disjoint-dvisit-stack-callees-on-top
 
-DEBUGMODE= -enable-assertions -disjoint-write-dots final -disjoint-alias-file aliases.txt normal -disjoint-desire-determinism
+DEBUGMODE= -enable-assertions -disjoint-write-dots final -disjoint-write-ihms -disjoint-write-initial-contexts -disjoint-alias-file aliases.txt normal -disjoint-desire-determinism #-disjoint-debug-scheduling
 RELEASEMODE= -disjoint-release-mode -disjoint-alias-file aliases.txt tabbed
 
-BSFLAGS= -justanalyze -disjoint -disjoint-k 1 -flatirusermethods -flatirtasks
+BSFLAGS= -justanalyze -disjoint -disjoint-k 1 #-flatirusermethods -flatirtasks
 
 all:
        echo 'pass another arg: <bamboo/bamboo-release/java/java-release>'
index e12612dc72ca73e12b1e0d0a3c1600d9aa7270cc..c29b0aa87cf3d89e93a3f3491d90c6273c6f4d60 100644 (file)
@@ -67,14 +67,23 @@ public class State {
   public int OWNERSHIPDEBUGCALLCOUNT=0;
   public String OWNERSHIPDEBUGCALLEE=null;
   public String OWNERSHIPDEBUGCALLER=null;
+
   
   public boolean DISJOINT=false;
+
+  public int DISJOINTALLOCDEPTH=1;
   public boolean DISJOINTRELEASEMODE=false;
   public boolean DISJOINTDETERMINISM=false;
-  public int DISJOINTALLOCDEPTH=3;
+
+  public boolean DISJOINTDVISITSTACK=true;
+  public boolean DISJOINTDVISITPQUE=false;
+  public boolean DISJOINTDVISITSTACKEESONTOP=false;
+
   public boolean DISJOINTWRITEDOTS=false;
   public boolean DISJOINTWRITEALL=false;
   public boolean DISJOINTWRITEIHMS=false;
+  public boolean DISJOINTWRITEINITCONTEXTS=false;
+
   public String DISJOINTALIASFILE=null;
   public boolean DISJOINTALIASTAB=false;
 
@@ -89,12 +98,9 @@ public class State {
   public int DISJOINTSNAPNUMVISITS=0;
   public boolean DISJOINTSNAPSTOPAFTER=false;
 
-  public boolean DISJOINTDVISITSTACK=true;
-  public boolean DISJOINTDVISITPQUE=false;
-  public boolean DISJOINTDVISITSTACKEESONTOP=false;
-
   public boolean DISJOINTDEBUGSCHEDULING=false;
 
+
   public boolean OPTIONAL=false;
   public boolean ARRAYPAD=false;
   public boolean THREAD=false;
index 08e19581e5bc40c6abf68311ed8334bbacee0d2c..ca305d16e273e736db60e04bbafb6be5b863bced 100644 (file)
@@ -185,6 +185,9 @@ public class Main {
           throw new Error("disjoint-write-dots requires argument <all/final>");
         }
 
+      } else if (option.equals("-disjoint-write-initial-contexts")) {
+       state.DISJOINTWRITEINITCONTEXTS = true;
+
       } else if (option.equals("-disjoint-write-ihms")) {
        state.DISJOINTWRITEIHMS = true;