}
/* At the end of an atomic block, we need to convert any global
- * references that will be used again into OID's */
+ * references that will be used again into OID's. */
private void converttoOid(LocalityBinding lb) {
Hashtable<FlatNode, Integer> atomictab=locality.getAtomic(lb);
Hashtable<FlatNode, Hashtable<TempDescriptor, Integer>> temptab=locality.getNodeTempInfo(lb);
MethodDescriptor md=lb.getMethod();
FlatMethod fm=state.getMethodFlat(md);
-
- Hashtable<FlatNode, Set<TempNodePair>> nodetotnpair=new Hashtable<FlatNode, Set<TempNodePair>>();
+ Hashtable<FlatNode, Set<TempNodePair>> nodetotnpair=new Hashtable<FlatNode, Set<TempNodePair>>();
Hashtable<FlatNode, Set<TempDescriptor>> nodetoconvs=new Hashtable<FlatNode, Set<TempDescriptor>>();
Set<FlatNode> toprocess=fm.getNodeSet();
List<TempDescriptor> reads=Arrays.asList(fn.readsTemps());
List<TempDescriptor> writes=Arrays.asList(fn.writesTemps());
-
+
if (!isatomic&&fn.kind()==FKind.FlatAtomicExitNode
&&!nodetoconvs.containsKey(fn))
nodetoconvs.put(fn, new HashSet<TempDescriptor>());
-
-
+
HashSet<TempNodePair> tempset=new HashSet<TempNodePair>();
+
for(int i=0;i<fn.numPrev();i++) {
FlatNode fnprev=fn.getPrev(i);
if (!nodetotnpair.containsKey(fnprev))
continue;
+
Set<TempNodePair> prevset=nodetotnpair.get(fnprev);
for(Iterator<TempNodePair> it=prevset.iterator();it.hasNext();) {
TempNodePair tnp=it.next();
+ if (fn.kind()==FKind.FlatGlobalConvNode&&
+ ((FlatGlobalConvNode)fn).getLocality()!=lb) {
+ //ignore this node
+ tempset.add(tnp);
+ continue;
+ }
if (reads.contains(tnp.getTemp())&&tnp.getNode()!=null) {
//Value actually is read...
nodetoconvs.get(tnp.getNode()).add(tnp.getTemp());
}
}
if (isatomic) {
- //if this is in an atomic block, record temps that are written to
+ /* If this is in an atomic block, record temps that
+ * are written to.*/
/* NOTE: If this compiler is changed to maintain
* OID/Ptr's in variables, then we need to use all
* ones converted by globalconvnode*/
if (fn.kind()!=FKind.FlatGlobalConvNode||
- ((FlatGlobalConvNode)fn).getLocality()==lb)
- //If globalconvnode, make sure we have the right locality
+ ((FlatGlobalConvNode)fn).getLocality()==lb) {
+ /*If globalconvnode, make sure we have the right
+ * locality. */
for(Iterator<TempDescriptor> writeit=writes.iterator();writeit.hasNext();) {
TempDescriptor wrtmp=writeit.next();
if (nodetemptab.get(wrtmp)==LocalityAnalysis.GLOBAL) {
tempset.add(tnp);
}
}
+ }
}
if (!nodetotnpair.containsKey(fn)||!nodetotnpair.get(fn).equals(tempset)) {
//changes to set, so enqueue next nodes
FlatGlobalConvNode fgcn=new FlatGlobalConvNode(tempit.next(), lb, false);
atomictab.put(fgcn, atomictab.get(fn));
temptab.put(fgcn, (Hashtable<TempDescriptor, Integer>) temptab.get(fn).clone());
+
for(int i=0;i<fn.numPrev();i++) {
FlatNode fnprev=fn.getPrev(i);
for(int j=0;j<fnprev.numNext();j++) {
while(!toprocess.isEmpty()) {
FlatNode fn=toprocess.iterator().next();
toprocess.remove(fn);
-
+
if (atomictab.get(fn).intValue()>0) {
//build set of transaction temps use by next nodes
HashSet<TempDescriptor> transtemps=new HashSet<TempDescriptor>();
atomictab.get(fn.getPrev(0)).intValue()==0) {
//sanity check
assert(fn.kind()==FKind.FlatAtomicEnterNode);
-
+
//insert calls here...
Set<TempDescriptor> tempset=nodetotranstemps.get(fn);
for(Iterator<TempDescriptor> tempit=tempset.iterator();tempit.hasNext();) {
public class EGTaskNode extends TaskNode {
private boolean source=false;
- private int loopmarker=0;
- private boolean tomention=true;
private FlagState fs;
private FlagState postfs;
private TaskDescriptor td;
return uid;
}
- public void doSelfLoopMarking(){
- loopmarker=1;
- }
-
- public void doLoopMarking(){
- loopmarker=2;
- }
-
- public boolean isSelfLoop(){
- if (loopmarker==1) return true;
- else return false;
- }
-
- public boolean isLoop(){
- if (loopmarker==2) return true;
- else return false;
- }
-
public boolean isMultipleParams(){
return getTD()!=null&&getTD().numParameters()>1;
}
public FlagState getFS(){
return fs;
}
-
- public void dontMention(){
- tomention = false;
- }
-
- public boolean toMention(){
- return tomention;
- }
}
return visited;
}
+ public String printMethod() {
+ return printMethod(null);
+ }
+
/** This method returns a string that is a human readable
* representation of this method. */
- public String printMethod() {
+ public String printMethod(Hashtable map) {
String st=method+" {\n";
HashSet tovisit=new HashSet();
HashSet visited=new HashSet();
tovisit.remove(fn);
visited.add(fn);
-// System.out.println("Next : "+fn.numNext());
-
for(int i=0;i<fn.numNext();i++) {
FlatNode nn=fn.getNext(i);
if(i>0) {
if (nodetolabel.containsKey(current_node))
st+="L"+nodetolabel.get(current_node)+":\n";
if (current_node.numNext()==0) {
- st+=" "+current_node.toString()+"\n";
+ if (map==null)
+ st+=" "+current_node.toString()+"\n";
+ else
+ st+=" "+current_node.toString()+"["+map.get(current_node)+"]\n";
current_node=null;
} else if(current_node.numNext()==1) {
- st+=" "+current_node.toString()+"\n";
+ if (map==null)
+ st+=" "+current_node.toString()+"\n";
+ else
+ st+=" "+current_node.toString()+"["+map.get(current_node)+"]\n";
FlatNode nextnode=current_node.getNext(0);
if (visited.contains(nextnode)) {
st+="goto L"+nodetolabel.get(nextnode)+"\n";