From 5a7bd37de30d8a85d276fe80834ed021d32d6075 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Tue, 19 Oct 2010 02:43:26 +0000 Subject: [PATCH] changes --- Robust/src/Runtime/oooJava/hashStructure.c | 26 +++++++++------------- Robust/src/Runtime/oooJava/hashStructure.h | 6 ++--- Robust/src/Tests/rcr/test.java | 13 ++++++++--- Robust/src/buildscript | 2 +- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/Robust/src/Runtime/oooJava/hashStructure.c b/Robust/src/Runtime/oooJava/hashStructure.c index 71348090..872263b2 100644 --- a/Robust/src/Runtime/oooJava/hashStructure.c +++ b/Robust/src/Runtime/oooJava/hashStructure.c @@ -1,5 +1,5 @@ #include "hashStructure.h" -#include "WaitingQueue.h" +//#include "WaitingQueue.h" #include "mlp_lock.h" #include "mem.h" @@ -19,7 +19,7 @@ HashStructure* rcr_createHashtable(int sizeofWaitingQueue){ newTable->array[i].tail=NULL; } - newTable->waitingQueue=mallocWaitingQueue(sizeofWaitingQueue); + // newTable->waitingQueue=mallocWaitingQueue(sizeofWaitingQueue); return newTable; } @@ -87,12 +87,14 @@ int rcr_WRITEBINCASE(HashStructure *T, void *ptr, int traverserID, SESEcommon *t if (bintail->type == WRITEBIN) { TraverserData * td = &(((WriteBinItem_rcr *)bintail)->val); //last one is to check for SESE blocks in a while loop. - if(unlikely(td->resumePtr == ptr) && td->traverserID == traverserID && td->task == task) { - return bintail->status; + if(unlikely(td->task == task)) { + be->head=val; + //return ready...this constraint is already handled + return READY; } } else if (bintail->type == READBIN) { TraverserData * td = &((ReadBinItem_rcr *)bintail)->array[((ReadBinItem_rcr *)bintail)->index - 1]; - if(unlikely(td->resumePtr == ptr) && td->traverserID == traverserID) { + if(unlikely(td->task == task)) { //if it matches, then we remove it and the code below will upgrade it to a write. ((ReadBinItem_rcr *)bintail)->index--; bintail->total--; @@ -239,15 +241,8 @@ void rcr_TAILWRITECASE(HashStructure *T, void *ptr, BinItem_rcr *val, BinItem_rc //TODO write deletion/removal methods -/* -RETIREHASHTABLE(MemoryQueue *q, REntry *r) { - Hashtable *T=r->hashtable; - BinItem_rcr *b=r->binitem; - RETIREBIN(T,r,b); -} - -RETIREBIN(Hashtable *T, REntry *r, BinItem_rcr *b) { - int key=generateKey( OBJPTRPTR_2_OBJOID( r->pointer ) ); +RETIREHASHTABLE(HashStructure *T, SESECommon *task, int key) { + BinItem_rcr *b=T->array[key].head; if(isFineRead(r)) { atomic_dec(&b->total); } @@ -258,6 +253,7 @@ RETIREBIN(Hashtable *T, REntry *r, BinItem_rcr *b) { val=(BinItem_rcr*)0x1; val=(BinItem_rcr*)LOCKXCHG((unsigned INTPTR*)&(T->array[key]->head), (unsigned INTPTR)val); } while(val==(BinItem_rcr*)0x1); + // at this point have locked bin BinItem_rcr *ptr=val; int haveread=FALSE; @@ -304,7 +300,7 @@ RETIREBIN(Hashtable *T, REntry *r, BinItem_rcr *b) { T->array[key]->head=val; // release lock } } -*/ + /* //Int will return success/fail. -1 indicates error (i.e. there's nothing there). diff --git a/Robust/src/Runtime/oooJava/hashStructure.h b/Robust/src/Runtime/oooJava/hashStructure.h index 67716af6..1bcde9e7 100644 --- a/Robust/src/Runtime/oooJava/hashStructure.h +++ b/Robust/src/Runtime/oooJava/hashStructure.h @@ -2,7 +2,7 @@ #define HASHSTRUCTURE_H_ #include "mlp_runtime.h" -#include "WaitingQueue.h" +//#include "WaitingQueue.h" #define ITEM_NOT_AT_FRONT_OF_WAITINGQ 3 #define TRAVERSER_FINISHED 2 @@ -26,7 +26,7 @@ #define RNUMBINS 64 #define RNUMREAD 64 #define RNUMRENTRY 256 -#define RH_MASK (RNUMBINS<<4)-1 +#define RH_MASK (RNUMBINS)-1 //Note: put resolved things at the end and unresolved at the front. typedef struct BinItem_rcr { @@ -65,7 +65,7 @@ typedef struct BinElement_rcr { typedef struct Hashtable_rcr { BinElement_rcr array[RNUMBINS]; - WaitingQueueBin * waitingQueue; + // WaitingQueueBin * waitingQueue; } HashStructure; //Todo this is a clone of REntry, remove data fields as necessary diff --git a/Robust/src/Tests/rcr/test.java b/Robust/src/Tests/rcr/test.java index 40e47edc..2f5ee3e0 100644 --- a/Robust/src/Tests/rcr/test.java +++ b/Robust/src/Tests/rcr/test.java @@ -1,16 +1,23 @@ public class test { - int x; + foo f; public test() {} public static void main(String x[]) { test r=new test(); + r.f=new foo(); int z; sese foo { - r.x=2; + r.f.x=2; } sese bar { - z=r.x; + z=r.f.x; } System.out.println(z); } +} + +class foo { + foo() { + } + int x; } \ No newline at end of file diff --git a/Robust/src/buildscript b/Robust/src/buildscript index 26c0e815..a1b162f8 100755 --- a/Robust/src/buildscript +++ b/Robust/src/buildscript @@ -1214,7 +1214,7 @@ fi if $RCR then -FILES="$FILES $tmpbuilddirectory/RuntimeConflictResolver.c $ROBUSTROOT/Runtime/oooJava/hashRCR.c $ROBUSTROOT/Runtime/oooJava/Queue_RCR.c $ROBUSTROOT/Runtime/oooJava/hashStructure.c $ROBUSTROOT/Runtime/oooJava/WaitingQueue.c $ROBUSTROOT/Runtime/oooJava/trqueue.c $ROBUSTROOT/Runtime/oooJava/rcr_runtime.c" +FILES="$FILES $tmpbuilddirectory/RuntimeConflictResolver.c $ROBUSTROOT/Runtime/oooJava/hashRCR.c $ROBUSTROOT/Runtime/oooJava/Queue_RCR.c $ROBUSTROOT/Runtime/oooJava/hashStructure.c $ROBUSTROOT/Runtime/oooJava/trqueue.c $ROBUSTROOT/Runtime/oooJava/rcr_runtime.c" fi if $MLP_ON -- 2.34.1