From f28edfc6484179ffb6a183ae5134456d0d55bb90 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Wed, 15 Jun 2011 07:42:08 +0000 Subject: [PATCH] bug fix...gcloads was used twice for different things with different types... --- Robust/src/Runtime/bamboo/multicoregarbage.h | 3 ++- .../src/Runtime/bamboo/multicoregccompact.c | 20 +++++++++---------- Robust/src/Runtime/bamboo/multicoremsg.c | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.h b/Robust/src/Runtime/bamboo/multicoregarbage.h index f13077f3..88c8dbc1 100644 --- a/Robust/src/Runtime/bamboo/multicoregarbage.h +++ b/Robust/src/Runtime/bamboo/multicoregarbage.h @@ -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 diff --git a/Robust/src/Runtime/bamboo/multicoregccompact.c b/Robust/src/Runtime/bamboo/multicoregccompact.c index 5b880b8e..b08eb129 100644 --- a/Robust/src/Runtime/bamboo/multicoregccompact.c +++ b/Robust/src/Runtime/bamboo/multicoregccompact.c @@ -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 diff --git a/Robust/src/Runtime/bamboo/multicoremsg.c b/Robust/src/Runtime/bamboo/multicoremsg.c index a0c632df..183b0f02 100644 --- a/Robust/src/Runtime/bamboo/multicoremsg.c +++ b/Robust/src/Runtime/bamboo/multicoremsg.c @@ -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 -- 2.34.1