fix bugs in transaction code that:
authorbdemsky <bdemsky>
Thu, 16 Aug 2007 09:39:42 +0000 (09:39 +0000)
committerbdemsky <bdemsky>
Thu, 16 Aug 2007 09:39:42 +0000 (09:39 +0000)
1) don't free tosend buffers
2) don't free piles (null is passed into pDelete

Robust/src/Analysis/Locality/LocalityAnalysis.java
Robust/src/IR/Flat/BuildCode.java
Robust/src/IR/Flat/TempDescriptor.java
Robust/src/Runtime/DSTM/interface/dstm.h
Robust/src/Runtime/DSTM/interface/localobjects.h
Robust/src/Runtime/DSTM/interface/trans.c
Robust/src/buildscript

index aa3d9b19946289e62c62ae0338f838bc8b38b021..56179dcc6eb7291c8fc2581975a22daf6fe53359 100644 (file)
@@ -577,9 +577,9 @@ public class LocalityAnalysis {
                for(Iterator<TempDescriptor> tempit=livetemps.iterator();tempit.hasNext();) {
                    TempDescriptor tmp=tempit.next();
                    if (writes.contains(tmp)) {
-                       nodetosavetemps.get(fn).add(tmp);
+                       nodetosavetemps.get(atomicnode).add(tmp);
                    } else if (reads.contains(tmp)&&temptab.get(fn).get(tmp)==GLOBAL) {
-                       nodetosavetemps.get(fn).add(tmp);
+                       nodetosavetemps.get(atomicnode).add(tmp);
                    }
                }
            }
index e645038d53dd7fa43898822f56b533472f3e5d82..de30c31eb5398002e953eb88675fe03b38277558 100644 (file)
@@ -290,8 +290,10 @@ public class BuildCode {
        outmethod.println("#include \"methodheaders.h\"");
        outmethod.println("#include \"virtualtable.h\"");
        outmethod.println("#include <runtime.h>");
-       if (state.DSM)
+       if (state.DSM) 
+{          outmethod.println("#include \"dstm.h\"");
            outmethod.println("#include \"localobjects.h\"");
+       }
        if (state.THREAD)
            outmethod.println("#include <thread.h>");
        if (state.main!=null) {
@@ -794,6 +796,10 @@ public class BuildCode {
            /* Create temp to hold revert table */
            if (lb.getHasAtomic()) {
                TempDescriptor reverttmp=new TempDescriptor("revertlist", typeutil.getClass(TypeUtil.ObjectClass));
+               if (GENERATEPRECISEGC)
+                   objecttemps.addPtr(reverttmp);
+               else
+                   objecttemps.addPrim(reverttmp);
                reverttable.put(lb, reverttmp);
            }
        }
index a25fdb83458fd73bf603d945790eb97fe6a0e4d3..39bb16e0a2dbe60edd747f05bf6307f410d0edfa 100644 (file)
@@ -31,9 +31,9 @@ public class TempDescriptor extends Descriptor {
 
     public TempDescriptor createNew() {
        if (tag==null)
-           return new TempDescriptor(name, type);
+           return new TempDescriptor(name+"_"+currentid, type);
        else
-           return new TempDescriptor(name, type, tag);
+           return new TempDescriptor(name+"_"+currentid, type, tag);
     }
     
     public static TempDescriptor tempFactory() {
index 87899bb80f4573fcb8e31a40a86f1b98b37dc35a..cf2a3b2a85123e614ce7f6add9b2c939fd957e14 100644 (file)
@@ -69,10 +69,10 @@ typedef struct objheader {
 } objheader_t;
 
 #define OID(x)\
-        ((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___nextobject___
+*((unsigned int *)&((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___nextobject___)
 
 #define STATUS(x)\
-        ((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___localcopy___
+        *((unsigned int *) &(((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___localcopy___))
 
 #define TYPE(x)\
         ((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->type
@@ -214,7 +214,7 @@ int transCommitProcess(trans_commit_data_t *, int);
 /* Function called at beginning. Passes in the first parameter. */
 /* Returns 1 if this thread should run the main process */
 
-int dstmStartup(char *);
+int dstmStartup(const char *);
 void transInit();
 
 void randomdelay(void);
index d32095ba627fc0516aee342c8b27d6ac85c62099..9d4968dda3819a1bbd397f7080866b9a65a098ca 100644 (file)
@@ -3,7 +3,7 @@
 #include "structdefs.h"
 #include "garbage.h"
 void REVERT_OBJ(struct ___Object___ *);
-#define COMMIT_OBJ(obj) obj->localcopy=NULL
+#define COMMIT_OBJ(obj) obj->___localcopy___=NULL
 
 #ifdef PRECISE_GC
 void COPY_OBJ(struct garbagelist * gl, struct ___Object___ *obj);
index 67c56629769a7b96090efb9d68cc983c1e247522..45b30ff031181a8ceb5890ad7cfaa45b13dc0b70 100644 (file)
@@ -82,7 +82,7 @@ void prefetch(int ntuples, unsigned int *oids, short *endoffsets, short *arrayfi
 
 
 /* This function starts up the transaction runtime. */
-int dstmStartup(char * option) {
+int dstmStartup(const char * option) {
   pthread_t thread_Listen;
   pthread_attr_t attr;
   int master=strcmp(option, "master")==0;
@@ -318,7 +318,7 @@ plistnode_t *createPiles(transrecord_t *record) {
  * Sends a transrequest() to each pile*/
 int transCommit(transrecord_t *record) {       
        unsigned int tot_bytes_mod, *listmid;
-       plistnode_t *pile;
+       plistnode_t *pile, *pile_ptr;
        int i, rc, val;
        int pilecount = 0, offset, threadnum = 0, trecvcount = 0, tmachcount = 0;
        char buffer[RECEIVE_BUFFER_SIZE],control;
@@ -332,7 +332,7 @@ int transCommit(transrecord_t *record) {
 
        /* Look through all the objects in the transaction record and make piles 
         * for each machine involved in the transaction*/
-       pile = createPiles(record);
+       pile_ptr = pile = createPiles(record);
 
        /* Create the packet to be sent in TRANS_REQUEST */
 
@@ -375,7 +375,6 @@ int transCommit(transrecord_t *record) {
        while(pile != NULL) {
                //Create transaction id
                newtid++;
-               //trans_req_data_t *tosend;
                if ((tosend = calloc(1, sizeof(trans_req_data_t))) == NULL) {
                        printf("Calloc error %s, %d\n", __FILE__, __LINE__);
                        return 1;
@@ -432,14 +431,14 @@ int transCommit(transrecord_t *record) {
                        printf("ERROR return code from pthread_join() is %d\n", rc);
                        return 1;
                }
+               free(thread_data_array[i].buffer);
        }
 
        /* Free resources */    
        pthread_cond_destroy(&tcond);
        pthread_mutex_destroy(&tlock);
-       free(tosend);
        free(listmid);
-       pDelete(pile);
+       pDelete(pile_ptr);
        free(thread_data_array);
        free(ltdata);
 
index e5e5f65cb4cdf9e8d4d9004a12e006a6d245815f..1ee6e48c304168c4ec06ab98fe321391d908285f 100755 (executable)
@@ -192,7 +192,7 @@ $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
 
 if $DSMFLAG
 then
-EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -I$DSMRUNTIME"
+EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -I$DSMRUNTIME"
 FILES="$FILES $DSMRUNTIME/trans.c $DSMRUNTIME/mcpileq.c $DSMRUNTIME/objstr.c $DSMRUNTIME/dstm.c $DSMRUNTIME/mlookup.c $DSMRUNTIME/clookup.c $DSMRUNTIME/llookup.c $DSMRUNTIME/dstmserver.c $DSMRUNTIME/plookup.c $DSMRUNTIME/ip.c $DSMRUNTIME/queue.c $DSMRUNTIME/prelookup.c $DSMRUNTIME/machinepile.c $DSMRUNTIME/localobjects.c"
 fi