From: bdemsky <bdemsky>
Date: Tue, 30 Jun 2009 03:47:40 +0000 (+0000)
Subject: bug fixes
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2680944575ba513283e693a1fdb838f78278971a;p=IRC.git

bug fixes
---

diff --git a/Robust/src/Analysis/Locality/DelayComputation.java b/Robust/src/Analysis/Locality/DelayComputation.java
index 60f8aee5..b8a78afc 100644
--- a/Robust/src/Analysis/Locality/DelayComputation.java
+++ b/Robust/src/Analysis/Locality/DelayComputation.java
@@ -65,6 +65,7 @@ public class DelayComputation {
 	otherset.addAll(fm.getNodeSet());
 	otherset.removeAll(notreadyset);
 	otherset.removeAll(cannotdelay);
+
 	notreadymap.put(lb, notreadyset);
 	othermap.put(lb, otherset);
       }
@@ -133,7 +134,7 @@ public class DelayComputation {
 
     Set<TempDescriptor> liveinto=new HashSet<TempDescriptor>();
     
-    Hashtable<FlatNode, Hashtable<TempDescriptor, Set<FlatNode>>> reachingdefs=ReachingDefs.computeReachingDefs(fm, Liveness.computeLiveTemps(fm));
+    Hashtable<FlatNode, Hashtable<TempDescriptor, Set<FlatNode>>> reachingdefs=ReachingDefs.computeReachingDefs(fm, Liveness.computeLiveTemps(fm), true);
     
     for(Iterator<FlatNode> fnit=secondpart.iterator();fnit.hasNext();) {
       FlatNode fn=fnit.next();
@@ -162,7 +163,7 @@ public class DelayComputation {
     FlatMethod fm=state.getMethodFlat(md);
     Set<FlatNode> exits=faen.getExits();
     Hashtable<FlatNode, Set<TempDescriptor>> livemap=Liveness.computeLiveTemps(fm);
-    Hashtable<FlatNode, Hashtable<TempDescriptor, Set<FlatNode>>> reachingdefs=ReachingDefs.computeReachingDefs(fm, Liveness.computeLiveTemps(fm));    
+    Hashtable<FlatNode, Hashtable<TempDescriptor, Set<FlatNode>>> reachingdefs=ReachingDefs.computeReachingDefs(fm, Liveness.computeLiveTemps(fm), true);
 
     Set<FlatNode> atomicnodes=faen.getReachableSet(faen.getExits());
 
@@ -207,7 +208,7 @@ public class DelayComputation {
     FlatMethod fm=state.getMethodFlat(md);
     Set<FlatNode> exits=faen.getExits();
     Hashtable<FlatNode, Set<TempDescriptor>> livemap=Liveness.computeLiveTemps(fm);
-    Hashtable<FlatNode, Hashtable<TempDescriptor, Set<FlatNode>>> reachingdefs=ReachingDefs.computeReachingDefs(fm, livemap);
+    Hashtable<FlatNode, Hashtable<TempDescriptor, Set<FlatNode>>> reachingdefs=ReachingDefs.computeReachingDefs(fm, livemap, true);
     
     Set<FlatNode> atomicnodes=faen.getReachableSet(faen.getExits());
 
@@ -256,11 +257,9 @@ public class DelayComputation {
     HashSet<FlatNode> otherset=othermap.get(lb);
     HashSet<FlatNode> cannotdelayset=cannotdelaymap.get(lb);
     Hashtable<FlatNode,Set<TempDescriptor>> livemap=Liveness.computeLiveTemps(fm);
-    Hashtable<FlatNode, Hashtable<TempDescriptor, Set<FlatNode>>> reachingdefsmap=ReachingDefs.computeReachingDefs(fm, livemap);
+    Hashtable<FlatNode, Hashtable<TempDescriptor, Set<FlatNode>>> reachingdefsmap=ReachingDefs.computeReachingDefs(fm, livemap, true);
     HashSet<FlatNode> unionset=new HashSet<FlatNode>(delayedset);
-
     Hashtable<FlatNode, Hashtable<TempDescriptor, HashSet<FlatNode>>> map=new Hashtable<FlatNode, Hashtable<TempDescriptor, HashSet<FlatNode>>>();
-
     HashSet<FlatNode> livenodes=new HashSet<FlatNode>();
 
     for(Iterator<FlatNode> fnit=fm.getNodeSet().iterator();fnit.hasNext();) {
@@ -268,11 +267,15 @@ public class DelayComputation {
       if (fn.kind()==FKind.FlatAtomicExitNode) {
 	Set<TempDescriptor> livetemps=livemap.get(fn);
 	Hashtable<TempDescriptor, Set<FlatNode>> tempmap=reachingdefsmap.get(fn);
+
+	//Iterate over the temps that are live into this node
 	for(Iterator<TempDescriptor> tmpit=livetemps.iterator();tmpit.hasNext();) {
 	  TempDescriptor tmp=tmpit.next();
 	  Set<FlatNode> fnset=tempmap.get(tmp);
 	  boolean inpart1=false;
 	  boolean inpart2=false;
+
+	  //iterate over the reaching definitions for the temp
 	  for(Iterator<FlatNode> fnit2=fnset.iterator();fnit2.hasNext();) {
 	    FlatNode fn2=fnit2.next();
 	    if (delayedset.contains(fn2)) {
@@ -460,8 +463,8 @@ public class DelayComputation {
 	//do read sets
 	if (nodelayfieldsrd.containsKey(fn.getNext(i)))
 	  nodelayfieldrdset.addAll(nodelayfieldsrd.get(fn.getNext(i)));	  
-	if (nodelayarrayswr.containsKey(fn.getNext(i)))
-	  nodelayarraywrset.addAll(nodelayarrayswr.get(fn.getNext(i)));	  
+	if (nodelayarraysrd.containsKey(fn.getNext(i)))
+	  nodelayarrayrdset.addAll(nodelayarraysrd.get(fn.getNext(i)));	  
       }
       
       /* Check our temp write set */
@@ -517,7 +520,6 @@ public class DelayComputation {
 	if (nodelayfieldwrset.contains(fd))
 	  isnodelay=true;
       }
-
       //Check for array conflicts
       if (fn.kind()==FKind.FlatSetElementNode) {
 	TypeDescriptor td=((FlatSetElementNode)fn).getDst().getType();
@@ -569,7 +571,7 @@ public class DelayComputation {
 	/* Do we read from arrays */
 	if (fn.kind()==FKind.FlatElementNode) {
 	  //have to do expansion
-	  nodelayarrayrdset.addAll(typeanalysis.expand(((FlatElementNode)fn).getSrc().getType()));	  
+	  nodelayarrayrdset.addAll(typeanalysis.expand(((FlatElementNode)fn).getSrc().getType()));
 	}
       } else {
 	//Need to know which objects to lock on
diff --git a/Robust/src/Analysis/Locality/DiscoverConflicts.java b/Robust/src/Analysis/Locality/DiscoverConflicts.java
index f382143c..e9127ae3 100644
--- a/Robust/src/Analysis/Locality/DiscoverConflicts.java
+++ b/Robust/src/Analysis/Locality/DiscoverConflicts.java
@@ -11,6 +11,7 @@ import IR.Operation;
 import IR.TypeDescriptor;
 import IR.MethodDescriptor;
 import IR.FieldDescriptor;
+import Analysis.Liveness;
 
 public class DiscoverConflicts {
   Set<FieldDescriptor> fields;
@@ -371,7 +372,7 @@ public class DiscoverConflicts {
     MethodDescriptor md=lb.getMethod();
     FlatMethod fm=state.getMethodFlat(md);
     Hashtable<FlatNode, Integer> atomictable=locality.getAtomic(lb);
-    Hashtable<FlatNode, Set<TempDescriptor>> livetemps=locality.computeLiveTemps(fm);
+    Hashtable<FlatNode, Set<TempDescriptor>> livetemps=Liveness.computeLiveTemps(fm);
     tovisit.add(fm);
     discovered.add(fm);
     
@@ -500,7 +501,7 @@ public class DiscoverConflicts {
     MethodDescriptor md=lb.getMethod();
     FlatMethod fm=state.getMethodFlat(md);
     Hashtable<FlatNode, Integer> atomictable=locality.getAtomic(lb);
-    Hashtable<FlatNode, Set<TempDescriptor>> livetemps=locality.computeLiveTemps(fm);
+    Hashtable<FlatNode, Set<TempDescriptor>> livetemps=Liveness.computeLiveTemps(fm);
     tovisit.add(fm);
     discovered.add(fm);
     
diff --git a/Robust/src/Analysis/Locality/LocalityAnalysis.java b/Robust/src/Analysis/Locality/LocalityAnalysis.java
index abd14d8e..6a705e86 100644
--- a/Robust/src/Analysis/Locality/LocalityAnalysis.java
+++ b/Robust/src/Analysis/Locality/LocalityAnalysis.java
@@ -1128,10 +1128,6 @@ public class LocalityAnalysis {
     atomictable.put(fen, new Integer(atomic-1));
   }
     
-  Hashtable<FlatNode, Set<TempDescriptor>> computeLiveTemps(FlatMethod fm) {
-    return Liveness.computeLiveTemps(fm);
-  }
-
   private void computeTempstoSave() {
     for(Iterator<LocalityBinding> lbit=getLocalityBindings().iterator(); lbit.hasNext();) {
       LocalityBinding lb=lbit.next();
@@ -1155,7 +1151,7 @@ public class LocalityAnalysis {
     Hashtable<FlatNode, Hashtable<TempDescriptor, Integer>> temptab=getNodeTempInfo(lb);
     MethodDescriptor md=lb.getMethod();
     FlatMethod fm=state.getMethodFlat(md);
-    Hashtable<FlatNode, Set<TempDescriptor>> nodetotemps=computeLiveTemps(fm);
+    Hashtable<FlatNode, Set<TempDescriptor>> nodetotemps=Liveness.computeLiveTemps(fm);
     Hashtable<FlatAtomicEnterNode, Set<TempDescriptor>> nodetosavetemps=new Hashtable<FlatAtomicEnterNode, Set<TempDescriptor>>();
     tempstosave.put(lb, nodetosavetemps);
     Hashtable<FlatNode, FlatAtomicEnterNode> nodemap=new Hashtable<FlatNode, FlatAtomicEnterNode>();
@@ -1174,9 +1170,9 @@ public class LocalityAnalysis {
 	nodetosavetemps.put((FlatAtomicEnterNode)fn, new HashSet<TempDescriptor>());
       } else if (isatomic) {
 	FlatAtomicEnterNode atomicnode=nodemap.get(fn);
-	Set<TempDescriptor> livetemps=nodetotemps.get(fn);
+	Set<TempDescriptor> livetemps=nodetotemps.get(atomicnode);
 	List<TempDescriptor> reads=Arrays.asList(fn.readsTemps());
-	List<TempDescriptor> writes=Arrays.asList(fn.readsTemps());
+	List<TempDescriptor> writes=Arrays.asList(fn.writesTemps());
 
 	for(Iterator<TempDescriptor> tempit=livetemps.iterator(); tempit.hasNext();) {
 	  TempDescriptor tmp=tempit.next();
diff --git a/Robust/src/Analysis/Locality/TypeAnalysis.java b/Robust/src/Analysis/Locality/TypeAnalysis.java
index 60452132..194bc738 100644
--- a/Robust/src/Analysis/Locality/TypeAnalysis.java
+++ b/Robust/src/Analysis/Locality/TypeAnalysis.java
@@ -89,14 +89,19 @@ public class TypeAnalysis {
   }
   
   public Set<TypeDescriptor> expand(TypeDescriptor td) {
-    return namemap.get(td);
+    Set<TypeDescriptor> expandset=namemap.get(td);
+    return expandset;
   }
 
   public Set<TypeDescriptor> expandSet(Set<TypeDescriptor> tdset) {
     HashSet<TypeDescriptor> expandedSet=new HashSet<TypeDescriptor>();
     for(Iterator<TypeDescriptor> it=tdset.iterator();it.hasNext();) {
       TypeDescriptor td=it.next();
-      expandedSet.addAll(expand(td));
+      Set<TypeDescriptor> etdset=expand(td);
+      if (etdset==null)
+	expandedSet.add(td);
+      else
+	expandedSet.addAll(etdset);
     }
     return expandedSet;
   }