From: jzhou Date: Thu, 18 Mar 2010 00:02:15 +0000 (+0000) Subject: BAMBOO TILERA_ZLINUX mode works with single-core version but still has problem with... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=448b75e5cd47b7dc00242498364795e9ba4d538d;p=IRC.git BAMBOO TILERA_ZLINUX mode works with single-core version but still has problem with 56-core version --- diff --git a/Robust/src/Runtime/MGCHash.c b/Robust/src/Runtime/MGCHash.c index 8bbef86f..648f74ab 100755 --- a/Robust/src/Runtime/MGCHash.c +++ b/Robust/src/Runtime/MGCHash.c @@ -418,6 +418,28 @@ int MGCHashadd(struct MGCHash * thisvar, int data) { } #ifdef MULTICORE +struct MGCHash * allocateMGCHash_I(int size, + int conflicts) { + struct MGCHash *thisvar; + if (size <= 0) { +#ifdef MULTICORE + BAMBOO_EXIT(0xf101); +#else + printf("Negative Hashtable size Exception\n"); + exit(-1); +#endif + } + thisvar=(struct MGCHash *)RUNMALLOC_I(sizeof(struct MGCHash)); + thisvar->size = size; + thisvar->bucket = + (struct MGCNode *) RUNMALLOC_I(sizeof(struct MGCNode)*size); + // zero out all the buckets + BAMBOO_MEMSET_WH(thisvar->bucket, '\0', sizeof(struct MGCNode)*size); + //Set data counts + thisvar->num4conflicts = conflicts; + return thisvar; +} + int MGCHashadd_I(struct MGCHash * thisvar, int data) { // Rehash code unsigned int hashkey; diff --git a/Robust/src/Runtime/MGCHash.h b/Robust/src/Runtime/MGCHash.h index 727382df..fd4abe6c 100755 --- a/Robust/src/Runtime/MGCHash.h +++ b/Robust/src/Runtime/MGCHash.h @@ -61,6 +61,7 @@ void freeMGCHash(struct MGCHash *); //void MGCHashrehash(struct MGCHash * thisvar); int MGCHashadd(struct MGCHash *, int data); #ifdef MULTICORE +struct MGCHash * allocateMGCHash_I(int size, int conflicts); int MGCHashadd_I(struct MGCHash *, int data); #endif int MGCHashcontains(struct MGCHash *,int data); diff --git a/Robust/src/Runtime/Queue.c b/Robust/src/Runtime/Queue.c index 192b9ca3..dfd6202f 100644 --- a/Robust/src/Runtime/Queue.c +++ b/Robust/src/Runtime/Queue.c @@ -57,6 +57,13 @@ struct QueueItem * addNewItemBack(struct Queue * queue, void * ptr) { } #ifdef MULTICORE +struct Queue * createQueue_I() { + struct Queue * queue = (struct Queue *)RUNMALLOC_I(sizeof(struct Queue)); + queue->head = NULL; + queue->tail = NULL; + return queue; +} + struct QueueItem * addNewItem_I(struct Queue * queue, void * ptr) { struct QueueItem * item=RUNMALLOC_I(sizeof(struct QueueItem)); item->objectptr=ptr; diff --git a/Robust/src/Runtime/Queue.h b/Robust/src/Runtime/Queue.h index b157928f..53cf3311 100644 --- a/Robust/src/Runtime/Queue.h +++ b/Robust/src/Runtime/Queue.h @@ -21,6 +21,7 @@ void freeQueue(struct Queue * q); struct QueueItem * addNewItem(struct Queue * queue, void * ptr); struct QueueItem * addNewItemBack(struct Queue * queue, void * ptr); #ifdef MULTICORE +struct Queue * createQueue_I(); struct QueueItem * addNewItem_I(struct Queue * queue, void * ptr); #endif diff --git a/Robust/src/Runtime/SimpleHash.c b/Robust/src/Runtime/SimpleHash.c index ea00ee5b..7aff1fd9 100755 --- a/Robust/src/Runtime/SimpleHash.c +++ b/Robust/src/Runtime/SimpleHash.c @@ -204,6 +204,27 @@ int RuntimeHashadd(struct RuntimeHash * thisvar,int key, int data) { } #ifdef MULTICORE +struct RuntimeHash * allocateRuntimeHash_I(int size) { + struct RuntimeHash *thisvar; //=(struct RuntimeHash *)RUNMALLOC(sizeof(struct RuntimeHash)); + if (size <= 0) { +#ifdef MULTICORE + BAMBOO_EXIT(0xf101); +#else + printf("Negative Hashtable size Exception\n"); + exit(-1); +#endif + } + thisvar=(struct RuntimeHash *)RUNMALLOC_I(sizeof(struct RuntimeHash)); + thisvar->size = size; + thisvar->bucket = (struct RuntimeNode **) RUNMALLOC_I(sizeof(struct RuntimeNode *)*size); + /* Set allocation blocks*/ + thisvar->listhead=NULL; + thisvar->listtail=NULL; + /*Set data counts*/ + thisvar->numelements = 0; + return thisvar; +} + int RuntimeHashadd_I(struct RuntimeHash * thisvar,int key, int data) { /* Rehash code */ unsigned int hashkey; diff --git a/Robust/src/Runtime/SimpleHash.h b/Robust/src/Runtime/SimpleHash.h index c2a2679a..fa647e46 100755 --- a/Robust/src/Runtime/SimpleHash.h +++ b/Robust/src/Runtime/SimpleHash.h @@ -25,6 +25,7 @@ void freeRuntimeHash(struct RuntimeHash *); void RuntimeHashrehash(struct RuntimeHash * thisvar); int RuntimeHashadd(struct RuntimeHash *, int key, int data); #ifdef MULTICORE +struct RuntimeHash * allocateRuntimeHash_I(int size); int RuntimeHashadd_I(struct RuntimeHash *, int key, int data); #endif int RuntimeHashremovekey(struct RuntimeHash *,int key); diff --git a/Robust/src/Runtime/multicoreruntime.h b/Robust/src/Runtime/multicoreruntime.h index b83a8974..e9a44c61 100644 --- a/Robust/src/Runtime/multicoreruntime.h +++ b/Robust/src/Runtime/multicoreruntime.h @@ -265,7 +265,13 @@ struct Queue * totransobjqueue; // queue to hold objs to be transferred // should be cleared whenever enter a task // data structures for shared memory allocation +#ifdef TILERA_BME #define BAMBOO_BASE_VA 0xd000000 +#elif defined TILERA_ZLINUX +#ifdef MULTICORE_GC +#define BAMBOO_BASE_VA 0xd000000 +#endif // MULTICORE_GC +#endif // TILERA_BME #ifdef GC_DEBUG #include "structdefs.h" #define BAMBOO_NUM_PAGES (NUMCORES4GC*(2+1)+3) diff --git a/Robust/src/Runtime/multicoretask.c b/Robust/src/Runtime/multicoretask.c index b0c92326..aaa092c3 100644 --- a/Robust/src/Runtime/multicoretask.c +++ b/Robust/src/Runtime/multicoretask.c @@ -105,7 +105,7 @@ void initruntimedata() { smemflag = true; bamboo_cur_msp = NULL; bamboo_smem_size = 0; - totransobjqueue = createQueue(); + totransobjqueue = createQueue_I(); #ifdef MULTICORE_GC gcflag = false; @@ -116,9 +116,9 @@ void initruntimedata() { gcself_numreceiveobjs = 0; gcmarkedptrbound = 0; //mgchashCreate(2000, 0.75); - gcpointertbl = allocateRuntimeHash(20); + gcpointertbl = allocateRuntimeHash_I(20); //gcpointertbl = allocateMGCHash(20); - gcforwardobjtbl = allocateMGCHash(20, 3); + gcforwardobjtbl = allocateMGCHash_I(20, 3); gcobj2map = 0; gcmappedobj = 0; gcismapped = false; @@ -147,8 +147,8 @@ void initruntimedata() { lock2require = 0; lockresult = 0; lockflag = false; - lockRedirectTbl = allocateRuntimeHash(20); - objRedirectLockTbl = allocateRuntimeHash(20); + lockRedirectTbl = allocateRuntimeHash_I(20); + objRedirectLockTbl = allocateRuntimeHash_I(20); #endif #ifndef INTERRUPT reside = false;