From dfe7901b14e08179a35a26d9a64346eb3a4a4ac5 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Wed, 7 May 2008 21:59:00 +0000 Subject: [PATCH] HACK to make things work --- Robust/src/Runtime/DSTM/interface/prelookup.c | 13 ++++++++++++- Robust/src/Runtime/DSTM/interface/prelookup.h | 19 ++++++++++++------- Robust/src/Runtime/DSTM/interface/trans.c | 1 - 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/Robust/src/Runtime/DSTM/interface/prelookup.c b/Robust/src/Runtime/DSTM/interface/prelookup.c index 05c2c2b3..7e81d5f3 100644 --- a/Robust/src/Runtime/DSTM/interface/prelookup.c +++ b/Robust/src/Runtime/DSTM/interface/prelookup.c @@ -1,5 +1,6 @@ /* LOCK THE ENTIRE HASH TABLE */ #include "prelookup.h" +extern objstr_t *prefetchcache; prehashtable_t pflookup; //Global prefetch cache table @@ -12,7 +13,8 @@ unsigned int prehashCreate(unsigned int size, float loadfactor) { printf("Calloc error %s %d\n", __FILE__, __LINE__); return 1; } - + pflookup.hack=NULL; + pflookup.hack2=NULL; pflookup.table = nodes; pflookup.size = size; pflookup.numelements = 0; // Initial number of elements in the hash @@ -192,6 +194,9 @@ void prehashClear() { int i, isFirstBin; prehashlistnode_t *ptr, *prev, *curr; + objstr_t *oldcache=prefetchcache; + prefetchcache=objstrCreate(prefetchcache->size); + pthread_mutex_lock(&pflookup.lock); ptr = pflookup.table; for(i = 0; i < pflookup.size; i++) { @@ -209,5 +214,11 @@ void prehashClear() { } } pthread_mutex_unlock(&pflookup.lock); + + if (pflookup.hack2!=NULL) { + objstrDelete(pflookup.hack2); + } + pflookup.hack2=pflookup.hack; + pflookup.hack=oldcache; } diff --git a/Robust/src/Runtime/DSTM/interface/prelookup.h b/Robust/src/Runtime/DSTM/interface/prelookup.h index ff74c65b..8b4c30be 100644 --- a/Robust/src/Runtime/DSTM/interface/prelookup.h +++ b/Robust/src/Runtime/DSTM/interface/prelookup.h @@ -4,6 +4,7 @@ #include #include #include +#include "dstm.h" #define LOADFACTOR 0.5 #define HASH_SIZE 100 @@ -14,14 +15,18 @@ typedef struct prehashlistnode { struct prehashlistnode *next; } prehashlistnode_t; +struct objstr; + typedef struct prehashtable { - prehashlistnode_t *table; // points to beginning of hash table - unsigned int size; - unsigned int numelements; - float loadfactor; - pthread_mutex_t lock; - pthread_mutexattr_t prefetchmutexattr; - pthread_cond_t cond; + prehashlistnode_t *table; // points to beginning of hash table + unsigned int size; + unsigned int numelements; + float loadfactor; + pthread_mutex_t lock; + pthread_mutexattr_t prefetchmutexattr; + pthread_cond_t cond; + struct objstr *hack2; + struct objstr *hack; } prehashtable_t; /* Prototypes for hash*/ diff --git a/Robust/src/Runtime/DSTM/interface/trans.c b/Robust/src/Runtime/DSTM/interface/trans.c index 56c03860..d60bea5f 100644 --- a/Robust/src/Runtime/DSTM/interface/trans.c +++ b/Robust/src/Runtime/DSTM/interface/trans.c @@ -654,7 +654,6 @@ void *transRequest(void *threadarg) { /* Read control message from Participant */ recv_data(sd, &control, sizeof(char)); recvcontrol = control; - /* Update common data structure and increment count */ tdata->recvmsg[tdata->thread_id].rcv_status = recvcontrol; -- 2.34.1