Hashtable<LocalityBinding, Set<TempFlatPair>> transreadmap;
Hashtable<LocalityBinding, Set<FlatNode>> twritemap;
Hashtable<LocalityBinding, Set<TempFlatPair>> writemap;
+ Hashtable<LocalityBinding, Set<FlatNode>> getmap;
+
Hashtable<LocalityBinding, Set<FlatNode>> srcmap;
Hashtable<LocalityBinding, Set<FlatNode>> leftsrcmap;
Hashtable<LocalityBinding, Set<FlatNode>> rightsrcmap;
twritemap=new Hashtable<LocalityBinding, Set<FlatNode>>();
writemap=new Hashtable<LocalityBinding, Set<TempFlatPair>>();
}
+ getmap=new Hashtable<LocalityBinding, Set<FlatNode>>();
this.gft=gft;
}
twritemap=new Hashtable<LocalityBinding, Set<FlatNode>>();
writemap=new Hashtable<LocalityBinding, Set<TempFlatPair>>();
}
+ getmap=new Hashtable<LocalityBinding, Set<FlatNode>>();
this.gft=gft;
}
for(Iterator<LocalityBinding> lb=localityset.iterator();lb.hasNext();) {
LocalityBinding l=lb.next();
analyzeLocality(l);
- setNeedReadTrans(l);
}
}
//Change flatnode/temp pairs to just flatnodes that need transactional reads
- public void setNeedReadTrans(LocalityBinding lb) {
+ private void setNeedReadTrans(LocalityBinding lb) {
HashSet<FlatNode> set=new HashSet<FlatNode>();
for(Iterator<TempFlatPair> it=transreadmap.get(lb).iterator();it.hasNext();) {
TempFlatPair tfp=it.next();
twritemap.put(lb, set);
}
}
+
+ private void computeneedsarrayget(LocalityBinding lb, Hashtable<FlatNode, Hashtable<TempDescriptor, Set<TempFlatPair>>> fnmap) {
+ // Set<FlatNode> gwriteset=(state.READSET&&gft!=null)?twritemap.get(lb):treadmap.get(lb);
+ if (state.READSET&&gft!=null) {
+ if (twritemap.get(lb).size()==0) {
+ getmap.put(lb, new HashSet<FlatNode>());
+ return;
+ }
+ }
+
+ Set<FlatNode> gwriteset=treadmap.get(lb);
+ FlatMethod fm=state.getMethodFlat(lb.getMethod());
+ HashSet<FlatNode> needsget=new HashSet<FlatNode>();
+ for(Iterator<FlatNode> fnit=fm.getNodeSet().iterator();fnit.hasNext();) {
+ FlatNode fn=fnit.next();
+ Hashtable<FlatNode, Integer> atomictable=locality.getAtomic(lb);
+ if (atomictable.get(fn).intValue()>0&&fn.kind()==FKind.FlatElementNode) {
+ FlatElementNode fen=(FlatElementNode)fn;
+ Set<TempFlatPair> tfpset=fnmap.get(fen).get(fen.getSrc());
+ if (tfpset!=null) {
+ for(Iterator<TempFlatPair> tfpit=tfpset.iterator();tfpit.hasNext();) {
+ TempFlatPair tfp=tfpit.next();
+ if (gwriteset.contains(tfp.f)) {
+ needsget.add(fen);
+ break;
+ }
+ }
+ }
+ }
+ }
+ getmap.put(lb, needsget);
+ }
//We have a set of things we write to, figure out what things this
//could effect.
return treadmap.get(lb).contains(fn);
}
+ public boolean getNeedGet(LocalityBinding lb, FlatNode fn) {
+ if (gft!=null)
+ return getmap.get(lb).contains(fn);
+ else throw new Error();
+ }
+
public boolean getNeedWriteTrans(LocalityBinding lb, FlatNode fn) {
if (gft!=null)
return twritemap.get(lb).contains(fn);
if (gft!=null) {
writemap.put(lb, writeset);
}
-
+
HashSet<FlatNode> srctrans=new HashSet<FlatNode>();
HashSet<FlatNode> leftsrctrans=new HashSet<FlatNode>();
HashSet<FlatNode> rightsrctrans=new HashSet<FlatNode>();
if (atomictable.get(fn).intValue()>0) {
Hashtable<TempDescriptor, Set<TempFlatPair>> tmap=fnmap.get(fn);
switch(fn.kind()) {
-
//We might need to translate arguments to pointer comparison
case FKind.FlatOpNode: {
}
}
}
+ //Update results
+ setNeedReadTrans(lb);
+ computeneedsarrayget(lb, fnmap);
}
public boolean outofscope(TempFlatPair tfp) {
//this could cause conflict...figure out conflict set
Set<TempFlatPair> tfpset=tmap.get(fen.getSrc());
if (tfpset!=null)
- writeset.addAll(tfpset);
+ tfset.addAll(tfpset);
}
break;
}
//this could cause conflict...figure out conflict set
Set<TempFlatPair> tfpset=tmap.get(ffn.getSrc());
if (tfpset!=null)
- writeset.addAll(tfpset);
+ tfset.addAll(tfpset);
}
break;
}
}
class TempFlatPair {
- FlatNode f;
- TempDescriptor t;
- TempFlatPair(TempDescriptor t, FlatNode f) {
- this.t=t;
- this.f=f;
- }
-
- public int hashCode() {
- return f.hashCode()^t.hashCode();
- }
- public boolean equals(Object o) {
- TempFlatPair tf=(TempFlatPair)o;
- return t.equals(tf.t)&&f.equals(tf.f);
- }
+ FlatNode f;
+ TempDescriptor t;
+ TempFlatPair(TempDescriptor t, FlatNode f) {
+ this.t=t;
+ this.f=f;
+ }
+
+ public int hashCode() {
+ return f.hashCode()^t.hashCode();
+ }
+ public boolean equals(Object o) {
+ TempFlatPair tf=(TempFlatPair)o;
+ return t.equals(tf.t)&&f.equals(tf.f);
+ }
+ public String toString() {
+ return f.toString()+" "+t.toString();
+ }
}