BAMBOO TILERA_ZLINUX mode works with single-core version but still has problem with...
authorjzhou <jzhou>
Thu, 18 Mar 2010 00:02:15 +0000 (00:02 +0000)
committerjzhou <jzhou>
Thu, 18 Mar 2010 00:02:15 +0000 (00:02 +0000)
Robust/src/Runtime/MGCHash.c
Robust/src/Runtime/MGCHash.h
Robust/src/Runtime/Queue.c
Robust/src/Runtime/Queue.h
Robust/src/Runtime/SimpleHash.c
Robust/src/Runtime/SimpleHash.h
Robust/src/Runtime/multicoreruntime.h
Robust/src/Runtime/multicoretask.c

index 8bbef86f15ea33d022e30ffae96cc8c7f5b6001b..648f74ab288a7a052c450427fe485498ff01c648 100755 (executable)
@@ -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;
index 727382df41572fdda9966470d7873e8d24708aa5..fd4abe6cabdfa5012d3ca99fad5478a61fd519e3 100755 (executable)
@@ -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);
index 192b9ca32e6cb70e6494591ada37b15b55da02ef..dfd6202fa9683b41de07576159d0820c2b5692d0 100644 (file)
@@ -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;
index b157928ff1e971873c1cc687006414c6107d7a9f..53cf33111682f094a0c1c5f8dfa60ae4388fe01c 100644 (file)
@@ -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
 
index ea00ee5beeb13ecbb832a2f030d0df2b8caa0f38..7aff1fd98f6c43a802c6e4a1a857cce283189726 100755 (executable)
@@ -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;
index c2a2679a69c68bfed29247451cf3a7e35e4e8588..fa647e462159d2b98c3b748951c25c3e17bf504b 100755 (executable)
@@ -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);
index b83a89746a7d2721c1caf28b41fdc9988fbbf67a..e9a44c6153e0647f8509c4b0eccf274ccca79c1d 100644 (file)
@@ -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)
index b0c923265ac248e869b23765d2fc780826a1a468..aaa092c349f6fdebf967f6ad41945c3a85c2c545 100644 (file)
@@ -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;