bug fixing in multicore gc
authorjzhou <jzhou>
Fri, 29 Jan 2010 17:17:05 +0000 (17:17 +0000)
committerjzhou <jzhou>
Fri, 29 Jan 2010 17:17:05 +0000 (17:17 +0000)
Robust/src/Runtime/multicoregarbage.c
Robust/src/Runtime/multicoregarbage.h
Robust/src/Runtime/multicoreruntime.h
Robust/src/Runtime/multicoretask.c
Robust/src/buildscript

index 6e234efa084ea910b11bc3d2e32427f80e4c0815..fb47759d838336ef62337b8a30549f7c6e97970f 100644 (file)
@@ -281,6 +281,32 @@ inline int gc_lobjmoreItems3() {
   return 1;
 } // int gc_lobjmoreItems3()
 
+inline void gc_lobjqueueinit4() {
+       gclobjtail2 = gclobjtail;
+       gclobjtailindex2 = gclobjtailindex;
+} // void gc_lobjqueueinit2()
+
+inline void * gc_lobjdequeue4(int * length,
+                                         int * host) {
+  if (gclobjtailindex2==NUMLOBJPTRS) {
+    gclobjtail2=gclobjtail2->next;
+    gclobjtailindex2=0;
+  } // if (gclobjtailindex==NUMLOBJPTRS)
+       if(length != NULL) {
+               *length = gclobjtail2->lengths[gclobjtailindex];
+       }
+       if(host != NULL) {
+               *host = (int)(gclobjtail2->hosts[gclobjtailindex]);
+       }
+  return gclobjtail2->lobjs[gclobjtailindex++];
+} // void * gc_lobjdequeue()
+
+inline int gc_lobjmoreItems4() {
+  if ((gclobjhead==gclobjtail2)&&(gclobjtailindex2==gclobjheadindex))
+    return 0;
+  return 1;
+} // int gc_lobjmoreItems(
+
 INTPTR gccurr_heapbound = 0;
 
 inline void gettype_size(void * ptr, 
@@ -576,6 +602,9 @@ inline void initGC() {
 
        freeRuntimeHash(gcpointertbl);
        gcpointertbl = allocateRuntimeHash(20);
+       //freeMGCHash(gcpointertbl);
+       //gcpointertbl = allocateMGCHash(20);
+       //mgchashreset();
 
        memset(gcsmemtbl, '\0', sizeof(int)*gcnumblock);
 } // void initGC()
@@ -696,11 +725,15 @@ inline bool cacheLObjs() {
        while(gc_lobjmoreItems3()) {
                gc_lobjdequeue3();
                size = gclobjtail2->lengths[gclobjtailindex2];
-               // set the mark field to 2, indicating that this obj has been moved an
-               // need to be flushed
-               ((int *)(gclobjtail2->lobjs[gclobjtailindex2]))[6] = 2;
+               // set the mark field to , indicating that this obj has been move
+               // and need to be flushed
+               ((int *)(gclobjtail2->lobjs[gclobjtailindex2]))[6] = COMPACTED;
                dst -= size;
-               memcpy(dst, gclobjtail2->lobjs[gclobjtailindex2], size);
+               if((int)dst < (int)(gclobjtail2->lobjs[gclobjtailindex2])+size) {
+                       memmove(dst, gclobjtail2->lobjs[gclobjtailindex2], size);
+               } else {
+                 memcpy(dst, gclobjtail2->lobjs[gclobjtailindex2], size);
+               }
 #ifdef DEBUG
                BAMBOO_DEBUGPRINT(0x804);
                BAMBOO_DEBUGPRINT_REG(gclobjtail2->lobjs[gclobjtailindex2]);
@@ -732,7 +765,8 @@ void updateSmemTbl(int coren,
        do{
                toset = gc_core2block[2*coren+i]+(NUMCORES4GC*2)*j;
                if(toset < ltopcore) {
-                       gcsmemtbl[toset]=(toset<NUMCORES4GC)?BAMBOO_SMEM_SIZE_L:BAMBOO_SMEM_SIZE;
+                       gcsmemtbl[toset]=
+                               (toset<NUMCORES4GC)?BAMBOO_SMEM_SIZE_L:BAMBOO_SMEM_SIZE;
                } else if(toset == ltopcore) {
                        gcsmemtbl[toset] = load;
                        break;
@@ -847,6 +881,7 @@ inline void moveLObjs() {
                                (BAMBOO_SMEM_SIZE_L*i):
                                (BAMBOO_SMEM_SIZE*(i-NUMCORES4GC)+BAMBOO_LARGE_SMEM_BOUND));
        }
+
        // move large objs from gcheaptop to tmpheaptop
        // write the header first
        int tomove = (BAMBOO_BASE_VA) + (BAMBOO_SHARED_MEM_SIZE) - gcheaptop;
@@ -858,7 +893,7 @@ inline void moveLObjs() {
 #endif
        // flush the sbstartbl
        memset(&(gcsbstarttbl[gcreservedsb]), '\0', 
-                          BAMBOO_SHARED_MEM_SIZE/BAMBOO_SMEM_SIZE*sizeof(INTPTR));
+               (BAMBOO_SHARED_MEM_SIZE/BAMBOO_SMEM_SIZE-gcreservedsb)*sizeof(INTPTR));
        if(tomove == 0) {
                gcheaptop = tmpheaptop;
        } else {
@@ -894,7 +929,7 @@ inline void moveLObjs() {
                                        // close current block, fill its header
                                        memset(base, '\0', BAMBOO_CACHE_LINE_SIZE);
                                        *((int*)base) = cpysize + BAMBOO_CACHE_LINE_SIZE;
-                                       gcsmemtbl[b] = cpysize + BAMBOO_CACHE_LINE_SIZE;
+                                       gcsmemtbl[b]+=BAMBOO_CACHE_LINE_SIZE; // add the size of the header
                                        cpysize = 0;
                                        base = tmpheaptop;
                                        if(remain == 0) {
@@ -908,7 +943,11 @@ inline void moveLObjs() {
                                } // if(cpysize > 0)
 
                                // move the large obj
-                               memcpy(tmpheaptop, gcheaptop, size);
+                               if((int)gcheaptop < (int)(tmpheaptop)+size) {
+                                 memmove(tmpheaptop, gcheaptop, size);
+                               } else {
+                                       memcpy(tmpheaptop, gcheaptop, size);
+                               }
                                // fill the remaining space with -2 padding
                                memset(tmpheaptop+size, -2, isize-size);
                                // zero out original mem caching the lobj
@@ -923,9 +962,13 @@ inline void moveLObjs() {
 #endif
                                gcheaptop += size;
                                if(host == BAMBOO_NUM_OF_CORE) {
+                                       //if(ptr != tmpheaptop) {
                                        BAMBOO_START_CRITICAL_SECTION();
+                                       //mgchashInsert_I(ptr, tmpheaptop);
                                        RuntimeHashadd_I(gcpointertbl, ptr, tmpheaptop);
+                                       //MGCHashadd_I(gcpointertbl, ptr, tmpheaptop);
                                        BAMBOO_CLOSE_CRITICAL_SECTION();
+                                       //}
 #ifdef DEBUG
                                        BAMBOO_DEBUGPRINT(0xcdca);
                                        BAMBOO_DEBUGPRINT_REG(ptr);
@@ -973,12 +1016,20 @@ inline void moveLObjs() {
                                *((int*)base) = isize + BAMBOO_CACHE_LINE_SIZE;
                                cpysize = 0;
                                base = tmpheaptop;
+                               if(remain == BAMBOO_CACHE_LINE_SIZE) {
+                                       // fill with 0 in case
+                                       memset(tmpheaptop, '\0', remain);
+                               }
                                remain -= BAMBOO_CACHE_LINE_SIZE;
                                tmpheaptop += BAMBOO_CACHE_LINE_SIZE;
                        } else {
                                remain -= isize;
                                // move the large obj
-                               memcpy(tmpheaptop, gcheaptop, size);
+                               if((int)gcheaptop < (int)(tmpheaptop)+size) {
+                               memmove(tmpheaptop, gcheaptop, size);
+                               } else {
+                                       memcpy(tmpheaptop, gcheaptop, size);
+                               }
                                // fill the remaining space with -2 padding
                                memset(tmpheaptop+size, -2, isize-size);
                                // zero out original mem caching the lobj
@@ -990,12 +1041,17 @@ inline void moveLObjs() {
                                BAMBOO_DEBUGPRINT_REG(size);
                                BAMBOO_DEBUGPRINT_REG(isize);
 #endif
+
                                gcheaptop += size;
                                cpysize += isize;
                                if(host == BAMBOO_NUM_OF_CORE) {
+                                       //if(ptr != tmpheaptop) {
                                        BAMBOO_START_CRITICAL_SECTION();
+                                       //mgchashInsert_I(ptr, tmpheaptop);
                                        RuntimeHashadd_I(gcpointertbl, ptr, tmpheaptop);
+                                       //MGCHashadd_I(gcpointertbl, ptr, tmpheaptop);
                                        BAMBOO_CLOSE_CRITICAL_SECTION();
+                                       //}
 #ifdef DEBUG
                                        BAMBOO_DEBUGPRINT(0xcdcc);
                                        BAMBOO_DEBUGPRINT_REG(ptr);
@@ -1014,10 +1070,6 @@ inline void moveLObjs() {
                                tmpheaptop += isize;
 
                                // update gcsmemtbl
-                               if(gcsmemtbl[b] == 0) {
-                                       // add the header's size
-                                       gcsmemtbl[b] = BAMBOO_CACHE_LINE_SIZE;
-                               }
                                gcsmemtbl[b] += isize;
                        } // if(remain < isize) else ...
                } // while(gc_lobjmoreItems())
@@ -1025,11 +1077,12 @@ inline void moveLObjs() {
                        // close current block, fill the header
                        memset(base, '\0', BAMBOO_CACHE_LINE_SIZE);
                        *((int*)base) = cpysize + BAMBOO_CACHE_LINE_SIZE;
-                       gcsmemtbl[b] = cpysize + BAMBOO_CACHE_LINE_SIZE;
+                       gcsmemtbl[b] += BAMBOO_CACHE_LINE_SIZE; // add the size of the header
                } else {
                        tmpheaptop -= BAMBOO_CACHE_LINE_SIZE;
                }
                gcheaptop = tmpheaptop;
+
        } // if(tomove == 0)
 
 #ifdef DEBUG
@@ -1053,7 +1106,7 @@ inline void moveLObjs() {
        int startptr = 0;
        size = 0;
        bound = BAMBOO_SMEM_SIZE_L;
-       for(i = 0; i < gcnumblock; i++) {
+       for(i = 0; i < gcnumblock-bamboo_reserved_smem; i++) {
                if(gcsmemtbl[i] < bound) {
                        if(gcsmemtbl[i] == 0) {
                                // blank one
@@ -1093,17 +1146,22 @@ inline void moveLObjs() {
                startptr = 0;
                size = 0;
        }
-       // remove the remaing list to the back up list
+       // remove the remaing list to the back up list, only remain one node, 
+       // free the others
        if(tochange->next != NULL) {
-               struct freeMemItem * blist = bamboo_free_mem_list->backuplist;
-               bamboo_free_mem_list->backuplist = tochange->next;
+               struct freeMemItem * blist = NULL;
+               if(bamboo_free_mem_list->backuplist != NULL) {
+                       blist = tochange->next;
+               } else {
+                       bamboo_free_mem_list->backuplist = tochange->next;
+                       blist = bamboo_free_mem_list->backuplist->next;
+                       bamboo_free_mem_list->backuplist->next = NULL;
+               }
                tochange->next = NULL;
-               if(blist != NULL) {
-                       struct freeMemItem * tmp = bamboo_free_mem_list->backuplist;
-                       while(tmp->next != NULL) {
-                               tmp = tmp->next;
-                       }
-                       tmp->next = blist;
+               while(blist != NULL) {
+                       struct freeMemItem * tmp = blist;
+                       blist = blist->next;
+                       RUNFREE(tmp);
                } // if(blist != NULL)
        }
 
@@ -1113,6 +1171,39 @@ inline void moveLObjs() {
 #endif
 } // void moveLObjs()
 
+inline void markObj(void * objptr) {
+       if(objptr == NULL) {
+               return;
+       }
+       if(ISSHAREDOBJ(objptr)) {
+               int host = hostcore(objptr);
+               if(BAMBOO_NUM_OF_CORE == host) {
+                       // on this core
+                       if(((int *)objptr)[6] == INIT) {
+                               // this is the first time that this object is discovered,
+                               // set the flag as DISCOVERED
+                               ((int *)objptr)[6] = DISCOVERED;
+                               BAMBOO_START_CRITICAL_SECTION();
+                               gc_enqueue_I(objptr);  
+                               BAMBOO_CLOSE_CRITICAL_SECTION();
+                       }
+               } else {
+#ifdef DEBUG
+                       BAMBOO_DEBUGPRINT(0xbbbb);
+                       BAMBOO_DEBUGPRINT_REG(host);
+                       BAMBOO_DEBUGPRINT_REG(objptr);
+#endif
+                       // send a msg to host informing that objptr is active
+                       send_msg_2(host, GCMARKEDOBJ, objptr);
+                       gcself_numsendobjs++;
+               }
+       } else {
+               BAMBOO_START_CRITICAL_SECTION();
+               gc_enqueue_I(objptr);
+               BAMBOO_CLOSE_CRITICAL_SECTION();
+       } // if(ISSHAREDOBJ(objptr))
+} // void markObj(void * objptr) 
+
 // enqueue root objs
 inline void tomark(struct garbagelist * stackptr) {
        if(MARKPHASE != gcphase) {
@@ -1135,9 +1226,10 @@ inline void tomark(struct garbagelist * stackptr) {
 #endif
                for(i=0; i<stackptr->size; i++) {
                        if(stackptr->array[i] != NULL) {
-                               BAMBOO_START_CRITICAL_SECTION();
-                               gc_enqueue_I(stackptr->array[i]);
-                               BAMBOO_CLOSE_CRITICAL_SECTION();
+                               //BAMBOO_START_CRITICAL_SECTION();
+                               //gc_enqueue_I(stackptr->array[i]);
+                               //BAMBOO_CLOSE_CRITICAL_SECTION();
+                         markObj(stackptr->array[i]);
                        }
                }
                stackptr=stackptr->next;
@@ -1157,9 +1249,10 @@ inline void tomark(struct garbagelist * stackptr) {
                                struct ObjectHash * set=parameter->objectset;
                                struct ObjectNode * ptr=set->listhead;
                                while(ptr!=NULL) {
-                                       BAMBOO_START_CRITICAL_SECTION();
-                                       gc_enqueue_I((void *)ptr->key);
-                                       BAMBOO_CLOSE_CRITICAL_SECTION();
+                                       //BAMBOO_START_CRITICAL_SECTION();
+                                       //gc_enqueue_I((void *)ptr->key);
+                                       //BAMBOO_CLOSE_CRITICAL_SECTION();
+                                       markObj((void *)ptr->key);
                                        ptr=ptr->lnext;
                                }
                        }
@@ -1172,9 +1265,10 @@ inline void tomark(struct garbagelist * stackptr) {
                BAMBOO_DEBUGPRINT(0xe504);
 #endif
                for(i=0; i<currtpd->numParameters; i++) {
-                       BAMBOO_START_CRITICAL_SECTION();
-                       gc_enqueue_I(currtpd->parameterArray[i]);
-                       BAMBOO_CLOSE_CRITICAL_SECTION();
+                       //BAMBOO_START_CRITICAL_SECTION();
+                       //gc_enqueue_I(currtpd->parameterArray[i]);
+                       //BAMBOO_CLOSE_CRITICAL_SECTION();
+                       markObj(currtpd->parameterArray[i]);
                }
        }
 
@@ -1188,9 +1282,10 @@ inline void tomark(struct garbagelist * stackptr) {
                        struct taskparamdescriptor *tpd=ptr->src;
                        int i;
                        for(i=0; i<tpd->numParameters; i++) {
-                               BAMBOO_START_CRITICAL_SECTION();
-                               gc_enqueue_I(tpd->parameterArray[i]);
-                               BAMBOO_CLOSE_CRITICAL_SECTION();
+                               //BAMBOO_START_CRITICAL_SECTION();
+                               //gc_enqueue_I(tpd->parameterArray[i]);
+                               //BAMBOO_CLOSE_CRITICAL_SECTION();
+                               markObj(tpd->parameterArray[i]);
                        }
                        ptr=ptr->inext;
                }
@@ -1204,9 +1299,10 @@ inline void tomark(struct garbagelist * stackptr) {
        while(tmpobjptr != NULL) {
                struct transObjInfo * objInfo = 
                        (struct transObjInfo *)(tmpobjptr->objectptr); 
-               BAMBOO_START_CRITICAL_SECTION();
-               gc_enqueue_I(objInfo->objptr);
-               BAMBOO_CLOSE_CRITICAL_SECTION();
+               //BAMBOO_START_CRITICAL_SECTION();
+               //gc_enqueue_I(objInfo->objptr);
+               //BAMBOO_CLOSE_CRITICAL_SECTION();
+               markObj(objInfo->objptr);
                tmpobjptr = getNextQueueItem(tmpobjptr);
        }
 
@@ -1218,9 +1314,10 @@ inline void tomark(struct garbagelist * stackptr) {
        while(item != NULL) {
                struct transObjInfo * totransobj = 
                        (struct transObjInfo *)(item->objectptr);
-               BAMBOO_START_CRITICAL_SECTION();
-               gc_enqueue_I(totransobj->objptr);
-               BAMBOO_CLOSE_CRITICAL_SECTION();
+               //BAMBOO_START_CRITICAL_SECTION();
+               //gc_enqueue_I(totransobj->objptr);
+               //BAMBOO_CLOSE_CRITICAL_SECTION();
+               markObj(totransobj->objptr);
                item = getNextQueueItem(item);
        } // while(item != NULL)
 
@@ -1229,42 +1326,16 @@ inline void tomark(struct garbagelist * stackptr) {
 #endif
        // enqueue lock related info
        for(i = 0; i < runtime_locklen; ++i) {
-        gc_enqueue_I((void *)(runtime_locks[i].redirectlock));
+        //gc_enqueue_I((void *)(runtime_locks[i].redirectlock));
+        markObj((void *)(runtime_locks[i].redirectlock));
         if(runtime_locks[i].value != NULL) {
-                gc_enqueue_I((void *)(runtime_locks[i].value));
+                //gc_enqueue_I((void *)(runtime_locks[i].value));
+                markObj((void *)(runtime_locks[i].value));
         }
        }
 
 } // void tomark(struct garbagelist * stackptr)
 
-inline void markObj(void * objptr) {
-       if(objptr == NULL) {
-               return;
-       }
-       if(ISSHAREDOBJ(objptr)) {
-               int host = hostcore(objptr);
-               if(BAMBOO_NUM_OF_CORE == host) {
-                       // on this core
-                       BAMBOO_START_CRITICAL_SECTION();
-                       gc_enqueue_I(objptr);  
-                       BAMBOO_CLOSE_CRITICAL_SECTION();
-               } else {
-#ifdef DEBUG
-                       BAMBOO_DEBUGPRINT(0xbbbb);
-                       BAMBOO_DEBUGPRINT_REG(host);
-                       BAMBOO_DEBUGPRINT_REG(objptr);
-#endif
-                       // send a msg to host informing that objptr is active
-                       send_msg_2(host, GCMARKEDOBJ, objptr);
-                       gcself_numsendobjs++;
-               }
-       } else {
-               BAMBOO_START_CRITICAL_SECTION();
-               gc_enqueue_I(objptr);
-               BAMBOO_CLOSE_CRITICAL_SECTION();
-       } // if(ISSHAREDOBJ(objptr))
-} // void markObj(void * objptr) 
-
 inline void mark(bool isfirst, 
                             struct garbagelist * stackptr) {
 #ifdef DEBUG
@@ -1299,6 +1370,7 @@ inline void mark(bool isfirst,
                        gcbusystatus = true;
                        checkfield = true;
                        void * ptr = gc_dequeue2();
+
 #ifdef DEBUG 
                        BAMBOO_DEBUGPRINT_REG(ptr);
 #endif
@@ -1311,7 +1383,7 @@ inline void mark(bool isfirst,
                                int host = hostcore(ptr);
                                bool islocal = (host == BAMBOO_NUM_OF_CORE);
                                if(islocal) {
-                                       bool isnotmarked = (((int *)ptr)[6] == 0);
+                                       bool isnotmarked = (((int *)ptr)[6] == DISCOVERED);
                                        if(isLarge(ptr, &type, &size) && isnotmarked) {
                                                // ptr is a large object and not marked or enqueued
 #ifdef DEBUG
@@ -1324,7 +1396,7 @@ inline void mark(bool isfirst,
                                                gcnumlobjs++;
                                                BAMBOO_CLOSE_CRITICAL_SECTION();
                                                // mark this obj
-                                               ((int *)ptr)[6] = 1;
+                                               ((int *)ptr)[6] = MARKED;
                                        } else if(isnotmarked) {
                                                // ptr is an unmarked active object on this core
                                                ALIGNSIZE(size, &isize);
@@ -1336,7 +1408,8 @@ inline void mark(bool isfirst,
                                                BAMBOO_DEBUGPRINT(((int *)(ptr))[0]);
 #endif
                                                // mark this obj
-                                               ((int *)ptr)[6] = 1;
+                                               ((int *)ptr)[6] = MARKED;
+
                                                if(ptr + size > gcmarkedptrbound) {
                                                        gcmarkedptrbound = ptr + size;
                                                } // if(ptr + size > gcmarkedptrbound)
@@ -1651,6 +1724,7 @@ struct moveHelper {
 // if out of boundary of valid shared memory, return false, else return true
 inline bool nextSBlock(struct moveHelper * orig) {
        orig->blockbase = orig->blockbound;
+       bool sbchanged = false;
 #ifdef DEBUG 
        BAMBOO_DEBUGPRINT(0xecc0);
        BAMBOO_DEBUGPRINT_REG(orig->blockbase);
@@ -1682,8 +1756,10 @@ innernextSBlock:
                orig->bound = orig->base + BAMBOO_SMEM_SIZE;
                orig->blockbase = orig->base;
                orig->sblockindex = (orig->blockbase-BAMBOO_BASE_VA)/BAMBOO_SMEM_SIZE;
+               sbchanged = true;
        } else if(0 == (orig->blockbase%BAMBOO_SMEM_SIZE)) {
                orig->sblockindex += 1;
+               sbchanged = true;
        } // if((orig->blockbase >= orig->bound) || (orig->ptr >= orig->bound)...
 
        // check if this sblock should be omitted or have special start point
@@ -1695,7 +1771,9 @@ innernextSBlock:
                orig->sblockindex += 1;
                orig->blockbase += BAMBOO_SMEM_SIZE;
                goto outernextSBlock;
-       } else if(gcsbstarttbl[orig->sblockindex] != 0) {
+       } else if((gcsbstarttbl[orig->sblockindex] != 0) 
+                       && (sbchanged)) {
+               // the first time to access this SBlock
 #ifdef DEBUG
                BAMBOO_DEBUGPRINT(0xecc3);
 #endif
@@ -1851,18 +1929,15 @@ innermoveobj:
 #endif
        ALIGNSIZE(size, &isize); // no matter is the obj marked or not
                                 // should be able to across it
-       if(mark == 1) {
+       if(mark == MARKED) {
 #ifdef DEBUG
                BAMBOO_DEBUGPRINT(0xe204);
 #endif
                // marked obj, copy it to current heap top
                // check to see if remaining space is enough
                if(to->top + isize > to->bound) {
-                       // fill -1 indicating the end of this block
-                       /*if(to->top != to->bound) {
-                               *((int*)to->ptr) = -1;
-                       }*/
-                       //memset(to->ptr+1,  -2, to->bound - to->top - 1);
+                       // fill 0 indicating the end of this block
+                       memset(to->ptr,  '\0', to->bound - to->top);
                        // fill the header of this block and then go to next block
        to->offset += to->bound - to->top;
                        memset(to->base, '\0', BAMBOO_CACHE_LINE_SIZE);
@@ -1875,16 +1950,24 @@ innermoveobj:
                } // if(to->top + isize > to->bound)
                // set the mark field to 2, indicating that this obj has been moved 
                // and need to be flushed
-               ((int *)(orig->ptr))[6] = 2;
+               ((int *)(orig->ptr))[6] = COMPACTED;
                if(to->ptr != orig->ptr) {
-                       memcpy(to->ptr, orig->ptr, size);
+                       if((int)(orig->ptr) < (int)(to->ptr)+size) {
+                         memmove(to->ptr, orig->ptr, size);
+                       } else {
+                               memcpy(to->ptr, orig->ptr, size);
+                       }
                        // fill the remaining space with -2
                        memset(to->ptr+size, -2, isize-size);
                }
                // store mapping info
                BAMBOO_START_CRITICAL_SECTION();
+               //mgchashInsert_I(orig->ptr, to->ptr);
                RuntimeHashadd_I(gcpointertbl, orig->ptr, to->ptr); 
+               //MGCHashadd_I(gcpointertbl, orig->ptr, to->ptr);
                BAMBOO_CLOSE_CRITICAL_SECTION();
+         //}
+
 #ifdef DEBUG
                BAMBOO_DEBUGPRINT(0xcdce);
                BAMBOO_DEBUGPRINT_REG(orig->ptr);
@@ -1905,9 +1988,11 @@ innermoveobj:
        BAMBOO_DEBUGPRINT(0xe205);
 #endif
        // move to next obj
-       orig->ptr += isize;
+       orig->ptr += size;
+       
 #ifdef DEBUG
        BAMBOO_DEBUGPRINT_REG(isize);
+       BAMBOO_DEBUGPRINT_REG(size);
        BAMBOO_DEBUGPRINT_REG(orig->ptr);
        BAMBOO_DEBUGPRINT_REG(orig->bound);
 #endif
@@ -2157,7 +2242,9 @@ inline void * flushObj(void * objptr) {
 #endif
                // a shared obj ptr, change to new address
                BAMBOO_START_CRITICAL_SECTION();
+               //dstptr = mgchashSearch(objptr);
                RuntimeHashget(gcpointertbl, objptr, &dstptr);
+               //MGCHashget(gcpointertbl, objptr, &dstptr);
                BAMBOO_CLOSE_CRITICAL_SECTION();
 #ifdef DEBUG
                BAMBOO_DEBUGPRINT_REG(dstptr);
@@ -2172,7 +2259,9 @@ inline void * flushObj(void * objptr) {
                                // error! the obj is right on this core, but cannot find it
                                BAMBOO_DEBUGPRINT_REG(objptr);
                                BAMBOO_EXIT(0xb103);
-                       }
+                               // assume that the obj has not been moved, use the original address
+                               //dstptr = objptr;
+                       } else {
                        // send msg to host core for the mapping info
                        gcobj2map = (int)objptr;
                        gcismapped = false;
@@ -2185,13 +2274,19 @@ inline void * flushObj(void * objptr) {
                                }
                        }
                        BAMBOO_START_CRITICAL_SECTION();
+                       //dstptr = mgchashSearch(objptr);
                        RuntimeHashget(gcpointertbl, objptr, &dstptr);
+                       //MGCHashget(gcpointertbl, objptr, &dstptr);
                        BAMBOO_CLOSE_CRITICAL_SECTION();
+                       }
 #ifdef DEBUG
                        BAMBOO_DEBUGPRINT_REG(dstptr);
 #endif
                }
-       } // if(ISSHAREDOBJ(objptr))
+       } else {
+               // not a shared obj, use the old address
+               dstptr = objptr;
+       }// if(ISSHAREDOBJ(objptr))
 #ifdef DEBUG
        BAMBOO_DEBUGPRINT(0xe404);
 #endif
@@ -2281,12 +2376,13 @@ inline void flushRuntimeObj(struct garbagelist * stackptr) {
 
 inline void flush(struct garbagelist * stackptr) {
        flushRuntimeObj(stackptr);
-       
+
        while(gc_moreItems()) {
 #ifdef DEBUG
                BAMBOO_DEBUGPRINT(0xe301);
 #endif
                void * ptr = gc_dequeue();
+               if(ISSHAREDOBJ(ptr)) {
                void * tptr = flushObj(ptr);
 #ifdef DEBUG
                BAMBOO_DEBUGPRINT(0xe302);
@@ -2297,7 +2393,8 @@ inline void flush(struct garbagelist * stackptr) {
                if(tptr != NULL) {
                        ptr = tptr;
                }
-               if(((int *)(ptr))[6] == 2) {
+               }
+               if((!ISSHAREDOBJ(ptr)) || (((int *)(ptr))[6] == COMPACTED)) {
                        int type = ((int *)(ptr))[0];
                        // scan all pointers in ptr
                        unsigned INTPTR * pointer;
@@ -2341,6 +2438,7 @@ inline void flush(struct garbagelist * stackptr) {
 #endif
                                        unsigned int offset=pointer[i];
                                        void * objptr=*((void **)(((char *)ptr)+offset));
+
 #ifdef DEBUG
                                        BAMBOO_DEBUGPRINT_REG(objptr);
 #endif
@@ -2348,12 +2446,94 @@ inline void flush(struct garbagelist * stackptr) {
                                } // for(i=1; i<=size; i++) 
                        } // if (pointer==0) else if (((INTPTR)pointer)==1) else ()
                        // restore the mark field, indicating that this obj has been flushed
-                       ((int *)(ptr))[6] = 0;
-               } // if(((int *)(ptr))[6] == 2)
+                       if(ISSHAREDOBJ(ptr)) {
+                               ((int *)(ptr))[6] = INIT;
+                       }
+               } // if(((int *)(ptr))[6] == COMPACTED)
        } // while(gc_moreItems())
 #ifdef DEBUG
        BAMBOO_DEBUGPRINT(0xe308);
 #endif
+
+       // flush lobjs
+       while(gc_lobjmoreItems()) {
+#ifdef DEBUG
+               BAMBOO_DEBUGPRINT(0xe309);
+#endif
+               void * ptr = gc_lobjdequeue(NULL, NULL);
+               //if(ISSHAREDOBJ(ptr)) {
+               void * tptr = flushObj(ptr);
+#ifdef DEBUG
+               BAMBOO_DEBUGPRINT(0xe30a);
+               BAMBOO_DEBUGPRINT_REG(ptr);
+               BAMBOO_DEBUGPRINT_REG(tptr);
+               BAMBOO_DEBUGPRINT_REG(((int *)(tptr))[0]);
+#endif
+               if(tptr != NULL) {
+                       ptr = tptr;
+               }
+               //}
+               if(/*(!ISSHAREDOBJ(ptr)) || */(((int *)(ptr))[6] == COMPACTED)) {
+                       int type = ((int *)(ptr))[0];
+                       // scan all pointers in ptr
+                       unsigned INTPTR * pointer;
+                       pointer=pointerarray[type];
+#ifdef DEBUG
+                       BAMBOO_DEBUGPRINT(0xe30b);
+                       BAMBOO_DEBUGPRINT_REG(pointer);
+#endif
+                       if (pointer==0) {
+                               /* Array of primitives */
+                               /* Do nothing */
+                       } else if (((INTPTR)pointer)==1) {
+#ifdef DEBUG
+                               BAMBOO_DEBUGPRINT(0xe30c);
+#endif
+                               /* Array of pointers */
+                               struct ArrayObject *ao=(struct ArrayObject *) ptr;
+                               int length=ao->___length___;
+                               int j;
+                               for(j=0; j<length; j++) {
+#ifdef DEBUG
+                                       BAMBOO_DEBUGPRINT(0xe30d);
+#endif
+                                       void *objptr=
+                                               ((void **)(((char *)&ao->___length___)+sizeof(int)))[j];
+#ifdef DEBUG
+                                       BAMBOO_DEBUGPRINT_REG(objptr);
+#endif
+                                       ((void **)(((char *)&ao->___length___)+sizeof(int)))[j] = 
+                                               flushObj(objptr);
+                               }
+                       } else {
+#ifdef DEBUG
+                               BAMBOO_DEBUGPRINT(0xe30e);
+#endif
+                               INTPTR size=pointer[0];
+                               int i;
+                               for(i=1; i<=size; i++) {
+#ifdef DEBUG
+                                       BAMBOO_DEBUGPRINT(0xe30f);
+#endif
+                                       unsigned int offset=pointer[i];
+                                       void * objptr=*((void **)(((char *)ptr)+offset));
+
+#ifdef DEBUG
+                                       BAMBOO_DEBUGPRINT_REG(objptr);
+#endif
+                                       *((void **)(((char *)ptr)+offset)) = flushObj(objptr);
+                               } // for(i=1; i<=size; i++) 
+                       } // if (pointer==0) else if (((INTPTR)pointer)==1) else ()
+                       // restore the mark field, indicating that this obj has been flushed
+                       //if(ISSHAREDOBJ(ptr)) {
+                               ((int *)(ptr))[6] = INIT;
+                       //}
+               } // if(((int *)(ptr))[6] == COMPACTED)
+       } // while(gc_lobjmoreItems())
+#ifdef DEBUG
+       BAMBOO_DEBUGPRINT(0xe310);
+#endif
+
        // send flush finish message to core coordinator
        if(STARTUPCORE == BAMBOO_NUM_OF_CORE) {
                gccorestatus[BAMBOO_NUM_OF_CORE] = 0;
@@ -2361,7 +2541,7 @@ inline void flush(struct garbagelist * stackptr) {
                send_msg_2(STARTUPCORE, GCFINISHFLUSH, BAMBOO_NUM_OF_CORE);
        }
 #ifdef DEBUG
-       BAMBOO_DEBUGPRINT(0xe309);
+       BAMBOO_DEBUGPRINT(0xe311);
 #endif
 } // flush()
 
@@ -2451,7 +2631,6 @@ inline void gc(struct garbagelist * stackptr) {
                tprintf("start gc! \n");
                //dumpSMem();
 #endif
-
                gcprocessing = true;
                int i = 0;
                waitconfirm = false;
@@ -2465,7 +2644,7 @@ inline void gc(struct garbagelist * stackptr) {
                bool allStall = false;
 
                initGC();
-#ifdef GC_DEBUG
+#ifdef RAWPATH // TODO GC_DEBUG
                tprintf("Check core status \n");
 #endif
 
@@ -2478,7 +2657,7 @@ inline void gc(struct garbagelist * stackptr) {
                        }
                        BAMBOO_CLOSE_CRITICAL_SECTION();
                }
-#ifdef GC_DEBUG
+#ifdef RAWPATH // TODO GC_DEBUG
                tprintf("Start mark phase \n");
 #endif
                // all cores have finished compacting
@@ -2516,7 +2695,7 @@ inline void gc(struct garbagelist * stackptr) {
                if(gcheaptop < gcmarkedptrbound) {
                        gcheaptop = gcmarkedptrbound;
                }
-#ifdef GC_DEBUG
+#ifdef RAWPATH // TODO GC_DEBUG
                tprintf("prepare to cache large objs \n");
                //dumpSMem();
 #endif
@@ -2529,7 +2708,7 @@ inline void gc(struct garbagelist * stackptr) {
                int numpbc = loadbalance();
                // TODO
                numpbc = (BAMBOO_SHARED_MEM_SIZE)/(BAMBOO_SMEM_SIZE);
-#ifdef GC_DEBUG
+#ifdef RAWPATH // TODO GC_DEBUG
                tprintf("mark phase finished \n");
                //dumpSMem();
 #endif
@@ -2661,16 +2840,20 @@ inline void gc(struct garbagelist * stackptr) {
                        } // if(gctomove)
 
                } // while(COMPACTPHASE == gcphase) 
-#ifdef GC_DEBUG
+       
+#ifdef RAWPATH // TODO GC_DEBUG
                tprintf("prepare to move large objs \n");
                //dumpSMem();
 #endif
                // move largeObjs
                moveLObjs();
-#ifdef GC_DEBUG
+#ifdef RAWPATH // TODO GC_DEBUG
                tprintf("compact phase finished \n");
                //dumpSMem();
 #endif
+               RUNFREE(orig);
+               RUNFREE(to);
+               orig = to = NULL;
 
                gcphase = FLUSHPHASE;
                gccorestatus[BAMBOO_NUM_OF_CORE] = 1;
@@ -2680,7 +2863,7 @@ inline void gc(struct garbagelist * stackptr) {
                        send_msg_1(i, GCSTARTFLUSH);
                }
 
-#ifdef GC_DEBUG
+#ifdef RAWPATH // TODO GC_DEBUG
                tprintf("Start flush phase \n");
 #endif
                // flush phase
index a2963af41c073ffafb9fbfcb00f06239336f53df..1aa5de471fed6dfc4dc6bc5d5fca5abf81886383 100644 (file)
@@ -3,6 +3,7 @@
 #include "multicoregc.h"
 #include "multicorehelper.h"  // for mappins between core # and block #
 #include "structdefs.h"
+#include "MGCHash.h"
 
 #ifndef bool
 #define bool int
 
 #define NUMPTRS 100
 
+typedef enum {
+       INIT = 0,     // 0
+       DISCOVERED,   // 1
+       MARKED,       // 2
+       COMPACTED,    // 3
+       FLUSHED,      // 4
+       END           // 5
+} GCOBJFLAG;
+
 typedef enum {
        INITPHASE = 0x0,   // 0x0
        MARKPHASE,         // 0x1
@@ -64,6 +74,7 @@ volatile int gcmovepending;
 
 // mapping of old address to new address
 struct RuntimeHash * gcpointertbl;
+//struct MGCHash * gcpointertbl;
 int gcobj2map;
 int gcmappedobj;
 volatile bool gcismapped;
@@ -160,5 +171,9 @@ inline bool gcfindSpareMem_I(int * startaddr,
                                                                                                   int requiredmem,
                                                                                                   int requiredcore);
 
+inline void * gc_lobjdequeue4(int * length, int * host);
+inline int gc_lobjmoreItems4();
+inline void gc_lobjqueueinit4();
+
 #endif
 
index d1c29257084cddf5bbe910ff4c942c8b6abb7272..ebe6a6c5812a70709cfaff69c6b6fcd8ae3825c1 100644 (file)
@@ -236,10 +236,11 @@ struct Queue * totransobjqueue; // queue to hold objs to be transferred
 #define BAMBOO_SMEM_SIZE (64 * 64) // (BAMBOO_PAGE_SIZE)
 #define BAMBOO_SHARED_MEM_SIZE ((BAMBOO_PAGE_SIZE) * (BAMBOO_NUM_PAGES))
 #else
-#define BAMBOO_NUM_PAGES (64 * 4 * 0.75) //(1024 * 1024 * 3.5)  3G
-#define BAMBOO_PAGE_SIZE (16 * 1024 * 1024)  // (4096)
+#define BAMBOO_NUM_PAGES (64 * 1024) //(64 * 4 * 0.75) //(1024 * 1024 * 3.5)  3G
+#define BAMBOO_PAGE_SIZE (16 * 1024)// * 1024)  // (4096)
 #define BAMBOO_SMEM_SIZE (16 * 1024)
-#define BAMBOO_SHARED_MEM_SIZE (3.0 * 1024 * 1024 * 1024) // 3G// ((BAMBOO_PAGE_SIZE) * (BAMBOO_NUM_PAGES))
+#define BAMBOO_SHARED_MEM_SIZE (1024 * 1024 * 1024)
+//(3.0 * 1024 * 1024 * 1024) // 3G// ((BAMBOO_PAGE_SIZE) * (BAMBOO_NUM_PAGES))
 #endif
 
 #ifdef MULTICORE_GC
@@ -267,10 +268,14 @@ struct freeMemItem {
 
 struct freeMemList {
        struct freeMemItem * head;
-       struct freeMemItem * backuplist;  // hold removed freeMemItem for reuse
+       struct freeMemItem * backuplist;  // hold removed freeMemItem for reuse; 
+                                         // only maintain 1 fremmMemItem
 };
 
 struct freeMemList * bamboo_free_mem_list;
+int bamboo_reserved_smem; // reserved blocks on the top of the shared heap
+                          // e.g. 20% of the heap and should not be allocated
+                                                                                                       // otherwise gc is invoked
 #else
 volatile mspace bamboo_free_msp;
 #endif
index bda2bd20d6ab19946725f53ebbeb548f147d8f14..003487184e65a0c15f63243f01eb279d23d51e7e 100644 (file)
@@ -102,7 +102,9 @@ void initruntimedata() {
        gcself_numsendobjs = 0;
        gcself_numreceiveobjs = 0;
        gcmarkedptrbound = 0;
+       //mgchashCreate(2000, 0.75);
        gcpointertbl = allocateRuntimeHash(20);
+       //gcpointertbl = allocateMGCHash(20);
        gcobj2map = 0;
        gcmappedobj = 0;
        gcismapped = false;
@@ -161,7 +163,12 @@ void initruntimedata() {
 inline __attribute__((always_inline))
 void disruntimedata() {
 #ifdef MULTICORE_GC
+       //mgchashDelete();
        freeRuntimeHash(gcpointertbl);
+       //freeMGCHash(gcpointertbl);
+       if(gcsmemtbl != NULL) {
+               RUNFREE(gcsmemtbl);
+       }
 #else
        freeRuntimeHash(lockRedirectTbl);
        freeRuntimeHash(objRedirectLockTbl);
@@ -1278,8 +1285,14 @@ struct freeMemItem * findFreeMemChunk_I(int coren,
                                prev->next = freemem;
                        }
                        // put it to the tail of the list for reuse
-                       toremove->next = bamboo_free_mem_list->backuplist;
-                       bamboo_free_mem_list->backuplist = toremove;
+                       if(bamboo_free_mem_list->backuplist == NULL) {
+                               //toremove->next = bamboo_free_mem_list->backuplist;
+                               bamboo_free_mem_list->backuplist = toremove;
+                               bamboo_free_mem_list->backuplist->next = NULL;
+                       } else {
+                               // free it
+                               RUNFREE(toremove);
+                       }
                } else {
                        prev = freemem;
                        freemem = freemem->next;
@@ -1500,6 +1513,8 @@ msg:
                                                (struct transObjInfo *)(qitem->objectptr);
                                        if(tmpinfo->objptr == transObj->objptr) {
                                                // the same object, remove outdate one
+                                               RUNFREE(tmpinfo->queues);
+                                               RUNFREE(tmpinfo);
                                                removeItem(&objqueue, qitem);
                                                //break;
                                        } else {
@@ -2105,7 +2120,12 @@ msg:
 
        case GCMARKEDOBJ: {
                // received a markedObj msg
-               gc_enqueue_I(msgdata[1]);
+               if(((int *)msgdata[1])[6] == INIT) {
+                               // this is the first time that this object is discovered,
+                               // set the flag as DISCOVERED
+                               ((int *)msgdata[1])[6] = DISCOVERED;
+                               gc_enqueue_I(msgdata[1]);
+               }
                gcself_numreceiveobjs++;
                gcbusystatus = true;
                break;
@@ -2123,7 +2143,9 @@ msg:
        case GCMAPREQUEST: {
                // received a mapping info request msg
                void * dstptr = NULL;
+               //dstptr = mgchashSearch(msgdata[1]);
                RuntimeHashget(gcpointertbl, msgdata[1], &dstptr);
+               //MGCHashget(gcpointertbl, msgdata[1], &dstptr);
                if(NULL == dstptr) {
                        // no such pointer in this core, something is wrong
 #ifdef DEBUG
@@ -2131,6 +2153,12 @@ msg:
                        BAMBOO_DEBUGPRINT_REG(msgdata[2]);
 #endif
                        BAMBOO_EXIT(0xb007);
+                       //assume that the object was not moved, use the original address
+                       /*if(isMsgSending) {
+                               cache_msg_3(msgdata[2], GCMAPINFO, msgdata[1], msgdata[1]);
+                       } else {
+                               send_msg_3(msgdata[2], GCMAPINFO, msgdata[1], msgdata[1]);
+                       }*/
                } else {
                        // send back the mapping info
                        if(isMsgSending) {
@@ -2153,7 +2181,9 @@ msg:
                        BAMBOO_EXIT(0xb008);
                } else {
                        gcmappedobj = msgdata[2];
+                       //mgchashInsert_I(gcobj2map, gcmappedobj);
                        RuntimeHashadd_I(gcpointertbl, gcobj2map, gcmappedobj);
+                       //MGCHashadd_I(gcpointertbl, gcobj2map, gcmappedobj);
                }
                gcismapped = true;
                break;
@@ -2193,7 +2223,9 @@ msg:
        
        case GCLOBJMAPPING: {
                // received a large obj mapping info msg
+               //mgchashInsert_I(msgdata[1], msgdata[2]);
                RuntimeHashadd_I(gcpointertbl, msgdata[1], msgdata[2]);
+               //MGCHashadd_I(gcpointertbl, msgdata[1], msgdata[2]);
                break;
        }
 
@@ -2495,13 +2527,16 @@ newtask:
 #endif
 
     /* See if there are any active tasks */
-    if (hashsize(activetasks)>0) {
+    //if (hashsize(activetasks)>0) {
       int i;
 #ifdef PROFILE
 #ifdef ACCURATEPROFILE
          profileTaskStart("tpd checking");
 #endif
 #endif
+         //long clock1;
+         //clock1 = BAMBOO_GET_EXE_TIME();
+
          busystatus = true;
                currtpd=(struct taskparamdescriptor *) getfirstkey(activetasks);
                genfreekey(activetasks, currtpd);
@@ -2512,10 +2547,10 @@ newtask:
          // clear the lockRedirectTbl 
                // (TODO, this table should be empty after all locks are released)
          // reset all locks
-         for(j = 0; j < MAXTASKPARAMS; j++) {
+         /*for(j = 0; j < MAXTASKPARAMS; j++) {
                  runtime_locks[j].redirectlock = 0;
                  runtime_locks[j].value = 0;
-         }
+         }*/
          // get all required locks
          runtime_locklen = 0;
          // check which locks are needed
@@ -2558,7 +2593,26 @@ newtask:
 #ifdef DEBUG
          BAMBOO_DEBUGPRINT(0xe991);
 #endif
+         //long clock2;
+         //clock2 = BAMBOO_GET_EXE_TIME();
+
          for(i = 0; i < runtime_locklen; i++) {
+         /*for(i = 0; i < numparams; i++) {
+                 void * param = currtpd->parameterArray[i];
+                 int * lock = 0;
+                 bool insert = true;
+                 if(((struct ___Object___ *)param)->type == STARTUPTYPE) {
+                         islock = false;
+                         taskpointerarray[i+OFFSET]=param;
+                         goto execute;
+                 }
+                 if(((struct ___Object___ *)param)->lock == NULL) {
+                         lock = (int *)param;
+                 } else {
+                         lock = (int *)(((struct ___Object___ *)param)->lock);
+                 }
+                 */
+
                  int * lock = (int *)(runtime_locks[i].redirectlock);
                  islock = true;
                  // require locks for this parameter if it is not a startup object
@@ -2601,14 +2655,23 @@ newtask:
 #endif
 
                  if(grount == 0) {
-                         int j = 0;
 #ifdef DEBUG
                          BAMBOO_DEBUGPRINT(0xe992);
                                BAMBOO_DEBUGPRINT_REG(lock);
 #endif
+                               // check if has the lock already
+                               /*bool giveup = true;
+                               for(j = 0; j < runtime_locklen; j++) {
+                         if(runtime_locks[j].value == lock) {
+                                 giveup = false;
+                                 break;
+                         }
+                 }
+                               if(giveup) {*/
                          // can not get the lock, try later
-                         // releas all grabbed locks for previous parameters
-                         for(j = 0; j < i; ++j) {
+                         // release all grabbed locks for previous parameters
+                         for(j = 0; j < i; ++j) { 
+                         //for(j = 0; j < runtime_locklen; ++j) {
                                  lock = (int*)(runtime_locks[j].redirectlock);
                                  releasewritelock(lock);
                          }
@@ -2626,9 +2689,19 @@ newtask:
 #endif
 #endif
                          goto newtask;
-                 } // line 2794: if(grount == 0)
+                               //}
+                 }/* else { // line 2794: if(grount == 0)
+                 // TODO
+                 runtime_locks[runtime_locklen].value = (int)lock;
+                 runtime_locks[runtime_locklen].redirectlock = (int)param;
+                 runtime_locklen++;
+                 }*/
          } // line 2752:  for(i = 0; i < runtime_locklen; i++)
 
+         /*long clock3;
+         clock3 = BAMBOO_GET_EXE_TIME();
+         //tprintf("sort: %d, grab: %d \n", clock2-clock1, clock3-clock2);*/
+
 #ifdef DEBUG
        BAMBOO_DEBUGPRINT(0xe993);
 #endif
@@ -2752,11 +2825,20 @@ execute:
 #endif
          profileTaskStart(currtpd->task->name);
 #endif
+         // TODO
+         //long clock4;
+         //clock4 = BAMBOO_GET_EXE_TIME();
+         //tprintf("sort: %d, grab: %d, check: %d \n", (int)(clock2-clock1), (int)(clock3-clock2), (int)(clock4-clock3));
 
 #ifdef DEBUG
                BAMBOO_DEBUGPRINT(0xe997);
 #endif
                ((void(*) (void **))currtpd->task->taskptr)(taskpointerarray);
+               // TODO
+               //long clock5;
+         //clock5 = BAMBOO_GET_EXE_TIME();
+        // tprintf("sort: %d, grab: %d, check: %d \n", (int)(clock2-clock1), (int)(clock3-clock2), (int)(clock4-clock3));
+
 #ifdef PROFILE
 #ifdef ACCURATEPROFILE
          // task finish, set the end of the checkTaskInfo
@@ -2797,6 +2879,10 @@ execute:
            }
          } // line 3015: if(islock)
 
+               //long clock6;
+         //clock6 = BAMBOO_GET_EXE_TIME();
+         //tprintf("sort: %d, grab: %d, check: %d \n", (int)(clock2-clock1), (int)(clock3-clock2), (int)(clock4-clock3));
+
 #ifdef PROFILE
          // post task execution finish, set the end of the postTaskInfo
          profileTaskEnd();
@@ -2809,8 +2895,12 @@ execute:
 #ifdef DEBUG
          BAMBOO_DEBUGPRINT(0xe99a);
 #endif
+         //long clock7;
+         //clock7 = BAMBOO_GET_EXE_TIME();
+         //tprintf("sort: %d, grab: %d, check: %d, release: %d, other %d \n", (int)(clock2-clock1), (int)(clock3-clock2), (int)(clock4-clock3), (int)(clock6-clock5), (int)(clock7-clock6));
+
       } //  
-    } //  if (hashsize(activetasks)>0)  
+    //} //  if (hashsize(activetasks)>0)  
   } //  while(hashsize(activetasks)>0)
 #ifdef DEBUG
   BAMBOO_DEBUGPRINT(0xe99b);
index 9783c21d35ad5f46babc952c56eecc1f79a74dcd..7c73049264145871928f4e2c610763ea686c723f 100755 (executable)
@@ -705,6 +705,7 @@ cp ../Runtime/ObjectHash.c ./
 cp ../Runtime/socket.c ./
 cp ../Runtime/mem.c ./
 cp ../Runtime/multicoregarbage.c ./
+cp ../Runtime/MGCHash.c ./
 cp ../Runtime/GenericHashtable.h ./
 cp ../Runtime/mem.h ./
 cp ../Runtime/multicoreruntime.h ./
@@ -716,6 +717,7 @@ cp ../Runtime/SimpleHash.h ./
 cp ../Runtime/multicoregc.h ./
 cp ../Runtime/multicoregarbage.h ./
 cp ../Runtime/multicorehelper.h ./
+cp ../Runtime/MGCHash.h ./
 cp ../Tilera/Runtime/*.c ./
 cp ../Tilera/Runtime/*.h ./
 cp ../Tilera/lib/* ./