otherset.addAll(fm.getNodeSet());
otherset.removeAll(notreadyset);
otherset.removeAll(cannotdelay);
+
notreadymap.put(lb, notreadyset);
othermap.put(lb, otherset);
}
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();
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());
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());
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();) {
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)) {
//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 */
if (nodelayfieldwrset.contains(fd))
isnodelay=true;
}
-
//Check for array conflicts
if (fn.kind()==FKind.FlatSetElementNode) {
TypeDescriptor td=((FlatSetElementNode)fn).getDst().getType();
/* 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
import IR.TypeDescriptor;
import IR.MethodDescriptor;
import IR.FieldDescriptor;
+import Analysis.Liveness;
public class DiscoverConflicts {
Set<FieldDescriptor> fields;
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);
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);
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();
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>();
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();