bug fixes
authorbdemsky <bdemsky>
Fri, 26 Jun 2009 20:01:21 +0000 (20:01 +0000)
committerbdemsky <bdemsky>
Fri, 26 Jun 2009 20:01:21 +0000 (20:01 +0000)
Robust/src/Analysis/Locality/DelayComputation.java
Robust/src/Analysis/Locality/DiscoverConflicts.java

index 93b0489be013395dc05cd8d7b7cc086b4f3f9d40..2bade8a1a66aa83a0cd7e25b498fb7b313a1a115 100644 (file)
@@ -41,8 +41,37 @@ public class DelayComputation {
 
   public void doAnalysis() {
     Set<LocalityBinding> localityset=locality.getLocalityBindings();
-    for(Iterator<LocalityBinding> lb=localityset.iterator();lb.hasNext();) {
-      analyzeMethod(lb.next());
+    for(Iterator<LocalityBinding> lbit=localityset.iterator();lbit.hasNext();) {
+      analyzeMethod(lbit.next());
+    }
+
+    dcopts=new DiscoverConflicts(locality, state, typeanalysis, cannotdelaymap);
+    dcopts.doAnalysis();
+
+
+    for(Iterator<LocalityBinding> lbit=localityset.iterator();lbit.hasNext();) {
+      LocalityBinding lb=lbit.next();
+
+      MethodDescriptor md=lb.getMethod();
+      FlatMethod fm=state.getMethodFlat(md);
+      if (lb.isAtomic())
+       continue;
+      
+      if (lb.getHasAtomic()) {
+       HashSet<FlatNode> cannotdelay=cannotdelaymap.get(lb);
+       HashSet<FlatNode> notreadyset=computeNotReadySet(lb, cannotdelay);
+       HashSet<FlatNode> otherset=new HashSet<FlatNode>();
+       otherset.addAll(fm.getNodeSet());
+       otherset.removeAll(notreadyset);
+       otherset.removeAll(cannotdelay);
+       notreadymap.put(lb, notreadyset);
+       othermap.put(lb, otherset);
+      }
+      
+      //We now have:
+      //(1) Cannot delay set -- stuff that must be done before commit
+      //(2) Not ready set -- stuff that must wait until commit
+      //(3) everything else -- stuff that should be done before commit
     }
   }
 
@@ -583,21 +612,13 @@ public class DelayComputation {
        for(int i=0;i<fn.numPrev();i++)
          toanalyze.add(fn.getPrev(i));
     }//end of while loop
-    HashSet<FlatNode> notreadyset=computeNotReadySet(lb, cannotdelay);
-    HashSet<FlatNode> otherset=new HashSet<FlatNode>();
-    otherset.addAll(fm.getNodeSet());
+
     if (lb.getHasAtomic()) {
-      otherset.removeAll(notreadyset);
-      otherset.removeAll(cannotdelay);
-      notreadymap.put(lb, notreadyset);
       cannotdelaymap.put(lb, cannotdelay);
-      othermap.put(lb, otherset);
     }
 
-    //We now have:
-    //(1) Cannot delay set -- stuff that must be done before commit
-    //(2) Not ready set -- stuff that must wait until commit
-    //(3) everything else -- stuff that should be done before commit
+
+
   } //end of method
 
   //Problems:
@@ -612,8 +633,6 @@ public class DelayComputation {
     //(B). You read a field/element in the transactional set
     //(C). The source didn't have a transactional read on it
 
-    dcopts=new DiscoverConflicts(locality, state, typeanalysis, cannotdelay);
-    dcopts.doAnalysis();
     MethodDescriptor md=lb.getMethod();
     FlatMethod fm=state.getMethodFlat(md);
     Hashtable<FlatNode, Integer> atomictable=locality.getAtomic(lb);
index f0acbd48903f48639c216c7487f40a4244c520f1..d8eaadcd7f5d15c29be4a8e49a2855d83cb3a4e6 100644 (file)
@@ -23,7 +23,7 @@ public class DiscoverConflicts {
   Hashtable<LocalityBinding, Set<FlatNode>> leftsrcmap;
   Hashtable<LocalityBinding, Set<FlatNode>> rightsrcmap;
   TypeAnalysis typeanalysis;
-  HashSet<FlatNode>cannotdelay;
+  Hashtable<LocalityBinding, HashSet<FlatNode>>cannotdelaymap;
   Hashtable<LocalityBinding, Hashtable<FlatNode, Hashtable<TempDescriptor, Set<TempFlatPair>>>> lbtofnmap;
 
 
@@ -41,13 +41,13 @@ public class DiscoverConflicts {
     lbtofnmap=new Hashtable<LocalityBinding, Hashtable<FlatNode, Hashtable<TempDescriptor, Set<TempFlatPair>>>>();
   }
 
-  public DiscoverConflicts(LocalityAnalysis locality, State state, TypeAnalysis typeanalysis, HashSet<FlatNode> cannotdelay) {
+  public DiscoverConflicts(LocalityAnalysis locality, State state, TypeAnalysis typeanalysis, Hashtable<LocalityBinding, HashSet<FlatNode>> cannotdelaymap) {
     this.locality=locality;
     this.fields=new HashSet<FieldDescriptor>();
     this.arrays=new HashSet<TypeDescriptor>();
     this.state=state;
     this.typeanalysis=typeanalysis;
-    this.cannotdelay=cannotdelay;
+    this.cannotdelaymap=cannotdelaymap;
     transreadmap=new Hashtable<LocalityBinding, Set<TempFlatPair>>();
     treadmap=new Hashtable<LocalityBinding, Set<FlatNode>>();
     srcmap=new Hashtable<LocalityBinding, Set<FlatNode>>();
@@ -295,7 +295,7 @@ public class DiscoverConflicts {
       Hashtable<FlatNode, Integer> atomictable=locality.getAtomic(lb);
 
       //Check whether this node matters for delayed computation
-      if (cannotdelay!=null&&!cannotdelay.contains(fn))
+      if (cannotdelaymap!=null&&cannotdelaymap.contains(lb)&&!cannotdelaymap.get(lb).contains(fn))
        continue;
 
       if (atomictable.get(fn).intValue()>0) {