bug fix...gcloads was used twice for different things with different types...
authorbdemsky <bdemsky>
Wed, 15 Jun 2011 07:42:08 +0000 (07:42 +0000)
committerbdemsky <bdemsky>
Wed, 15 Jun 2011 07:42:08 +0000 (07:42 +0000)
Robust/src/Runtime/bamboo/multicoregarbage.h
Robust/src/Runtime/bamboo/multicoregccompact.c
Robust/src/Runtime/bamboo/multicoremsg.c

index f13077f37e2780673e9934188e6f6403e802164d..88c8dbc1c9ab6d7453f78390e1151c2231922949 100644 (file)
@@ -62,7 +62,8 @@ unsigned int gcself_numreceiveobjs;
 
 // for load balancing
 unsigned int gcheaptop;
-void * gcloads[NUMCORES4GC];
+unsigned INTPTR gcloads[NUMCORES4GC];
+void * topptrs[NUMCORES4GC];
 unsigned int gctopcore; // the core host the top of the heap
 unsigned int gctopblock; // the number of current top block
 
index 5b880b8e0307ff12bf7784b8968b2299dd5bcfc0..b08eb12942c8149a788a8275d1fecdd05f289f28 100644 (file)
@@ -27,21 +27,21 @@ INLINE void gc_resetCoreStatus() {
 // should be invoked with interrupt closed
 INLINE int assignSpareMem_I(unsigned int sourcecore,unsigned int * requiredmem, void ** tomove, void ** startaddr) {
   unsigned int b = 0;
-  BLOCKINDEX(gcloads[sourcecore], b);
+  BLOCKINDEX(topptrs[sourcecore], b);
   void * boundptr = BOUNDPTR(b);
-  unsigned INTPTR remain = (unsigned INTPTR) (boundptr - gcloads[sourcecore]);
+  unsigned INTPTR remain = (unsigned INTPTR) (boundptr - topptrs[sourcecore]);
   unsigned int memneed = requiredmem + BAMBOO_CACHE_LINE_SIZE;
-  *startaddr = gcloads[sourcecore];
+  *startaddr = topptrs[sourcecore];
   *tomove = gcfilledblocks[sourcecore] + 1;
   if(memneed < remain) {
-    gcloads[sourcecore] += memneed;
+    topptrs[sourcecore] += memneed;
     return 0;
   } else {
     // next available block
     gcfilledblocks[sourcecore] += 1;
     void * newbase = NULL;
     BASEPTR(sourcecore, gcfilledblocks[sourcecore], &newbase);
-    gcloads[sourcecore] = newbase;
+    topptrs[sourcecore] = newbase;
     return requiredmem-remain;
   }
 }
@@ -71,7 +71,7 @@ INLINE void compact2Heaptophelper_I(unsigned int coren,unsigned int* p,unsigned
   if(memneed < *remain) {
     *p = *p + memneed;
     gcrequiredmems[coren] = 0;
-    gcloads[gctopcore] += memneed;
+    topptrs[gctopcore] += memneed;
     *remain = *remain - memneed;
   } else {
     // next available block
@@ -79,13 +79,13 @@ INLINE void compact2Heaptophelper_I(unsigned int coren,unsigned int* p,unsigned
     gcfilledblocks[gctopcore] += 1;
     void * newbase = NULL;
     BASEPTR(gctopcore, gcfilledblocks[gctopcore], &newbase);
-    gcloads[gctopcore] = newbase;
+    topptrs[gctopcore] = newbase;
     gcrequiredmems[coren] -= *remain - BAMBOO_CACHE_LINE_SIZE;
     gcstopblock[gctopcore]++;
     gctopcore = NEXTTOPCORE(gctopblock);
     gctopblock++;
     *numblocks = gcstopblock[gctopcore];
-    *p = gcloads[gctopcore];
+    *p = topptrs[gctopcore];
     BLOCKINDEX(*p, b);
     *remain=GC_BLOCK_REMAIN_SIZE(b, (*p));
   }  
@@ -95,7 +95,7 @@ INLINE void compact2Heaptophelper_I(unsigned int coren,unsigned int* p,unsigned
 INLINE void compact2Heaptop() {
   // no cores with spare mem and some cores are blocked with pending move
   // find the current heap top and make them move to the heap top
-  void * p = gcloads[gctopcore];
+  void * p = topptrs[gctopcore];
   unsigned int numblocks = gcfilledblocks[gctopcore];
   unsigned int b;
   BLOCKINDEX(p, b);
@@ -470,7 +470,7 @@ bool compacthelper(struct moveHelper * orig,struct moveHelper * to,int * filledb
     // send compact finish message to core coordinator
     if(STARTUPCORE == BAMBOO_NUM_OF_CORE) {
       gcfilledblocks[BAMBOO_NUM_OF_CORE] = *filledblocks;
-      gcloads[BAMBOO_NUM_OF_CORE] = *heaptopptr;
+      topptrs[BAMBOO_NUM_OF_CORE] = *heaptopptr;
       //tprintf("--finish compact: %d, %d, %d, %x, %x \n", BAMBOO_NUM_OF_CORE, loadbalancemove, *filledblocks, *heaptopptr, gccurr_heaptop);
       if((unsigned int)(orig->ptr) < (unsigned int)gcmarkedptrbound) {
        // ask for more mem
index a0c632df9403f7e5d78a23eb18a0db3849df9d23..183b0f028ca9fe5bc4ccd4094302aad8358baacb 100644 (file)
@@ -518,7 +518,7 @@ INLINE void processmsg_gcfinishcompact_I() {
   if(cnum < NUMCORES4GC) {
     if(!loadbalancemove && (COMPACTPHASE == gc_status_info.gcphase)) {
       gcfilledblocks[cnum] = filledblocks;
-      gcloads[cnum] = heaptop;
+      topptrs[cnum] = heaptop;
     }
     if(data4 > 0) {
       // ask for more mem