return dcopts;
}
+ public Hashtable<LocalityBinding, HashSet<FlatNode>> getCannotDelayMap() {
+ return cannotdelaymap;
+ }
+
public void doAnalysis() {
Set<LocalityBinding> localityset=locality.getLocalityBindings();
for(Iterator<LocalityBinding> lbit=localityset.iterator();lbit.hasNext();) {
analyzeMethod(lbit.next());
}
- dcopts=new DiscoverConflicts(locality, state, typeanalysis, cannotdelaymap);
+ //ignore things that aren't in the map
+ dcopts=new DiscoverConflicts(locality, state, typeanalysis, cannotdelaymap, false, false);
dcopts.doAnalysis();
TypeAnalysis typeanalysis;
Hashtable<LocalityBinding, HashSet<FlatNode>>cannotdelaymap;
Hashtable<LocalityBinding, Hashtable<FlatNode, Hashtable<TempDescriptor, Set<TempFlatPair>>>> lbtofnmap;
-
+ boolean inclusive=false;
+ boolean normalassign=false;
public DiscoverConflicts(LocalityAnalysis locality, State state, TypeAnalysis typeanalysis) {
this.locality=locality;
lbtofnmap=new Hashtable<LocalityBinding, Hashtable<FlatNode, Hashtable<TempDescriptor, Set<TempFlatPair>>>>();
}
- public DiscoverConflicts(LocalityAnalysis locality, State state, TypeAnalysis typeanalysis, Hashtable<LocalityBinding, HashSet<FlatNode>> cannotdelaymap) {
+ public DiscoverConflicts(LocalityAnalysis locality, State state, TypeAnalysis typeanalysis, Hashtable<LocalityBinding, HashSet<FlatNode>> cannotdelaymap, boolean inclusive, boolean normalassign) {
this.locality=locality;
this.fields=new HashSet<FieldDescriptor>();
this.arrays=new HashSet<TypeDescriptor>();
leftsrcmap=new Hashtable<LocalityBinding, Set<FlatNode>>();
rightsrcmap=new Hashtable<LocalityBinding, Set<FlatNode>>();
lbtofnmap=new Hashtable<LocalityBinding, Hashtable<FlatNode, Hashtable<TempDescriptor, Set<TempFlatPair>>>>();
+ this.inclusive=inclusive;
+ this.normalassign=normalassign;
}
public Set<FieldDescriptor> getFields() {
for(Iterator<FlatNode> fnit=fm.getNodeSet().iterator();fnit.hasNext();) {
FlatNode fn=fnit.next();
- //Check whether this node matters for delayed computation
- if (cannotdelaymap!=null&&cannotdelaymap.containsKey(lb)&&!cannotdelaymap.get(lb).contains(fn))
+ //Check whether this node matters for cannot delayed computation
+ if (cannotdelaymap!=null&&cannotdelaymap.containsKey(lb)&&cannotdelaymap.get(lb).contains(fn)==inclusive)
continue;
Hashtable<FlatNode, Integer> atomictable=locality.getAtomic(lb);
}
case FKind.FlatOpNode: {
FlatOpNode fon=(FlatOpNode)fn;
- if (fon.getOp().getOp()==Operation.ASSIGN&&fon.getDest().getType().isPtr()&&
- ttofn.containsKey(fon.getLeft())) {
- ttofn.put(fon.getDest(), new HashSet<TempFlatPair>(ttofn.get(fon.getLeft())));
+ if (fon.getOp().getOp()==Operation.ASSIGN&&fon.getDest().getType().isPtr()) {
+ HashSet<TempFlatPair> set=new HashSet<TempFlatPair>();
+ if (ttofn.containsKey(fon.getLeft()))
+ set.addAll(ttofn.get(fon.getLeft()));
+ if (normalassign)
+ set.add(new TempFlatPair(fon.getDest(), fn));
+ ttofn.put(fon.getDest(), set);
break;
}
}
boolean nonSESEpass=true;
WriteBarrier wb;
DiscoverConflicts dc;
+ DiscoverConflicts recorddc;
DelayComputation delaycomp;
CallGraph callgraph;
delaycomp=new DelayComputation(locality, st, typeanalysis, gft);
delaycomp.doAnalysis();
dc=delaycomp.getConflicts();
+ recorddc=new DiscoverConflicts(locality, st, typeanalysis, delaycomp.getCannotDelayMap(), true, true);
}
if(state.MLP) {
if (firstpass) {
//need to store value written by previous node
if (wrtmp.getType().isPtr()) {
- output.println("STOREPTR("+generateTemp(fm, wrtmp,lb)+");");
+ //only lock the objects that may actually need locking
+ if (recorddc.getNeedTrans(lb, current_node)) {
+ output.println("STOREPTR("+generateTemp(fm, wrtmp,lb)+");");
+ } else {
+ output.println("STOREPTRNOTRANS("+generateTemp(fm, wrtmp,lb)+");");
+ }
} else {
output.println("STORE"+wrtmp.getType().getSafeDescriptor()+"("+generateTemp(fm, wrtmp, lb)+");");
}