From 2680944575ba513283e693a1fdb838f78278971a Mon Sep 17 00:00:00 2001 From: bdemsky Date: Tue, 30 Jun 2009 03:47:40 +0000 Subject: [PATCH] bug fixes --- .../Analysis/Locality/DelayComputation.java | 22 ++++++++++--------- .../Analysis/Locality/DiscoverConflicts.java | 5 +++-- .../Analysis/Locality/LocalityAnalysis.java | 10 +++------ .../src/Analysis/Locality/TypeAnalysis.java | 9 ++++++-- 4 files changed, 25 insertions(+), 21 deletions(-) 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 liveinto=new HashSet(); - Hashtable>> reachingdefs=ReachingDefs.computeReachingDefs(fm, Liveness.computeLiveTemps(fm)); + Hashtable>> reachingdefs=ReachingDefs.computeReachingDefs(fm, Liveness.computeLiveTemps(fm), true); for(Iterator fnit=secondpart.iterator();fnit.hasNext();) { FlatNode fn=fnit.next(); @@ -162,7 +163,7 @@ public class DelayComputation { FlatMethod fm=state.getMethodFlat(md); Set exits=faen.getExits(); Hashtable> livemap=Liveness.computeLiveTemps(fm); - Hashtable>> reachingdefs=ReachingDefs.computeReachingDefs(fm, Liveness.computeLiveTemps(fm)); + Hashtable>> reachingdefs=ReachingDefs.computeReachingDefs(fm, Liveness.computeLiveTemps(fm), true); Set atomicnodes=faen.getReachableSet(faen.getExits()); @@ -207,7 +208,7 @@ public class DelayComputation { FlatMethod fm=state.getMethodFlat(md); Set exits=faen.getExits(); Hashtable> livemap=Liveness.computeLiveTemps(fm); - Hashtable>> reachingdefs=ReachingDefs.computeReachingDefs(fm, livemap); + Hashtable>> reachingdefs=ReachingDefs.computeReachingDefs(fm, livemap, true); Set atomicnodes=faen.getReachableSet(faen.getExits()); @@ -256,11 +257,9 @@ public class DelayComputation { HashSet otherset=othermap.get(lb); HashSet cannotdelayset=cannotdelaymap.get(lb); Hashtable> livemap=Liveness.computeLiveTemps(fm); - Hashtable>> reachingdefsmap=ReachingDefs.computeReachingDefs(fm, livemap); + Hashtable>> reachingdefsmap=ReachingDefs.computeReachingDefs(fm, livemap, true); HashSet unionset=new HashSet(delayedset); - Hashtable>> map=new Hashtable>>(); - HashSet livenodes=new HashSet(); for(Iterator fnit=fm.getNodeSet().iterator();fnit.hasNext();) { @@ -268,11 +267,15 @@ public class DelayComputation { if (fn.kind()==FKind.FlatAtomicExitNode) { Set livetemps=livemap.get(fn); Hashtable> tempmap=reachingdefsmap.get(fn); + + //Iterate over the temps that are live into this node for(Iterator tmpit=livetemps.iterator();tmpit.hasNext();) { TempDescriptor tmp=tmpit.next(); Set fnset=tempmap.get(tmp); boolean inpart1=false; boolean inpart2=false; + + //iterate over the reaching definitions for the temp for(Iterator 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 fields; @@ -371,7 +372,7 @@ public class DiscoverConflicts { MethodDescriptor md=lb.getMethod(); FlatMethod fm=state.getMethodFlat(md); Hashtable atomictable=locality.getAtomic(lb); - Hashtable> livetemps=locality.computeLiveTemps(fm); + Hashtable> 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 atomictable=locality.getAtomic(lb); - Hashtable> livetemps=locality.computeLiveTemps(fm); + Hashtable> 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> computeLiveTemps(FlatMethod fm) { - return Liveness.computeLiveTemps(fm); - } - private void computeTempstoSave() { for(Iterator lbit=getLocalityBindings().iterator(); lbit.hasNext();) { LocalityBinding lb=lbit.next(); @@ -1155,7 +1151,7 @@ public class LocalityAnalysis { Hashtable> temptab=getNodeTempInfo(lb); MethodDescriptor md=lb.getMethod(); FlatMethod fm=state.getMethodFlat(md); - Hashtable> nodetotemps=computeLiveTemps(fm); + Hashtable> nodetotemps=Liveness.computeLiveTemps(fm); Hashtable> nodetosavetemps=new Hashtable>(); tempstosave.put(lb, nodetosavetemps); Hashtable nodemap=new Hashtable(); @@ -1174,9 +1170,9 @@ public class LocalityAnalysis { nodetosavetemps.put((FlatAtomicEnterNode)fn, new HashSet()); } else if (isatomic) { FlatAtomicEnterNode atomicnode=nodemap.get(fn); - Set livetemps=nodetotemps.get(fn); + Set livetemps=nodetotemps.get(atomicnode); List reads=Arrays.asList(fn.readsTemps()); - List writes=Arrays.asList(fn.readsTemps()); + List writes=Arrays.asList(fn.writesTemps()); for(Iterator 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 expand(TypeDescriptor td) { - return namemap.get(td); + Set expandset=namemap.get(td); + return expandset; } public Set expandSet(Set tdset) { HashSet expandedSet=new HashSet(); for(Iterator it=tdset.iterator();it.hasNext();) { TypeDescriptor td=it.next(); - expandedSet.addAll(expand(td)); + Set etdset=expand(td); + if (etdset==null) + expandedSet.add(td); + else + expandedSet.addAll(etdset); } return expandedSet; } -- 2.34.1