From d474e8b1b23b8e123cc650a2a75e448b1c17a2fa Mon Sep 17 00:00:00 2001 From: jzhou Date: Wed, 23 Mar 2011 01:05:04 +0000 Subject: [PATCH] Bug fixes in MGC verison. SPECjbb2005 is now working with 62-core gc. --- Robust/src/IR/Flat/BuildCodeMGC.java | 3 --- Robust/src/Runtime/bamboo/multicoregarbage.c | 22 ++++++-------------- Robust/src/Runtime/bamboo/multicoregarbage.h | 6 ++++++ Robust/src/Runtime/bamboo/multicoreruntime.c | 9 +++----- 4 files changed, 15 insertions(+), 25 deletions(-) diff --git a/Robust/src/IR/Flat/BuildCodeMGC.java b/Robust/src/IR/Flat/BuildCodeMGC.java index adbb3225..d7b2accd 100644 --- a/Robust/src/IR/Flat/BuildCodeMGC.java +++ b/Robust/src/IR/Flat/BuildCodeMGC.java @@ -209,9 +209,6 @@ public class BuildCodeMGC extends BuildCode { } else { outmethod.println(" global_defs_p->"+t_cd.getSafeSymbol()+"classobj = allocate_new(" + typeutil.getClass(TypeUtil.ObjectClass).getId() + ");"); } - outmethod.println(" global_defs_p->"+t_cd.getSafeSymbol()+"classobj->type = " + t_cd.getId() + ";"); - - outmethod.println(" initlock((struct ___Object___ *)((global_defs_p->"+t_cd.getSafeSymbol()+"classobj)));"); outmethod.println(" }"); } diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.c b/Robust/src/Runtime/bamboo/multicoregarbage.c index ff0b2c25..41c33447 100644 --- a/Robust/src/Runtime/bamboo/multicoregarbage.c +++ b/Robust/src/Runtime/bamboo/multicoregarbage.c @@ -8,12 +8,6 @@ #include "ObjectHash.h" #include "GCSharedHash.h" -#ifdef TASK -#define BAMBOOMARKBIT 6 -#elif defined MGC -#define BAMBOOMARKBIT 4 -#endif // TASK - extern int corenum; #ifdef TASK extern struct parameterwrapper ** objectqueues[][NUMCLASSES]; @@ -1336,7 +1330,6 @@ inline void mark(bool isfirst, send_msg_4(STARTUPCORE, GCFINISHMARK, BAMBOO_NUM_OF_CORE, gcself_numsendobjs, gcself_numreceiveobjs, false); sendStall = true; - tprintf("Make finished %x \n", (int)BAMBOO_NUM_OF_CORE); } } // if(STARTUPCORE == BAMBOO_NUM_OF_CORE) ... GC_BAMBOO_DEBUGPRINT(0xed0a); @@ -1765,8 +1758,8 @@ inline bool moveobj(struct moveHelper * orig, int mark = 0; int isize = 0; innermoveobj: - while((char)(*((int*)(orig->ptr))) == (char)(-2)) { - orig->ptr = (int*)(orig->ptr) + 1; + while((*((char*)(orig->ptr))) == (char)(-2)) { + orig->ptr = (void*)(orig->ptr) + 1; } #ifdef GC_CACHE_ADAPT completePageConvert(orig, to, to->ptr, false); @@ -1788,7 +1781,7 @@ innermoveobj: type = ((int *)(origptr))[0]; size = 0; if(type == 0) { - // end of this block, go to next one + // end of this block, go to next one if(!nextSBlock(orig)) { // finished, no more data return true; @@ -1866,7 +1859,7 @@ innermoveobj: } } BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); - GC_BAMBOO_DEBUGPRINT(0xcdce); + GC_BAMBOO_DEBUGPRINT(0xcdce); GC_BAMBOO_DEBUGPRINT_REG(origptr); GC_BAMBOO_DEBUGPRINT_REG(toptr); GC_BAMBOO_DEBUGPRINT_REG(isize); @@ -2097,7 +2090,6 @@ inline void compact() { (struct moveHelper *)RUNMALLOC(sizeof(struct moveHelper)); struct moveHelper * to = (struct moveHelper *)RUNMALLOC(sizeof(struct moveHelper)); - if(!initOrig_Dst(orig, to)) { // no available data to compact // send compact finish msg to STARTUP core @@ -2121,7 +2113,6 @@ inline void compact() { INTPTR heaptopptr = 0; bool localcompact = true; compacthelper(orig, to, &filledblocks, &heaptopptr, &localcompact); - RUNFREE(orig); RUNFREE(to); } // compact() @@ -3286,6 +3277,7 @@ inline void gc_master(struct garbagelist * stackptr) { bool isfirst = true; bool allStall = false; + #ifdef GC_CACHE_ADAPT // prepare for cache adaption: cacheAdapt_gc(true); @@ -3668,8 +3660,6 @@ inline bool gc(struct garbagelist * stackptr) { return false; } - if(BAMBOO_NUM_OF_CORE==0) tprintf("GC starts!\n"); // TODO - #ifdef GC_CACHE_ADAPT #ifdef GC_CACHE_SAMPLING // disable the timer interrupt @@ -3679,7 +3669,7 @@ inline bool gc(struct garbagelist * stackptr) { // core coordinator routine if(0 == BAMBOO_NUM_OF_CORE) { #ifdef GC_DEBUG - printf("(%x,%X) Check if can do gc or not\n", udn_tile_coord_x(), + printf("(%x,%x) Check if can do gc or not\n", udn_tile_coord_x(), udn_tile_coord_y()); #endif bool isallstall = true; diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.h b/Robust/src/Runtime/bamboo/multicoregarbage.h index 5bce35db..92528b2f 100644 --- a/Robust/src/Runtime/bamboo/multicoregarbage.h +++ b/Robust/src/Runtime/bamboo/multicoregarbage.h @@ -13,6 +13,12 @@ #define bool int #endif +#ifdef TASK +#define BAMBOOMARKBIT 6 +#elif defined MGC +#define BAMBOOMARKBIT 4 +#endif // TASK + // data structures for GC #define BAMBOO_SMEM_SIZE_L (BAMBOO_SMEM_SIZE * 2) #define BAMBOO_LARGE_SMEM_BOUND (BAMBOO_SMEM_SIZE_L*NUMCORES4GC) diff --git a/Robust/src/Runtime/bamboo/multicoreruntime.c b/Robust/src/Runtime/bamboo/multicoreruntime.c index 9b3eb1a3..496fc086 100644 --- a/Robust/src/Runtime/bamboo/multicoreruntime.c +++ b/Robust/src/Runtime/bamboo/multicoreruntime.c @@ -516,9 +516,6 @@ INLINE void initruntimedata() { gctomove = false; gcmovepending = 0; gcblock2fill = 0; - gcsbstarttbl = BAMBOO_BASE_VA; - bamboo_smemtbl = (void *)gcsbstarttbl - + (BAMBOO_SHARED_MEM_SIZE/BAMBOO_SMEM_SIZE)*sizeof(INTPTR); if(BAMBOO_NUM_OF_CORE < NUMCORES4GC) { int t_size = ((BAMBOO_RMSP_SIZE)-sizeof(mgcsharedhashtbl_t)*2 -128*sizeof(size_t))/sizeof(mgcsharedhashlistnode_t)-2; @@ -1441,14 +1438,14 @@ INLINE void processmsg_gcmarkedobj_I() { int data1 = msgdata[msgdataindex]; MSG_INDEXINC_I(); // received a markedObj msg - if(((int *)data1)[6] == INIT) { + if(((int *)data1)[BAMBOOMARKBIT] == INIT) { // this is the first time that this object is discovered, // set the flag as DISCOVERED - ((int *)data1)[6] = DISCOVERED; + ((int *)data1)[BAMBOOMARKBIT] = DISCOVERED; gc_enqueue_I(data1); } // set the remote flag - ((int *)data1)[6] |= REMOTEM; + ((int *)data1)[BAMBOOMARKBIT] |= REMOTEM; gcself_numreceiveobjs++; gcbusystatus = true; } -- 2.34.1