From 934247f9033a30208216074746aad7025aef34fa Mon Sep 17 00:00:00 2001 From: bdemsky Date: Fri, 10 Aug 2007 08:42:07 +0000 Subject: [PATCH] begin to replace hard coded oid and type fields with macros --- Robust/src/Runtime/DSTM/interface/dstm.c | 2 +- Robust/src/Runtime/DSTM/interface/dstm.h | 22 ++++ .../src/Runtime/DSTM/interface/dstmserver.c | 18 +-- Robust/src/Runtime/DSTM/interface/plookup.c | 16 +-- Robust/src/Runtime/DSTM/interface/testd-3.c | 124 +++++++++--------- Robust/src/Runtime/DSTM/interface/trans.c | 32 ++--- 6 files changed, 118 insertions(+), 96 deletions(-) diff --git a/Robust/src/Runtime/DSTM/interface/dstm.c b/Robust/src/Runtime/DSTM/interface/dstm.c index 62f6955f..7fbb553b 100644 --- a/Robust/src/Runtime/DSTM/interface/dstm.c +++ b/Robust/src/Runtime/DSTM/interface/dstm.c @@ -12,7 +12,7 @@ unsigned int getNewOID(void) { // Get the size of the object for a given type unsigned int objSize(objheader_t *object) { - return classsize[object->type]; + return classsize[TYPE(object)]; } /* END object header */ diff --git a/Robust/src/Runtime/DSTM/interface/dstm.h b/Robust/src/Runtime/DSTM/interface/dstm.h index 363f2f1d..08b1b05b 100644 --- a/Robust/src/Runtime/DSTM/interface/dstm.h +++ b/Robust/src/Runtime/DSTM/interface/dstm.h @@ -67,6 +67,28 @@ typedef struct objheader { char status; } objheader_t; +#define OID(x) x->oid + +#define TYPE(x) x->type + +#define STATUS(x) x->status + +/* +typedef struct objheader { + unsigned short version; + unsigned short rcount; +} objheader_t; + +#define OID(x)\ + ((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___nextobject___ + +#define STATUS(x)\ + ((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___localcopy___ + +#define TYPE(x)\ + ((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->type +*/ + typedef struct objstr { unsigned int size; //this many bytes are allocated after this header void *top; diff --git a/Robust/src/Runtime/DSTM/interface/dstmserver.c b/Robust/src/Runtime/DSTM/interface/dstmserver.c index 7dee7f73..e4a6ebdc 100644 --- a/Robust/src/Runtime/DSTM/interface/dstmserver.c +++ b/Robust/src/Runtime/DSTM/interface/dstmserver.c @@ -120,7 +120,7 @@ void *dstmAccept(void *acceptfd) } srcObj = mhashSearch(oid); h = (objheader_t *) srcObj; - size = sizeof(objheader_t) + sizeof(classsize[h->type]); + size = sizeof(objheader_t) + sizeof(classsize[TYPE(h)]); if (h == NULL) { ctrl = OBJECT_NOT_FOUND; if(send((int)acceptfd, &ctrl, sizeof(char), MSG_NOSIGNAL) < sizeof(char)) { @@ -277,7 +277,7 @@ int processClientReq(fixed_data_t *fixed, trans_commit_data_t *transinfo, for(i = 0; i< fixed->nummod; i++) { tmp_header = (objheader_t *)ptr; tmp_header->rcount = 1; - ptr += sizeof(objheader_t) + classsize[tmp_header->type]; + ptr += sizeof(objheader_t) + classsize[TYPE(tmp_header)]; } /* Unlock objects that was locked due to this transaction */ for(i = 0; i< transinfo->numlocked; i++) { @@ -366,18 +366,18 @@ char handleTransReq(fixed_data_t *fixed, trans_commit_data_t *transinfo, unsigne version = *((short *)(objread + incr)); } else {//Objs modified headptr = (objheader_t *) ptr; - oid = headptr->oid; + oid = OID(headptr); oidmod[objmod] = oid;//Array containing modified oids objmod++; version = headptr->version; - ptr += sizeof(objheader_t) + classsize[headptr->type]; + ptr += sizeof(objheader_t) + classsize[TYPE(headptr)]; } /* Check if object is still present in the machine since the beginning of TRANS_REQUEST */ if ((mobj = mhashSearch(oid)) == NULL) {/* Obj not found */ /* Save the oids not found and number of oids not found for later use */ - //oidnotfound[objnotfound] = ((objheader_t *)mobj)->oid; + //oidnotfound[objnotfound] = OID(((objheader_t *)mobj)); oidnotfound[objnotfound] = oid; objnotfound++; } else { /* If Obj found in machine (i.e. has not moved) */ @@ -405,7 +405,7 @@ char handleTransReq(fixed_data_t *fixed, trans_commit_data_t *transinfo, unsigne randomdelay(); /* Save all object oids that are locked on this machine during this transaction request call */ - oidlocked[objlocked] = ((objheader_t *)mobj)->oid; + oidlocked[objlocked] = OID(((objheader_t *)mobj)); objlocked++; if (version == ((objheader_t *)mobj)->version) { /* Check if versions match */ v_matchnolock++; @@ -505,7 +505,7 @@ int transCommitProcess(trans_commit_data_t *transinfo, int acceptfd) { printf("DEBUG -> removing object oid = %d\n", transinfo->objmod[i]); mhashRemove(transinfo->objmod[i]); mhashInsert(transinfo->objmod[i], (transinfo->modptr + offset)); - offset += sizeof(objheader_t) + classsize[header->type]; + offset += sizeof(objheader_t) + classsize[TYPE(header)]; /* Update object version number */ header = (objheader_t *) mhashSearch(transinfo->objmod[i]); @@ -570,7 +570,7 @@ int prefetchReq(int acceptfd) { /* send the oid, it's size, it's header and data */ header = (char *) mobj; head = (objheader_t *) header; - size = sizeof(objheader_t) + sizeof(classsize[head->type]); + size = sizeof(objheader_t) + sizeof(classsize[TYPE(head)]); *(buffer + index) = OBJECT_FOUND; index += sizeof(char); memcpy(buffer+index, &oid, sizeof(unsigned int)); @@ -592,7 +592,7 @@ int prefetchReq(int acceptfd) { } else {/* Obj Found */ /* send the oid, it's size, it's header and data */ head = (objheader_t *) header; - size = sizeof(objheader_t) + sizeof(classsize[head->type]); + size = sizeof(objheader_t) + sizeof(classsize[TYPE(head)]); *(buffer + index) = OBJECT_FOUND; index += sizeof(char); memcpy(buffer+index, &oid, sizeof(unsigned int)); diff --git a/Robust/src/Runtime/DSTM/interface/plookup.c b/Robust/src/Runtime/DSTM/interface/plookup.c index 7bf85693..31990bc7 100644 --- a/Robust/src/Runtime/DSTM/interface/plookup.c +++ b/Robust/src/Runtime/DSTM/interface/plookup.c @@ -38,13 +38,13 @@ plistnode_t *pInsert(plistnode_t *pile, objheader_t *headeraddr, unsigned int mi while(tmp != NULL) { if (tmp->mid == mid) { if ((headeraddr->status & DIRTY) == 1) { - tmp->oidmod[tmp->nummod] = headeraddr->oid; + tmp->oidmod[tmp->nummod] = OID(headeraddr); tmp->nummod = tmp->nummod + 1; - tmp->sum_bytes += sizeof(objheader_t) + classsize[headeraddr->type]; + tmp->sum_bytes += sizeof(objheader_t) + classsize[TYPE(headeraddr)]; } else { - tmp->oidread[tmp->numread] = headeraddr->oid; + tmp->oidread[tmp->numread] = OID(headeraddr); offset = (sizeof(unsigned int) + sizeof(short)) * tmp->numread; - memcpy(tmp->objread + offset, &headeraddr->oid, sizeof(unsigned int)); + *((unsigned int *)(tmp->objread + offset))=OID(headeraddr); offset += sizeof(unsigned int); memcpy(tmp->objread + offset, &headeraddr->version, sizeof(short)); tmp->numread = tmp->numread + 1; @@ -62,12 +62,12 @@ plistnode_t *pInsert(plistnode_t *pile, objheader_t *headeraddr, unsigned int mi } ptr->mid = mid; if ((headeraddr->status & DIRTY) == 1) { - ptr->oidmod[ptr->nummod] = headeraddr->oid; + ptr->oidmod[ptr->nummod] = OID(headeraddr); ptr->nummod = ptr->nummod + 1; - ptr->sum_bytes += sizeof(objheader_t) + classsize[headeraddr->type]; + ptr->sum_bytes += sizeof(objheader_t) + classsize[TYPE(headeraddr)]; } else { - ptr->oidread[ptr->numread] = headeraddr->oid; - memcpy(ptr->objread, &headeraddr->oid, sizeof(unsigned int)); + ptr->oidread[ptr->numread] = OID(headeraddr); + *((unsigned int *)ptr->objread)=OID(headeraddr); memcpy(ptr->objread + sizeof(unsigned int), &headeraddr->version, sizeof(short)); ptr->numread = ptr->numread + 1; } diff --git a/Robust/src/Runtime/DSTM/interface/testd-3.c b/Robust/src/Runtime/DSTM/interface/testd-3.c index d3261a21..9566b00f 100644 --- a/Robust/src/Runtime/DSTM/interface/testd-3.c +++ b/Robust/src/Runtime/DSTM/interface/testd-3.c @@ -32,19 +32,19 @@ int test1(void) { record = transStart(); printf("DEBUG -> Init done\n"); h1 = transRead(record, 1); - printf("oid = %d\tsize = %d\n", h1->oid,classsize[h1->type]); + printf("oid = %d\tsize = %d\n", OID(h1),classsize[h1->type]); h3 = transRead(record, 3); - printf("oid = %d\tsize = %d\n", h3->oid,classsize[h3->type]); + printf("oid = %d\tsize = %d\n", OID(h3),classsize[h3->type]); h4 = transRead(record, 4); - printf("oid = %d\tsize = %d\n", h4->oid,classsize[h4->type]); + printf("oid = %d\tsize = %d\n", OID(h4),classsize[h4->type]); h2 = transRead(record, 2); - printf("oid = %d\tsize = %d\n", h2->oid,classsize[h2->type]); + printf("oid = %d\tsize = %d\n", OID(h2),classsize[h2->type]); h4 = transRead(record, 4); - printf("oid = %d\tsize = %d\n", h4->oid,classsize[h4->type]); + printf("oid = %d\tsize = %d\n", OID(h4),classsize[h4->type]); h3 = transRead(record, 3); - printf("oid = %d\tsize = %d\n", h3->oid,classsize[h3->type]); + printf("oid = %d\tsize = %d\n", OID(h3),classsize[h3->type]); h5 = transRead(record, 5); - printf("oid = %d\tsize = %d\n", h5->oid,classsize[h5->type]); + printf("oid = %d\tsize = %d\n", OID(h5),classsize[h5->type]); } int test2(void) { @@ -63,17 +63,17 @@ int test2(void) { lhashInsert(6,1); printf("DEBUG -> Init done\n"); h1 = transRead(record, 1); - lhashInsert(h1->oid, 1); + lhashInsert(OID(h1), 1); h2 = transRead(record, 2); - lhashInsert(h2->oid, 1); + lhashInsert(OID(h2), 1); h3 = transRead(record, 3); - lhashInsert(h3->oid, 1); + lhashInsert(OID(h3), 1); h4 = transRead(record, 4); - lhashInsert(h4->oid, 1); + lhashInsert(OID(h4), 1); h5 = transRead(record, 5); - lhashInsert(h5->oid, 1); + lhashInsert(OID(h5), 1); h6 = transRead(record, 6); - lhashInsert(h6->oid, 1); + lhashInsert(OID(h6), 1); transCommit(record); @@ -96,41 +96,41 @@ int test2a(void) { //Create and Insert Oid 20 size = sizeof(objheader_t) + classsize[2] ; header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 20; + OID(header) = 20; header->type = 2; header->version = 1; header->rcount = 0; //? not sure how to handle this yet header->status = 0; header->status |= NEW; - mhashInsert(header->oid, header); + mhashInsert(OID(header), header); mid = iptoMid("128.200.9.29"); - lhashInsert(header->oid, mid); + lhashInsert(OID(header), mid); //Create and Insert Oid 21 size = sizeof(objheader_t) + classsize[1] ; header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 21; + OID(header) = 21; header->type = 1; header->version = 1; header->rcount = 0; //? not sure how to handle this yet header->status = 0; header->status |= NEW; - mhashInsert(header->oid, header); + mhashInsert(OID(header), header); mid = iptoMid("128.200.9.29"); - lhashInsert(header->oid, mid); + lhashInsert(OID(header), mid); //Create and Insert Oid 22 size = sizeof(objheader_t) + classsize[3] ; header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 22; + OID(header) = 22; header->type = 3; header->version = 1; header->rcount = 0; //? not sure how to handle this yet header->status = 0; header->status |= NEW; - mhashInsert(header->oid, header); + mhashInsert(OID(header), header); mid = iptoMid("128.200.9.29"); - lhashInsert(header->oid, mid); + lhashInsert(OID(header), mid); //Inserting into lhashtable mid = iptoMid("128.195.175.69"); //dw-1.eecs.uci.edu @@ -185,41 +185,41 @@ int test2b(void) { //Create and Insert Oid 20 size = sizeof(objheader_t) + classsize[2] ; header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 20; + OID(header) = 20; header->type = 2; header->version = 1; header->rcount = 0; //? not sure how to handle this yet header->status = 0; header->status |= NEW; - mhashInsert(header->oid, header); + mhashInsert(OID(header), header); mid = iptoMid("128.200.9.29"); - lhashInsert(header->oid, mid); + lhashInsert(OID(header), mid); //Create and Insert Oid 21 size = sizeof(objheader_t) + classsize[1] ; header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 21; + OID(header) = 21; header->type = 1; header->version = 1; header->rcount = 0; //? not sure how to handle this yet header->status = 0; header->status |= NEW; - mhashInsert(header->oid, header); + mhashInsert(OID(header), header); mid = iptoMid("128.200.9.29"); - lhashInsert(header->oid, mid); + lhashInsert(OID(header), mid); //Create and Insert Oid 22 size = sizeof(objheader_t) + classsize[3] ; header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 22; + OID(header) = 22; header->type = 3; header->version = 1; header->rcount = 0; //? not sure how to handle this yet header->status = 0; header->status |= NEW; - mhashInsert(header->oid, header); + mhashInsert(OID(header), header); mid = iptoMid("128.200.9.29"); - lhashInsert(header->oid, mid); + lhashInsert(OID(header), mid); //Inserting into lhashtable mid = iptoMid("128.195.175.69"); //dw-1.eecs.uci.edu @@ -341,41 +341,41 @@ int test5(void) { //Create and Insert Oid 20 size = sizeof(objheader_t) + classsize[2] ; header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 20; + OID(header) = 20; header->type = 2; header->version = 1; header->rcount = 0; //? not sure how to handle this yet header->status = 0; header->status |= NEW; - mhashInsert(header->oid, header); + mhashInsert(OID(header), header); mid = iptoMid("128.200.9.29"); - lhashInsert(header->oid, mid); + lhashInsert(OID(header), mid); //Create and Insert Oid 21 size = sizeof(objheader_t) + classsize[1] ; header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 21; + OID(header) = 21; header->type = 1; header->version = 1; header->rcount = 0; //? not sure how to handle this yet header->status = 0; header->status |= NEW; - mhashInsert(header->oid, header); + mhashInsert(OID(header), header); mid = iptoMid("128.200.9.29"); - lhashInsert(header->oid, mid); + lhashInsert(OID(header), mid); //Create and Insert Oid 22 size = sizeof(objheader_t) + classsize[3] ; header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 22; + OID(header) = 22; header->type = 3; header->version = 1; header->rcount = 0; //? not sure how to handle this yet header->status = 0; header->status |= NEW; - mhashInsert(header->oid, header); + mhashInsert(OID(header), header); mid = iptoMid("128.200.9.29"); - lhashInsert(header->oid, mid); + lhashInsert(OID(header), mid); //Inserting into lhashtable mid = iptoMid("128.195.175.69"); //dw-1.eecs.uci.edu @@ -434,20 +434,20 @@ int test5a(void) { //Create and Insert Oid 20 size = sizeof(objheader_t) + classsize[2] ; header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 20; + OID(header) = 20; header->type = 2; header->version = 1; header->rcount = 0; //? not sure how to handle this yet header->status = 0; header->status |= NEW; - mhashInsert(header->oid, header); + mhashInsert(OID(header), header); mid = iptoMid("128.200.9.29"); - lhashInsert(header->oid, mid); + lhashInsert(OID(header), mid); //Create and Insert Oid 21 size = sizeof(objheader_t) + classsize[1] ; header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 21; + OID(header) = 21; header->type = 1; //read object 31 (found on dw-1) if((h2 = transRead(myTrans, 31)) == NULL) { @@ -475,41 +475,41 @@ int test5b(void) { //Create and Insert Oid 20 size = sizeof(objheader_t) + classsize[2] ; header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 20; + OID(header) = 20; header->type = 2; header->version = 1; header->rcount = 0; //? not sure how to handle this yet header->status = 0; header->status |= NEW; - mhashInsert(header->oid, header); + mhashInsert(OID(header), header); mid = iptoMid("128.200.9.29"); - lhashInsert(header->oid, mid); + lhashInsert(OID(header), mid); //Create and Insert Oid 21 size = sizeof(objheader_t) + classsize[1] ; header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 21; + OID(header) = 21; header->type = 1; header->version = 1; header->rcount = 0; //? not sure how to handle this yet header->status = 0; header->status |= NEW; - mhashInsert(header->oid, header); + mhashInsert(OID(header), header); mid = iptoMid("128.200.9.29"); - lhashInsert(header->oid, mid); + lhashInsert(OID(header), mid); //Create and Insert Oid 22 size = sizeof(objheader_t) + classsize[3] ; header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 22; + OID(header) = 22; header->type = 3; header->version = 1; header->rcount = 0; //? not sure how to handle this yet header->status = 0; header->status |= NEW; - mhashInsert(header->oid, header); + mhashInsert(OID(header), header); mid = iptoMid("128.200.9.29"); - lhashInsert(header->oid, mid); + lhashInsert(OID(header), mid); //Inserting into lhashtable mid = iptoMid("128.195.175.69"); //dw-1.eecs.uci.edu @@ -575,41 +575,41 @@ int test7(void) { //Create and Insert Oid 20 size = sizeof(objheader_t) + classsize[2] ; header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 20; + OID(header) = 20; header->type = 2; header->version = 1; header->rcount = 0; //? not sure how to handle this yet header->status = 0; header->status |= NEW; - mhashInsert(header->oid, header); + mhashInsert(OID(header), header); mid = iptoMid("128.200.9.29"); - lhashInsert(header->oid, mid); + lhashInsert(OID(header), mid); //Create and Insert Oid 21 size = sizeof(objheader_t) + classsize[1] ; header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 21; + OID(header) = 21; header->type = 1; header->version = 1; header->rcount = 0; //? not sure how to handle this yet header->status = 0; header->status |= NEW; - mhashInsert(header->oid, header); + mhashInsert(OID(header), header); mid = iptoMid("128.200.9.29"); - lhashInsert(header->oid, mid); + lhashInsert(OID(header), mid); //Create and Insert Oid 22 size = sizeof(objheader_t) + classsize[3] ; header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 22; + OID(header) = 22; header->type = 3; header->version = 1; header->rcount = 0; //? not sure how to handle this yet header->status = 0; header->status |= NEW; - mhashInsert(header->oid, header); + mhashInsert(OID(header), header); mid = iptoMid("128.200.9.29"); - lhashInsert(header->oid, mid); + lhashInsert(OID(header), mid); //Inserting into lhashtable mid = iptoMid("128.195.175.69"); //dw-1.eecs.uci.edu diff --git a/Robust/src/Runtime/DSTM/interface/trans.c b/Robust/src/Runtime/DSTM/interface/trans.c index da8e6402..aa1bcc99 100644 --- a/Robust/src/Runtime/DSTM/interface/trans.c +++ b/Robust/src/Runtime/DSTM/interface/trans.c @@ -166,19 +166,19 @@ objheader_t *transRead(transrecord_t *record, unsigned int oid) } else if ((objheader = (objheader_t *) mhashSearch(oid)) != NULL) { /* Look up in machine lookup table and copy into cache*/ tmp = mhashSearch(oid); - size = sizeof(objheader_t)+classsize[tmp->type]; + size = sizeof(objheader_t)+classsize[TYPE(tmp)]; objcopy = objstrAlloc(record->cache, size); memcpy(objcopy, (void *)objheader, size); /* Insert into cache's lookup table */ - chashInsert(record->lookupTable, objheader->oid, objcopy); + chashInsert(record->lookupTable, OID(objheader), objcopy); return(objcopy); } else if((tmp = (objheader_t *) prehashSearch(oid)) != NULL) { /* Look up in prefetch cache */ found = 1; - size = sizeof(objheader_t)+classsize[tmp->type]; + size = sizeof(objheader_t)+classsize[TYPE(tmp)]; objcopy = objstrAlloc(record->cache, size); memcpy(objcopy, (void *)tmp, size); /* Insert into cache's lookup table */ - chashInsert(record->lookupTable, tmp->oid, objcopy); + chashInsert(record->lookupTable, OID(tmp), objcopy); return(objcopy); } else { /* If not found anywhere, then block until object appears in prefetch cache */ pthread_mutex_lock(&pflookup.lock); @@ -189,11 +189,11 @@ objheader_t *transRead(transrecord_t *record, unsigned int oid) /* Check Prefetch cache again */ if((tmp = (objheader_t *) prehashSearch(oid)) != NULL) { /* Look up in prefetch cache */ found = 1; - size = sizeof(objheader_t)+classsize[tmp->type]; + size = sizeof(objheader_t)+classsize[TYPE(tmp)]; objcopy = objstrAlloc(record->cache, size); memcpy(objcopy, (void *)tmp, size); /* Insert into cache's lookup table */ - chashInsert(record->lookupTable, tmp->oid, objcopy); + chashInsert(record->lookupTable, OID(tmp), objcopy); return(objcopy); } else { pthread_mutex_unlock(&pflookup.lock); @@ -221,13 +221,13 @@ objheader_t *transRead(transrecord_t *record, unsigned int oid) objheader_t *transCreateObj(transrecord_t *record, unsigned short type) { objheader_t *tmp = (objheader_t *) objstrAlloc(record->cache, (sizeof(objheader_t) + classsize[type])); - tmp->oid = getNewOID(); - tmp->type = type; + OID(tmp) = getNewOID(); + TYPE(tmp) = type; tmp->version = 1; tmp->rcount = 0; //? not sure how to handle this yet tmp->status = 0; tmp->status |= NEW; - chashInsert(record->lookupTable, tmp->oid, tmp); + chashInsert(record->lookupTable, OID(tmp), tmp); return tmp; } @@ -484,7 +484,7 @@ void *transRequest(void *threadarg) { for(i = 0; i < tdata->buffer->f.nummod ; i++) { int size; headeraddr = chashSearch(tdata->rec->lookupTable, tdata->buffer->oidmod[i]); - size=sizeof(objheader_t)+classsize[headeraddr->type]; + size=sizeof(objheader_t)+classsize[TYPE(headeraddr)]; if (send(sd, headeraddr, size, MSG_NOSIGNAL) < size) { perror("Error sending obj modified for thread\n"); return NULL; @@ -750,11 +750,11 @@ void *handleLocalReq(void *threadarg) { version = *((short *)(localtdata->tdata->buffer->objread + incr)); } else {//Objs modified headptr = (objheader_t *) ptr; - oid = headptr->oid; + oid = OID(headptr); oidmod[objmod] = oid;//Array containing modified oids objmod++; version = headptr->version; - ptr += sizeof(objheader_t) + classsize[headptr->type]; + ptr += sizeof(objheader_t) + classsize[TYPE(headptr)]; } /* Check if object is still present in the machine since the beginning of TRANS_REQUEST */ @@ -763,7 +763,7 @@ void *handleLocalReq(void *threadarg) { if ((mobj = mhashSearch(oid)) == NULL) {/* Obj not found */ /* Save the oids not found and number of oids not found for later use */ - oidnotfound[objnotfound] = ((objheader_t *)mobj)->oid; + oidnotfound[objnotfound] = OID(((objheader_t *)mobj)); objnotfound++; } else { /* If Obj found in machine (i.e. has not moved) */ /* Check if Obj is locked by any previous transaction */ @@ -783,7 +783,7 @@ void *handleLocalReq(void *threadarg) { randomdelay(); /* Save all object oids that are locked on this machine during this transaction request call */ - oidlocked[objlocked] = ((objheader_t *)mobj)->oid; + oidlocked[objlocked] = OID(((objheader_t *)mobj)); objlocked++; if (version == ((objheader_t *)mobj)->version) { /* Check if versions match */ v_matchnolock++; @@ -896,7 +896,7 @@ int transAbortProcess(void *modptr, unsigned int *objlocked, int numlocked, int for(i = 0; i< nummod; i++) { tmp_header = (objheader_t *)ptr; tmp_header->rcount = 1; - ptr += sizeof(objheader_t) + classsize[tmp_header->type]; + ptr += sizeof(objheader_t) + classsize[TYPE(tmp_header)]; } /* Unlock objects that was locked due to this transaction */ for(i = 0; i< numlocked; i++) { @@ -931,7 +931,7 @@ int transComProcess(trans_commit_data_t *transinfo) { /* Change ptr address in mhash table */ mhashRemove(transinfo->objmod[i]); mhashInsert(transinfo->objmod[i], (transinfo->modptr + offset)); - offset += sizeof(objheader_t) + classsize[header->type]; + offset += sizeof(objheader_t) + classsize[TYPE(header)]; /* Update object version number */ header = (objheader_t *) mhashSearch(transinfo->objmod[i]); -- 2.34.1