//subtract out the ones we write to
transtemps.removeAll(Arrays.asList(fn.writesTemps()));
//add in the globals we read from
+ Hashtable<TempDescriptor, Integer> pretemptab=locality.getNodePreTempInfo(lb, fn);
TempDescriptor []readtemps=fn.readsTemps();
for(int i=0;i<readtemps.length;i++) {
TempDescriptor tmp=readtemps[i];
- if (temptab.get(fn).get(tmp).intValue()==LocalityAnalysis.GLOBAL) {
+ if (pretemptab.get(tmp).intValue()==LocalityAnalysis.GLOBAL) {
transtemps.add(tmp);
}
}
public LocalityBinding getBinding(LocalityBinding currlb, FlatCall fc) {
boolean isatomic=getAtomic(currlb).get(fc).intValue()>0;
- Hashtable<TempDescriptor, Integer> currtable=getNodeTempInfo(currlb).get(fc);
+ Hashtable<TempDescriptor, Integer> currtable=getNodePreTempInfo(currlb,fc);
MethodDescriptor md=fc.getMethod();
boolean isnative=md.getModifiers().isNative();
return temptab.get(lb);
}
+ /** This method returns a hashtable for a given LocalityBinding
+ * that tells the current local/global status of temps at the
+ * beginning of each node in the flat representation. */
+
+ public Hashtable<TempDescriptor, Integer> getNodePreTempInfo(LocalityBinding lb, FlatNode fn) {
+ Hashtable<TempDescriptor, Integer> currtable=new Hashtable<TempDescriptor, Integer>();
+ Hashtable<FlatNode, Hashtable<TempDescriptor, Integer>> temptable=getNodeTempInfo(lb);
+
+ for(int i=0;i<fn.numPrev();i++) {
+ FlatNode prevnode=fn.getPrev(i);
+ Hashtable<TempDescriptor, Integer> prevtable=temptable.get(prevnode);
+ for(Iterator<TempDescriptor> tempit=prevtable.keySet().iterator();tempit.hasNext();) {
+ TempDescriptor temp=tempit.next();
+ Integer tmpint=prevtable.get(temp);
+ Integer oldint=currtable.containsKey(temp)?currtable.get(temp):EITHER;
+ Integer newint=merge(tmpint, oldint);
+ currtable.put(temp, newint);
+ }
+ }
+ return currtable;
+ }
+
/** This method returns an hashtable for a given LocalitBinding
* that tells whether a node in the flat represenation is in a
* transaction or not. Integer values greater than 0 indicate
output.println(generateTemp(fm, fgcn.getSrc(),lb)+"=(void *)transRead(trans, (unsigned int) "+generateTemp(fm, fgcn.getSrc(),lb)+");");
} else {
/* Need to convert to OID */
- output.println(generateTemp(fm, fgcn.getSrc(),lb)+"=OID("+generateTemp(fm, fgcn.getSrc(),lb)+");");
+ output.println(generateTemp(fm, fgcn.getSrc(),lb)+"=(void *)OID("+generateTemp(fm, fgcn.getSrc(),lb)+");");
}
}
private void generateFlatFieldNode(FlatMethod fm, LocalityBinding lb, FlatFieldNode ffn, PrintWriter output) {
if (state.DSM) {
- Integer status=locality.getNodeTempInfo(lb).get(ffn).get(ffn.getSrc());
+ Integer status=locality.getNodePreTempInfo(lb,ffn).get(ffn.getSrc());
if (status==LocalityAnalysis.GLOBAL) {
String field=ffn.getField().getSafeSymbol();
String src="((struct "+ffn.getSrc().getType().getSafeSymbol()+" *)((unsigned int)"+generateTemp(fm, ffn.getSrc(),lb)+"+sizeof(objheader_t)))";
if (fsfn.getField().getSymbol().equals("length")&&fsfn.getDst().getType().isArray())
throw new Error("Can't set array length");
if (state.DSM && locality.getAtomic(lb).get(fsfn).intValue()>0) {
- Integer statussrc=locality.getNodeTempInfo(lb).get(fsfn).get(fsfn.getSrc());
+ Integer statussrc=locality.getNodePreTempInfo(lb,fsfn).get(fsfn.getSrc());
Integer statusdst=locality.getNodeTempInfo(lb).get(fsfn).get(fsfn.getDst());
boolean srcglobal=statussrc==LocalityAnalysis.GLOBAL;
} objheader_t;
#define OID(x)\
-*((unsigned int *)&((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___nextobject___)
+ (*((unsigned int *)&((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___nextobject___))
#define STATUS(x)\
*((unsigned int *) &(((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___localcopy___))