more fixes
authorbdemsky <bdemsky>
Tue, 11 Sep 2007 07:09:09 +0000 (07:09 +0000)
committerbdemsky <bdemsky>
Tue, 11 Sep 2007 07:09:09 +0000 (07:09 +0000)
Robust/src/Analysis/Locality/GenerateConversions.java
Robust/src/Analysis/Locality/LocalityAnalysis.java
Robust/src/IR/Flat/BuildCode.java
Robust/src/Runtime/DSTM/interface/dstm.h

index d31265e4b94919737e1e9d38a32c4d99cf8c80be..f9c59f77aac557825e375b3a912b105c542e989a 100644 (file)
@@ -167,10 +167,11 @@ public class GenerateConversions {
                //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);
                    }
                }
index 6a6c13cdc82c1cdcf5d9014832a063f0b2a9074d..de795283dc805eae0e9c70f1ec2baed6ccb0a546 100644 (file)
@@ -52,7 +52,7 @@ public class LocalityAnalysis {
 
     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();
@@ -106,6 +106,28 @@ public class LocalityAnalysis {
        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
index e636a025e60d0dbbca1c8d7a0ecb489732eda8c6..0c92252cd79e8bbd14e98c880643880dd46775b2 100644 (file)
@@ -1416,7 +1416,7 @@ public class BuildCode {
            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)+");");
        }
     }
 
@@ -1649,7 +1649,7 @@ public class BuildCode {
 
     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)))";
@@ -1696,7 +1696,7 @@ public class BuildCode {
        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;
 
index 531cb736faa82a67804152e9f29ed7189fb59a13..ffa3036186ba0c4ddefa9bb08d477b523d5daf0b 100644 (file)
@@ -70,7 +70,7 @@ typedef struct objheader {
 } 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___))