From 718edd250963f2ba81aec4f8eaa79362d59f0257 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Fri, 10 Aug 2007 08:49:44 +0000 Subject: [PATCH] replace access to status field with macro --- Robust/src/Runtime/DSTM/interface/dstmserver.c | 8 ++++---- Robust/src/Runtime/DSTM/interface/plookup.c | 4 ++-- Robust/src/Runtime/DSTM/interface/trans.c | 11 +++++------ 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Robust/src/Runtime/DSTM/interface/dstmserver.c b/Robust/src/Runtime/DSTM/interface/dstmserver.c index e4a6ebdc..30dd47d0 100644 --- a/Robust/src/Runtime/DSTM/interface/dstmserver.c +++ b/Robust/src/Runtime/DSTM/interface/dstmserver.c @@ -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; inumlocked; i++) { header = (objheader_t *) mhashSearch(transinfo->objlocked[i]); - header->status &= ~(LOCK); + STATUS(header) &= ~(LOCK); } //TODO Update location lookup table diff --git a/Robust/src/Runtime/DSTM/interface/plookup.c b/Robust/src/Runtime/DSTM/interface/plookup.c index 31990bc7..07a19fd2 100644 --- a/Robust/src/Runtime/DSTM/interface/plookup.c +++ b/Robust/src/Runtime/DSTM/interface/plookup.c @@ -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)]; diff --git a/Robust/src/Runtime/DSTM/interface/trans.c b/Robust/src/Runtime/DSTM/interface/trans.c index aa1bcc99..31d86115 100644 --- a/Robust/src/Runtime/DSTM/interface/trans.c +++ b/Robust/src/Runtime/DSTM/interface/trans.c @@ -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; inumlocked; i++) { header = (objheader_t *) mhashSearch(transinfo->objlocked[i]); - header->status &= ~(LOCK); + STATUS(header) &= ~(LOCK); } //TODO Update location lookup table -- 2.34.1