From: bdemsky Date: Sun, 24 Oct 2010 08:56:28 +0000 (+0000) Subject: bug fixes X-Git-Url: http://plrg.eecs.uci.edu/git/?p=IRC.git;a=commitdiff_plain;h=b37615d9a26fc6aeddd64d941494d3774282bcce bug fixes --- diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index e047e48a..e14ff60a 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -3943,7 +3943,7 @@ public class BuildCode { if(state.RCR) { //flag the SESE status as 1...it will be reset - output.println(" seseToIssue->rcrstatus=1;"); + output.println(" seseToIssue->common.rcrstatus=1;"); } // there are pointers to SESE records the newly-issued SESE @@ -4603,7 +4603,7 @@ public class BuildCode { output.println(" struct rcrRecord *rec="+paramsprefix+"->rcrRecords[idx];"); output.println(" while(rec!=NULL) {"); output.println(" for(idx2=0;idx2index;idx2++) {"); - output.println(" rcr_RETIREHASHTABLE(allHashStructures[0],rec,rec->array[idx2], rcr->ptrarray[idx2]);"); + output.println(" rcr_RETIREHASHTABLE(allHashStructures[0],rec,rec->array[idx2], (BinItem_rcr *) rcr->ptrarray[idx2]);"); output.println(" }");//exit idx2 for loop output.println(" rec=rec->next;"); output.println(" }");//exit rec while loop diff --git a/Robust/src/IR/Flat/RuntimeConflictResolver.java b/Robust/src/IR/Flat/RuntimeConflictResolver.java index bf2da26c..abc069c3 100644 --- a/Robust/src/IR/Flat/RuntimeConflictResolver.java +++ b/Robust/src/IR/Flat/RuntimeConflictResolver.java @@ -723,8 +723,8 @@ public class RuntimeConflictResolver { //Casts the ptr to a generic object struct so we can get to the ptr->allocsite field. cFile.println("struct ___Object___ * ptr = (struct ___Object___ *) InVar;\nif (InVar != NULL) {\n " + queryVistedHashtable + "(ptr);\n do {"); if (taint.isRBlockTaint()) { - cFile.println(" if(unlikely(record->doneExecuting)) {"); - cFile.println(" record->rcrstatus=0;"); + cFile.println(" if(unlikely(record->common.doneExecuting)) {"); + cFile.println(" record->common.rcrstatus=0;"); cFile.println(" return;"); cFile.println(" }"); } diff --git a/Robust/src/Runtime/mlp_runtime.h b/Robust/src/Runtime/mlp_runtime.h index 6a79d80d..04928a29 100644 --- a/Robust/src/Runtime/mlp_runtime.h +++ b/Robust/src/Runtime/mlp_runtime.h @@ -158,6 +158,29 @@ typedef struct REntry_t{ int isBufMode; } REntry; +#ifdef RCR +#define RCRSIZE 32 +#define RUNBIAS 1000000 + +struct rcrRecord { + int count; + int index; + int flag; + int array[RCRSIZE]; + void * ptrarray[RCRSIZE]; + struct rcrRecord *next; +}; + +typedef struct SESEstall_t { + SESEcommon common; + int size; + void * next; + struct ___Object___* ___obj___; + struct rcrRecord rcrRecords[1]; + int tag; +} SESEstall; +#endif + typedef struct MemoryQueueItem_t { int type; // hashtable:0, vector:1, singleitem:2 int total; //total non-retired diff --git a/Robust/src/Runtime/oooJava/hashStructure.c b/Robust/src/Runtime/oooJava/hashStructure.c index 2c8922e9..1fcd5ce2 100644 --- a/Robust/src/Runtime/oooJava/hashStructure.c +++ b/Robust/src/Runtime/oooJava/hashStructure.c @@ -1,9 +1,10 @@ #include "hashStructure.h" //#include "WaitingQueue.h" #include "mlp_lock.h" +#include "rcr_runtime.h" #include "mem.h" #include "classdefs.h" -#include "rcr_runtime.h" + //NOTE: this is only temporary (for testing) and will be removed in favor of thread local variables //It's basically an array of hashStructures so we can simulate what would happen in a many-threaded version @@ -19,15 +20,15 @@ inline enqueuerecord(struct rcrRecord *rcrrec, int tmpkey, BinItem_rcr *item) { struct rcrRecord * tmprec; if(likely(rcrrec->indexindex++; - rcrrec->ptrarray[index]=item; + rcrrec->ptrarray[index]=(void *) item; rcrrec->array[index]=tmpkey; } else if(likely((tmprec=rcrrec->next)!=NULL)&&likely(tmprec->indexindex++; - tmprec->ptrarray[index]=item; + tmprec->ptrarray[index]=(void *) item; tmprec->array[index]=tmpkey; } else { struct rcrRecord *trec=RUNMALLOC(sizeof(struct rcrRecord)); - trec->ptrarray[0]=item; + trec->ptrarray[0]=(void *) item; trec->array[0]=tmpkey; trec->index=1; trec->next=tmprec; @@ -161,7 +162,7 @@ inline int rcr_BWRITEBINCASE(HashStructure *T, int key, SESEcommon *task, struct if (status&SPEC) { return READY; } else { - enqueuerecord(rcrrec, key, b); + enqueuerecord(rcrrec, key, (BinItem_rcr *) b); return READY; } } @@ -178,7 +179,7 @@ inline int rcr_BWRITEBINCASE(HashStructure *T, int key, SESEcommon *task, struct return status&READY; } else { if (!(status&SPEC)) - enqueuerecord(rcrrec, key, b); + enqueuerecord(rcrrec, key, (BinItem_rcr *) b); return status&READY; } } @@ -186,13 +187,13 @@ inline int rcr_BWRITEBINCASE(HashStructure *T, int key, SESEcommon *task, struct inline int rcr_BREADBINCASE(HashStructure *T, int key, SESEcommon *task, struct rcrRecord *rcrrec, int index, int mode) { BinItem_rcr * val; BinElement_rcr * be = &(T->array[key]); - + //LOCK is still needed as different threads will remove items... do { val=(BinItem_rcr *)0x1; val=(BinItem_rcr *)LOCKXCHG((unsigned INTPTR*)&(be->head), (unsigned INTPTR)val); } while(val==(BinItem_rcr*)0x1); - + if (val==NULL) { BinItem_rcr * b=(BinItem_rcr*)rcr_createReadBinItem(); ReadBinItem_rcr* readbin=(ReadBinItem_rcr*)b; @@ -213,7 +214,7 @@ inline int rcr_BREADBINCASE(HashStructure *T, int key, SESEcommon *task, struct BinItem_rcr * bintail=be->tail; - + //check if already added item or not. if (ISWRITEBIN(bintail->type)) { WriteBinItem_rcr * td = (WriteBinItem_rcr *)bintail; @@ -235,6 +236,7 @@ inline int rcr_BREADBINCASE(HashStructure *T, int key, SESEcommon *task, struct } else { return status; } + } } else { TraverserData * td = &((ReadBinItem_rcr *)bintail)->array[((ReadBinItem_rcr *)bintail)->index - 1]; if (unlikely(td->task==task)) { @@ -316,11 +318,11 @@ int rcr_WTREADBINCASE(HashStructure *T, int key, SESEcommon * task, struct rcrRe rb->item.status=status; T->array[key].tail->next=(BinItem_rcr*)rb; T->array[key].tail=(BinItem_rcr*)rb; - enqueuerecord(rcrrec, key, rb); + enqueuerecord(rcrrec, key, (BinItem_rcr *) rb); } else { // group into old tail td = &readbintail->array[readbintail->index++]; atomic_inc(&readbintail->item.total); - enqueuerecord(rcrrec, key, readbintail); + enqueuerecord(rcrrec, key, (BinItem_rcr *) readbintail); } td->task=task; @@ -338,7 +340,7 @@ void rcr_TAILWRITECASE(HashStructure *T, BinItem_rcr *val, BinItem_rcr *bintail, td->task=task; td->bitindex=1<array[key].tail->next=(BinItem_rcr*)rb; T->array[key].tail=(BinItem_rcr*)rb; @@ -352,7 +354,7 @@ void rcr_RETIREHASHTABLE(HashStructure *T, SESEcommon *task, int key, BinItem_rc return; } } - + //We either have a write bin or we are at the end of a read bin BinElement_rcr * be = &(T->array[key]); { @@ -414,7 +416,7 @@ void rcr_RETIREHASHTABLE(HashStructure *T, SESEcommon *task, int key, BinItem_rc be->head=val; // release lock } } - + void RESOLVE(SESEcommon *record, bitvt mask) { int index=-1; struct rcrRecord * array=(struct rcrRecord *)(((char *)record)+record->offsetToParamRecords); diff --git a/Robust/src/Runtime/oooJava/rcr_runtime.h b/Robust/src/Runtime/oooJava/rcr_runtime.h index cc341806..aa2ad3f3 100644 --- a/Robust/src/Runtime/oooJava/rcr_runtime.h +++ b/Robust/src/Runtime/oooJava/rcr_runtime.h @@ -5,26 +5,5 @@ extern __thread struct trQueue * TRqueue; void * workerTR(void *); -#define RCRSIZE 32 -#define RUNBIAS 1000000 - -struct rcrRecord { - int count; - int index; - int flag; - int array[RCRSIZE]; - BinItem_rcr *ptrarray[RCRSIZE]; - struct rcrRecord *next; -}; - -typedef struct SESEstall_t { - SESEcommon common; - int size; - void * next; - struct ___Object___* ___obj___; - struct rcrRecord rcrRecords[1]; - int tag; -} SESEstall; - extern __thread SESEstall stallrecord; #endif diff --git a/Robust/src/Tests/rcr/test.java b/Robust/src/Tests/rcr/test.java index 9e816e81..601cc361 100644 --- a/Robust/src/Tests/rcr/test.java +++ b/Robust/src/Tests/rcr/test.java @@ -5,7 +5,11 @@ public class test { public static void main(String xz[]) { test[] r=new test[10]; for(int i=0;i<10;i++) { - r[i]=new test();r[i].f=new foo(); + r[i]=new test(); + // if (i%2==0) + r[i].f=new foo(); + // else + // r[i].f=new foo(); } for (int z=0;z<100000;z++) {