From ea17821a263480e936824dee206d36dfdf2cfd6f Mon Sep 17 00:00:00 2001 From: bdemsky Date: Tue, 30 Jun 2009 19:32:36 +0000 Subject: [PATCH] really annoying bug fixed...my benchmarks run now --- Robust/src/Runtime/STM/stm.c | 19 +++++++++++++++---- Robust/src/Runtime/STM/stmlookup.c | 16 ++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/Robust/src/Runtime/STM/stm.c b/Robust/src/Runtime/STM/stm.c index 44d1c7a6..ef5db71d 100644 --- a/Robust/src/Runtime/STM/stm.c +++ b/Robust/src/Runtime/STM/stm.c @@ -498,6 +498,9 @@ int traverseCache() { } } else { +#ifdef DELAYCOMP + //TODO: check to see if we already have lock +#endif if(version == header->version) { /* versions match */ softabort=1; @@ -547,7 +550,11 @@ int traverseCache() { do { if(node->key == key) { - goto nextloop; + objheader_t * headeraddr=&((objheader_t *) node->val)[-1]; + if(STATUS(headeraddr) & DIRTY) { + goto nextloop; + } else + break; } node = node->next; } while(node != NULL); @@ -583,7 +590,6 @@ int traverseCache() { unsigned int version=oidrdversion[i]; if(header->lock>0) { //not write locked if(version != header->version) { /* versions do not match */ - oidrdlocked[numoidrdlocked++] = header; #ifdef DELAYCOMP transAbortProcess(oidwrlocked, numoidwrtotal); #else @@ -604,7 +610,6 @@ int traverseCache() { //couldn't get lock because we already have it //check if it is the right version number if (version!=header->version) { - oidrdlocked[numoidrdlocked++] = header; transAbortProcess(oidwrlocked, numoidwrtotal); #ifdef STMSTATS ABORTCOUNT(header); @@ -782,7 +787,10 @@ int alttraverseCache() { do { if(node->key == key) { - goto nextloop; + objheader_t * headeraddr=&((objheader_t *) node->val)[-1]; + if(STATUS(headeraddr) & DIRTY) { + goto nextloop; + } } node = node->next; } while(node != NULL); @@ -832,6 +840,9 @@ int alttraverseCache() { freearrays; return TRANS_ABORT; } +#ifdef DELAYCOMP + //TODO: check to see if we already have lock +#endif } else { /* cannot aquire lock */ if(version == header->version) { softabort=1; diff --git a/Robust/src/Runtime/STM/stmlookup.c b/Robust/src/Runtime/STM/stmlookup.c index ab961244..7c7afe33 100644 --- a/Robust/src/Runtime/STM/stmlookup.c +++ b/Robust/src/Runtime/STM/stmlookup.c @@ -200,6 +200,22 @@ void dc_t_chashDelete() { dc_c_structs=NULL; dc_c_list=NULL; } + +// Search for an address for a given oid +INLINE void * dc_t_chashSearch(void * key) { + //REMOVE HASH FUNCTION CALL TO MAKE SURE IT IS INLINED HERE + chashlistnode_t *node = &dc_c_table[(((unsigned INTPTR)key) & dc_c_mask)>>4]; + + do { + if(node->key == key) { + return node->val; + } + node = node->next; + } while(node != NULL); + + return NULL; +} + #endif void t_chashCreate(unsigned int size, double loadfactor) { -- 2.34.1