replace access to status field with macro
authorbdemsky <bdemsky>
Fri, 10 Aug 2007 08:49:44 +0000 (08:49 +0000)
committerbdemsky <bdemsky>
Fri, 10 Aug 2007 08:49:44 +0000 (08:49 +0000)
Robust/src/Runtime/DSTM/interface/dstmserver.c
Robust/src/Runtime/DSTM/interface/plookup.c
Robust/src/Runtime/DSTM/interface/trans.c

index e4a6ebdce9982d2924ff383d63f3cae3be0e9da0..30dd47d0da46e5530cde028862df47791348e3e3 100644 (file)
@@ -282,7 +282,7 @@ int processClientReq(fixed_data_t *fixed, trans_commit_data_t *transinfo,
                        /* Unlock objects that was locked due to this transaction */
                        for(i = 0; i< transinfo->numlocked; i++) {
                                header = mhashSearch(transinfo->objlocked[i]);// find the header address
-                               ((objheader_t *)header)->status &= ~(LOCK);             
+                               STATUS(((objheader_t *)header)) &= ~(LOCK);             
                        }
                
                        /* Send ack to Coordinator */
@@ -382,7 +382,7 @@ char handleTransReq(fixed_data_t *fixed, trans_commit_data_t *transinfo, unsigne
                        objnotfound++;
                } else { /* If Obj found in machine (i.e. has not moved) */
                        /* Check if Obj is locked by any previous transaction */
-                       if ((((objheader_t *)mobj)->status & LOCK) == LOCK) {           
+                       if ((STATUS(((objheader_t *)mobj)) & LOCK) == LOCK) {           
                                if (version == ((objheader_t *)mobj)->version) {      /* If not locked then match versions */
                                        v_matchlock++;
                                } else {/* If versions don't match ...HARD ABORT */
@@ -397,7 +397,7 @@ char handleTransReq(fixed_data_t *fixed, trans_commit_data_t *transinfo, unsigne
                                        return control;
                                }
                        } else {/* If Obj is not locked then lock object */
-                               ((objheader_t *)mobj)->status |= LOCK;
+                               STATUS(((objheader_t *)mobj)) |= LOCK;
                               
                                /*TESTING Add random wait to make transactions run for a long time such that
                                 * we can test for soft abort case */
@@ -514,7 +514,7 @@ int transCommitProcess(trans_commit_data_t *transinfo, int acceptfd) {
        /* Unlock locked objects */
        for(i=0; i<transinfo->numlocked; i++) {
                header = (objheader_t *) mhashSearch(transinfo->objlocked[i]);
-               header->status &= ~(LOCK);
+               STATUS(header) &= ~(LOCK);
        }
 
        //TODO Update location lookup table
index 31990bc74af7c8460acdd60cfb3db19524e9bc7c..07a19fd2a6e4fb2fa2cd79906735d455f04666b7 100644 (file)
@@ -37,7 +37,7 @@ plistnode_t *pInsert(plistnode_t *pile, objheader_t *headeraddr, unsigned int mi
        //Add oid into a machine that is a part of the pile linked list structure
        while(tmp != NULL) {
                if (tmp->mid == mid) {
-                       if ((headeraddr->status & DIRTY) == 1) {
+                       if (STATUS(headeraddr) & DIRTY) {
                                tmp->oidmod[tmp->nummod] = OID(headeraddr);
                                tmp->nummod = tmp->nummod + 1;
                                tmp->sum_bytes += sizeof(objheader_t) + classsize[TYPE(headeraddr)];
@@ -61,7 +61,7 @@ plistnode_t *pInsert(plistnode_t *pile, objheader_t *headeraddr, unsigned int mi
                        return NULL;
                }
                ptr->mid = mid;
-               if ((headeraddr->status & DIRTY) == 1) {
+               if (STATUS(headeraddr) & DIRTY) {
                        ptr->oidmod[ptr->nummod] = OID(headeraddr);
                        ptr->nummod = ptr->nummod + 1;
                        ptr->sum_bytes += sizeof(objheader_t) + classsize[TYPE(headeraddr)];
index aa1bcc9966214ae7162faedee1cad53493eed8f6..31d86115c307f94047c28e9fa731da04e35dd183 100644 (file)
@@ -225,8 +225,7 @@ objheader_t *transCreateObj(transrecord_t *record, unsigned short type)
        TYPE(tmp) = type;
        tmp->version = 1;
        tmp->rcount = 0; //? not sure how to handle this yet
-       tmp->status = 0;
-       tmp->status |= NEW;
+       STATUS(tmp) = NEW;
        chashInsert(record->lookupTable, OID(tmp), tmp);
        return tmp;
 }
@@ -767,7 +766,7 @@ void *handleLocalReq(void *threadarg) {
                        objnotfound++;
                } else { /* If Obj found in machine (i.e. has not moved) */
                        /* Check if Obj is locked by any previous transaction */
-                       if ((((objheader_t *)mobj)->status & LOCK) == LOCK) {
+                       if (STATUS(((objheader_t *)mobj)) & LOCK) {
                                if (version == ((objheader_t *)mobj)->version) {      /* If not locked then match versions */ 
                                        v_matchlock++;
                                } else {/* If versions don't match ...HARD ABORT */
@@ -778,7 +777,7 @@ void *handleLocalReq(void *threadarg) {
                                        //return tdata->recvmsg[tdata->thread_id].rcv_status;  
                                }
                        } else {/* If Obj is not locked then lock object */
-                               ((objheader_t *)mobj)->status |= LOCK;
+                               STATUS(((objheader_t *)mobj)) |= LOCK;
                                //TODO Remove this for Testing
                                randomdelay();
 
@@ -901,7 +900,7 @@ int transAbortProcess(void *modptr, unsigned int *objlocked, int numlocked, int
        /* Unlock objects that was locked due to this transaction */
        for(i = 0; i< numlocked; i++) {
                header = mhashSearch(objlocked[i]);// find the header address
-               ((objheader_t *)header)->status &= ~(LOCK);
+               STATUS(((objheader_t *)header)) &= ~(LOCK);
        }
 
        /* Send ack to Coordinator */
@@ -941,7 +940,7 @@ int transComProcess(trans_commit_data_t *transinfo) {
        /* Unlock locked objects */
        for(i=0; i<transinfo->numlocked; i++) {
                header = (objheader_t *) mhashSearch(transinfo->objlocked[i]);
-               header->status &= ~(LOCK);
+               STATUS(header) &= ~(LOCK);
        }
 
        //TODO Update location lookup table