From: jzhou Date: Fri, 8 Apr 2011 03:42:44 +0000 (+0000) Subject: Enable 1,2,4,8,16,32,50 cores' execution X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d75f893fab9cfaeae1128e5eaa4568fefdb878ee;p=IRC.git Enable 1,2,4,8,16,32,50 cores' execution --- diff --git a/Robust/src/ClassLibrary/MGC/System.java b/Robust/src/ClassLibrary/MGC/System.java index c3a54860..32b69437 100644 --- a/Robust/src/ClassLibrary/MGC/System.java +++ b/Robust/src/ClassLibrary/MGC/System.java @@ -10,6 +10,10 @@ public class System { String s=String.valueOf(x); printString(s); } + + public static native void setgcprofileflag(); + + public static native void resetgcprofileflag(); public static native long currentTimeMillis(); diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index e76004e2..43b35135 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -483,7 +483,9 @@ public class BuildCode { // always include: compiler directives will leave out // instrumentation when option is not set + if(!state.MULTICORE) { outmethod.println("#include \"coreprof/coreprof.h\""); + } if (state.FASTCHECK) { outmethod.println("#include \"localobjects.h\""); diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.c b/Robust/src/Runtime/bamboo/multicoregarbage.c index 1f34fd78..f801219b 100644 --- a/Robust/src/Runtime/bamboo/multicoregarbage.c +++ b/Robust/src/Runtime/bamboo/multicoregarbage.c @@ -31,7 +31,7 @@ extern unsigned int gcmem_mixed_usedmem; extern unsigned int bamboo_threadlocks; #endif -int gcmarkwaitcounter = -1; +//int gcmarkwaitcounter = -1; struct pointerblock { void * ptrs[NUMPTRS]; @@ -508,14 +508,16 @@ inline void checkMarkStatue() { BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); } // if(!gcwaitconfirm) else() } else { - if(waitconfirm) { + /*if(waitconfirm) { // There were changes between phase 1 and phase 2, can not decide // whether the mark phase has been finished waitconfirm = false; // As it fails in phase 2, flip the entries gcnumsrobjs_index = (gcnumsrobjs_index == 0) ? 1 : 0; - gcmarkwaitcounter = 1000; - } else if(gcmarkwaitcounter == 0) { + //gcmarkwaitcounter = 1000; + //BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); + }*/ /*else if(gcmarkwaitcounter == 0) { + tprintf("mark confirm reques \n"); // need to triger status check gccorestatus[BAMBOO_NUM_OF_CORE] = 1; waitconfirm = true; @@ -529,8 +531,9 @@ inline void checkMarkStatue() { gcmarkwaitcounter = -1; } else if(gcmarkwaitcounter != -1) { gcmarkwaitcounter--; - } - BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); + BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); + }*/ + BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); } // if(allStall) } // if((!waitconfirm)... GC_BAMBOO_DEBUGPRINT(0xee0a); @@ -539,7 +542,7 @@ inline void checkMarkStatue() { inline void initGC() { int i; if(STARTUPCORE == BAMBOO_NUM_OF_CORE) { - gcmarkwaitcounter = -1; + //gcmarkwaitcounter = -1; for(i = 0; i < NUMCORES4GC; ++i) { gccorestatus[i] = 1; gcnumsendobjs[0][i] = gcnumsendobjs[1][i] = 0; @@ -654,7 +657,13 @@ inline bool cacheLObjs() { tmp_len = gclobjtail2->lengths[gclobjtailindex2 - 1]; sumsize += tmp_len; #ifdef GC_PROFILE +#ifdef MGC_SPEC + if((STARTUPCORE != BAMBOO_NUM_OF_CORE) || gc_profile_flag) { +#endif gc_num_lobj++; +#ifdef MGC_SPEC + } +#endif #endif GC_BAMBOO_DEBUGPRINT_REG(gclobjtail2->lobjs[gclobjtailindex2-1]); GC_BAMBOO_DEBUGPRINT_REG(tmp_len); @@ -696,7 +705,13 @@ inline bool cacheLObjs() { } // while(gc_lobjmoreItems2()) #ifdef GC_PROFILE +#ifdef MGC_SPEC + if((STARTUPCORE != BAMBOO_NUM_OF_CORE) || gc_profile_flag) { +#endif gc_num_lobjspace = sumsize; +#ifdef MGC_SPEC + } +#endif #endif // check if there are enough space to cache these large objs unsigned int dst = gcbaseva + (BAMBOO_SHARED_MEM_SIZE) -sumsize; @@ -1097,12 +1112,18 @@ inline void moveLObjs() { #endif #ifdef GC_PROFILE +#ifdef MGC_SPEC + if((STARTUPCORE != BAMBOO_NUM_OF_CORE) || gc_profile_flag) { +#endif // check how many live space there are gc_num_livespace = 0; for(int tmpi = 0; tmpi < gcnumblock; tmpi++) { gc_num_livespace += bamboo_smemtbl[tmpi]; } gc_num_freespace = (BAMBOO_SHARED_MEM_SIZE) - gc_num_livespace; +#ifdef MGC_SPEC + } +#endif #endif GC_BAMBOO_DEBUGPRINT(0xea08); GC_BAMBOO_DEBUGPRINT_REG(gcheaptop); @@ -1138,7 +1159,13 @@ inline void markObj(void * objptr) { // send a msg to host informing that objptr is active send_msg_2(host, GCMARKEDOBJ, objptr, false); #ifdef GC_PROFILE +#ifdef MGC_SPEC + if((STARTUPCORE != BAMBOO_NUM_OF_CORE) || gc_profile_flag) { +#endif gc_num_forwardobj++; +#ifdef MGC_SPEC + } +#endif #endif // GC_PROFILE gcself_numsendobjs++; MGCHashadd(gcforwardobjtbl, (int)objptr); @@ -1979,7 +2006,13 @@ innermoveobj: unsigned int tobound = (unsigned int)to->bound; GC_BAMBOO_DEBUGPRINT(0xe204); #ifdef GC_PROFILE +#ifdef MGC_SPEC + if((STARTUPCORE != BAMBOO_NUM_OF_CORE) || gc_profile_flag) { +#endif gc_num_liveobj++; +#ifdef MGC_SPEC + } +#endif #endif // marked obj, copy it to current heap top // check to see if remaining space is enough @@ -2092,7 +2125,7 @@ innermoveobj: memcpy(toptr, origptr, size); } // fill the remaining space with -2 - BAMBOO_MEMSET_WH(toptr+size, -2, isize-size); + BAMBOO_MEMSET_WH((unsigned int)(toptr+size), -2, isize-size); } #ifdef GC_TBL_DEBUG if((gcmappingtbl[OBJMAPPINGINDEX((unsigned int)origptr)] != 2)) { @@ -2755,21 +2788,21 @@ inline void flush(struct garbagelist * stackptr) { flushRuntimeObj(stackptr); - while(gc_moreItems_I()){//true) { - //BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); - //bool hasItems = gc_moreItems_I(); - //BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); - //if(!hasItems) { - // break; - //} + while(true) { + BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); + bool hasItems = gc_moreItems_I(); + BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); + if(!hasItems) { + break; + } GC_BAMBOO_DEBUGPRINT(0xe301); - //BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); + BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); void * ptr = gc_dequeue_I(); #ifdef GC_TBL_DEBUG unsigned int bkptr = (unsigned int)ptr; #endif - //BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); + BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); if(ISSHAREDOBJ(ptr)) { // should be a local shared obj and should have mapping info #ifdef GC_TBL_DEBUG @@ -3729,7 +3762,7 @@ inline void gc_nocollect(struct garbagelist * stackptr) { } // void gc_collect(struct garbagelist * stackptr) inline void gc_master(struct garbagelist * stackptr) { - tprintf("start GC !!!!!!!!!!!!! \n"); + //tprintf("start GC !!!!!!!!!!!!! \n"); gcphase = INITPHASE; int i = 0; @@ -3765,7 +3798,13 @@ inline void gc_master(struct garbagelist * stackptr) { BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); } #ifdef GC_PROFILE +#ifdef MGC_SPEC + if(gc_profile_flag) { +#endif gc_profileItem(); +#ifdef MGC_SPEC + } +#endif #endif #ifdef GC_CACHE_ADAPT_POLICY_OUTPUT gc_output_cache_sampling(); @@ -3811,7 +3850,13 @@ inline void gc_master(struct garbagelist * stackptr) { gcheaptop = gcmarkedptrbound; } #ifdef GC_PROFILE +#ifdef MGC_SPEC + if(gc_profile_flag) { +#endif gc_profileItem(); +#ifdef MGC_SPEC + } +#endif #endif #ifdef RAWPATH // TODO GC_DEBUG printf("(%x,%x) prepare to cache large objs \n", udn_tile_coord_x(), @@ -3871,7 +3916,13 @@ inline void gc_master(struct garbagelist * stackptr) { BAMBOO_CACHE_MF(); #ifdef GC_PROFILE +#ifdef MGC_SPEC + if(gc_profile_flag) { +#endif gc_profileItem(); +#ifdef MGC_SPEC + } +#endif #endif // compact phase @@ -3955,7 +4006,13 @@ inline void gc_master(struct garbagelist * stackptr) { } // if(gctomove) } // while(COMPACTPHASE == gcphase) #ifdef GC_PROFILE +#ifdef MGC_SPEC + if(gc_profile_flag) { +#endif gc_profileItem(); +#ifdef MGC_SPEC + } +#endif #endif #ifdef RAWPATH // TODO GC_DEBUG printf("(%x,%x) prepare to move large objs \n", udn_tile_coord_x(), @@ -3981,7 +4038,13 @@ inline void gc_master(struct garbagelist * stackptr) { send_msg_1(i, GCSTARTFLUSH, false); } #ifdef GC_PROFILE +#ifdef MGC_SPEC + if(gc_profile_flag) { +#endif gc_profileItem(); +#ifdef MGC_SPEC + } +#endif #endif #ifdef RAWPATH // TODO GC_DEBUG printf("(%x,%x) Start flush phase \n", udn_tile_coord_x(), @@ -4012,7 +4075,13 @@ inline void gc_master(struct garbagelist * stackptr) { #ifdef GC_CACHE_ADAPT #ifdef GC_PROFILE +#ifdef MGC_SPEC + if(gc_profile_flag) { +#endif gc_profileItem(); +#ifdef MGC_SPEC + } +#endif #endif gcphase = PREFINISHPHASE; gccorestatus[BAMBOO_NUM_OF_CORE] = 1; @@ -4069,7 +4138,13 @@ inline void gc_master(struct garbagelist * stackptr) { bamboo_smem_zero_top = NULL; #ifdef GC_PROFILE +#ifdef MGC_SPEC + if(gc_profile_flag) { +#endif gc_profileEnd(); +#ifdef MGC_SPEC + } +#endif #endif gccorestatus[BAMBOO_NUM_OF_CORE] = 1; for(i = 1; i < NUMCORESACTIVE; ++i) { @@ -4084,6 +4159,7 @@ inline void gc_master(struct garbagelist * stackptr) { printf("(%x,%x) gc finished \n", udn_tile_coord_x(), udn_tile_coord_y()); #endif + //tprintf("finish GC ! \n"); } // void gc_master(struct garbagelist * stackptr) inline bool gc(struct garbagelist * stackptr) { @@ -4123,7 +4199,13 @@ inline bool gc(struct garbagelist * stackptr) { return false; } else { #ifdef GC_PROFILE +#ifdef MGC_SPEC + if(gc_profile_flag) { +#endif gc_profileStart(); +#ifdef MGC_SPEC + } +#endif #endif pregccheck: gcnumsendobjs[0][BAMBOO_NUM_OF_CORE] = self_numsendobjs; diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.h b/Robust/src/Runtime/bamboo/multicoregarbage.h index 16ad1728..838f19c8 100644 --- a/Robust/src/Runtime/bamboo/multicoregarbage.h +++ b/Robust/src/Runtime/bamboo/multicoregarbage.h @@ -30,16 +30,16 @@ unsigned int gc_num_flush_dtlb; #endif -#define NUMPTRS 100 +#define NUMPTRS 120 // for GC profile #ifdef GC_PROFILE #define GCINFOLENGTH 100 #ifdef GC_CACHE_ADAPT -#define GC_PROFILE_NUM_FIELD 16 -#else #define GC_PROFILE_NUM_FIELD 15 +#else +#define GC_PROFILE_NUM_FIELD 14 #endif // GC_CACHE_ADAPT typedef struct gc_info { @@ -60,6 +60,10 @@ unsigned int gc_num_obj; unsigned int gc_num_forwardobj; unsigned int gc_num_profiles; +#ifdef MGC_SPEC +volatile bool gc_profile_flag; +#endif + #endif // GC_PROFILE typedef enum { @@ -168,7 +172,7 @@ unsigned int size_cachepolicytbl; #define OBJMAPPINGINDEX(p) (((unsigned int)p-gcbaseva)/bamboo_baseobjsize) #define ISSHAREDOBJ(p) \ - ((((unsigned int)p)>gcbaseva)&&(((unsigned int)p)<(gcbaseva+(BAMBOO_SHARED_MEM_SIZE)))) + ((((unsigned int)p)>=gcbaseva)&&(((unsigned int)p)<(gcbaseva+(BAMBOO_SHARED_MEM_SIZE)))) #define ALIGNSIZE(s, as) \ (*((unsigned int*)as)) = (((s) & (~(BAMBOO_CACHE_LINE_MASK))) + (BAMBOO_CACHE_LINE_SIZE)) diff --git a/Robust/src/Runtime/bamboo/multicorehelper.h b/Robust/src/Runtime/bamboo/multicorehelper.h index 2410552d..5ecf1658 100644 --- a/Robust/src/Runtime/bamboo/multicorehelper.h +++ b/Robust/src/Runtime/bamboo/multicorehelper.h @@ -6,6 +6,116 @@ static unsigned int gc_core2block[2] = {0,1}; static unsigned int gc_block2core[2] = { 0, 0}; +#elif defined GC_2 +// NUMCORES4GC = 2 +static unsigned int gc_core2block[4] = { + 0,3, + 1,2 +}; + +static unsigned int gc_block2core[4] = { + 0, 1, + 1, 0 +}; +#elif defined GC_4 +// NUMCORES4GC = 4 +static unsigned int gc_core2block[8] = { + 0,7, 3,4, + 1,6, 2,5 +}; + +static unsigned int gc_block2core[8] = { + 0, 2, 3, 1, + 1, 3, 2, 0 +}; +#elif defined GC_8 +// NUMCORES4GC = 8 +static unsigned int gc_core2block[16] = { + 0,15, 3,12, 4,11, 7,8, + 1,14, 2,13, 5,10, 6,9 +}; + +static unsigned int gc_block2core[16] = { + 0, 4, 5, 1, 2, 6, 7, 3, + 3, 7, 6, 2, 1, 5, 4, 0 +}; +#elif defined GC_16 +// NUMCORES4GC = 16 +static unsigned int gc_core2block[32] = { + 0,31, 7,24, 8,23, 15,16, + 1,30, 6,25, 9,22, 14,17, + 2,29, 5,26, 10,21, 13,18, + 3,28, 4,27, 11,20, 12,19 +}; + +static unsigned int gc_block2core[32] = { + 0, 4, 8, 12, 13, 9, 5, 1, + 2, 6, 10, 14, 15, 11, 7, 3, + 3, 7, 11, 15, 14, 10, 6, 2, + 1, 5, 9, 13, 12, 8, 4, 0 +}; +#elif defined GC_32 +// NUMCORES4GC = 32 +static unsigned int gc_core2block[64] = { + 0,63, 15,48, 16,47, 31,32, + 1,62, 14,49, 17,46, 30,33, + 2,61, 13,50, 18,45, 29,34, + 3,60, 12,51, 19,44, 28,35, + 4,59, 11,52, 20,43, 27,36, + 5,58, 10,53, 21,42, 26,37, + 6,57, 9,54, 22,41, 25,38, + 7,56, 8,55, 23,40, 24,39 +}; + +static unsigned int gc_block2core[64] = { + 0, 4, 8, 12, 16, 20, 24, 28, 29, 25, 21, 17, 13, 9, 5, 1, + 2, 6, 10, 14, 18, 22, 26, 30, 31, 27, 23, 19, 15, 11, 7, 3, + 3, 7, 11, 15, 19, 23, 27, 31, 30, 26, 22, 18, 14, 10, 6, 2, + 1, 5, 9, 13, 17, 21, 25, 29, 28, 24, 20, 16, 12, 8, 4, 0 +}; +#elif defined GC_48 +// NUMCORES4GC = 50 +static unsigned int gc_core2block[96] = { + 0,95, 15,80, 16,79, 31,64, 32,63, 47,48, + 1,94, 14,81, 17,78, 30,65, 33,62, 46,49, + 2,93, 13,82, 18,77, 29,66, 34,61, 45,50, + 3,92, 12,83, 19,76, 28,67, 35,60, 44,51, + 4,91, 11,84, 20,75, 27,68, 36,59, 43,52, + 5,90, 10,85, 21,74, 26,69, 37,58, 42,53, + 6,89, 9,86, 22,73, 25,70, 38,57, 41,54, + 7,88, 8,87, 23,72, 24,71, 39,56, 40,55 +}; + +static unsigned int gc_block2core[96] = { + 0, 6, 12, 18, 24, 30, 36, 42, 43, 37, 31, 25, 19, 13, 7, 1, + 2, 8, 14, 20, 26, 32, 38, 44, 45, 39, 33, 27, 21, 15, 9, 3, + 4, 10, 16, 22, 28, 34, 40, 46, 47, 41, 35, 29, 23, 17, 11, 5, + 5, 11, 17, 23, 29, 35, 41, 47, 46, 40, 34, 28, 22, 16, 10, 4, + 3, 9, 15, 21, 27, 33, 39, 45, 44, 38, 32, 26, 20, 14, 8, 2, + 1, 7, 13, 19, 25, 31, 37, 43, 42, 36, 30, 24, 18, 12, 6, 0 +}; +#elif defined GC_50 +// NUMCORES4GC = 50 +static unsigned int gc_core2block[100] = { + 0,99, 15,84, 16,83, 31,68, 32,67, 47,52, + 1,98, 14,85, 17,82, 30,69, 33,66, 46,53, + 2,97, 13,86, 18,81, 29,70, 34,65, 45,54, + 3,96, 12,87, 19,80, 28,71, 35,64, 44,55, + 4,95, 11,88, 20,79, 27,72, 36,63, 43,56, + 5,94, 10,89, 21,78, 26,73, 37,62, 42,57, + 6,93, 9,90, 22,77, 25,74, 38,61, 41,58, 48,51, + 7,92, 8,91, 23,76, 24,75, 39,60, 40,59, 49,50 +}; + +static unsigned int gc_block2core[100] = { + 0, 6, 12, 18, 24, 30, 36, 43, 44, 37, 31, 25, 19, 13, 7, 1, + 2, 8, 14, 20, 26, 32, 38, 45, 46, 39, 33, 27, 21, 15, 9, 3, + 4, 10, 16, 22, 28, 34, 40, 47, 48, 41, 35, 29, 23, 17, 11, 5, + 42, 49, 49, 42, + 5, 11, 17, 23, 29, 35, 41, 48, 47, 40, 34, 28, 22, 16, 10, 4, + 3, 9, 15, 21, 27, 33, 39, 46, 45, 38, 32, 26, 20, 14, 8, 2, + 1, 7, 13, 19, 25, 31, 37, 44, 43, 36, 30, 24, 18, 12, 6, 0 +}; #elif defined GC_56 // NUMCORES4GC = 56 static unsigned int gc_core2block[112] = { diff --git a/Robust/src/Runtime/bamboo/multicoremem.c b/Robust/src/Runtime/bamboo/multicoremem.c index c139bc38..cf6c921a 100644 --- a/Robust/src/Runtime/bamboo/multicoremem.c +++ b/Robust/src/Runtime/bamboo/multicoremem.c @@ -68,6 +68,226 @@ unsigned int gcmem_mixed_usedmem = 0; int core2test[1][NUM_CORES2TEST] = { {0, -1, -1, -1, -1, -1, -1, -1, -1} }; +#elif defined GC_2 +int core2test[2][NUM_CORES2TEST] = { + { 0, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, + { 1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} +}; +#elif defined GC_4 +int core2test[4][NUM_CORES2TEST] = { + { 0, -1, -1, 2, 1, -1, -1, -1, -1, -1, -1, -1, -1}, + { 1, -1, 0, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1}, + { 2, 0, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1}, + { 3, 1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} +}; +#elif defined GC_8 +int core2test[8][NUM_CORES2TEST] = { + { 0, -1, -1, 4, 1, -1, -1, -1, -1, -1, 5, 2, -1}, + { 1, -1, 0, 5, 2, -1, -1, -1, 4, -1, 6, 3, -1}, + { 2, -1, 1, 6, 3, -1, -1, 0, 5, -1, 7, -1, -1}, + { 3, -1, 2, 7, -1, -1, -1, 1, 6, -1, -1, -1, -1}, + { 4, 0, -1, -1, 5, -1, -1, -1, -1, -1, -1, 6, 1}, + { 5, 1, 4, -1, 6, -1, 0, -1, -1, -1, -1, 7, 2}, + { 6, 2, 5, -1, 7, -1, 1, 4, -1, -1, -1, -1, 3}, + { 7, 3, 6, -1, -1, -1, 2, 5, -1, -1, -1, -1, -1} +}; +#elif defined GC_16 +int core2test[16][NUM_CORES2TEST] = { + { 0, -1, -1, 4, 1, -1, -1, -1, -1, 8, 5, 2, -1}, + { 1, -1, 0, 5, 2, -1, -1, -1, 4, 9, 6, 3, -1}, + { 2, -1, 1, 6, 3, -1, -1, 0, 5, 10, 7, -1, -1}, + { 3, -1, 2, 7, -1, -1, -1, 1, 6, 11, -1, -1, -1}, + { 4, 0, -1, 8, 5, -1, -1, -1, -1, 12, 9, 6, 1}, + { 5, 1, 4, 9, 6, -1, 0, -1, 8, 13, 10, 7, 2}, + { 6, 2, 5, 10, 7, -1, 1, 4, 9, 14, 11, -1, 3}, + { 7, 3, 6, 11, -1, -1, 2, 5, 10, 15, -1, -1, -1}, + { 8, 4, -1, 12, 9, 0, -1, -1, -1, -1, 13, 10, 5}, + { 9, 5, 8, 13, 10, 1, 4, -1, 12, -1, 14, 11, 6}, + {10, 6, 9, 14, 11, 2, 5, 8, 13, -1, 15, -1, 7}, + {11, 7, 10, 15, -1, 3, 6, 9, 14, -1, -1, -1, -1}, + {12, 8, -1, -1, 13, 4, -1, -1, -1, -1, -1, 14, 9}, + {13, 9, 12, -1, 14, 5, 8, -1, -1, -1, -1, 15, 10}, + {14, 10, 13, -1, 15, 6, 9, 12, -1, -1, -1, -1, 11}, + {15, 11, 14, -1, -1, 7, 10, 13, -1, -1, -1, -1, -1} +}; +#elif defined GC_32 +int core2test[32][NUM_CORES2TEST] = { + { 0, -1, -1, 4, 1, -1, -1, -1, -1, 8, 5, 2, -1}, + { 1, -1, 0, 5, 2, -1, -1, -1, 4, 9, 6, 3, -1}, + { 2, -1, 1, 6, 3, -1, -1, 0, 5, 10, 7, -1, -1}, + { 3, -1, 2, 7, -1, -1, -1, 1, 6, 11, -1, -1, -1}, + { 4, 0, -1, 8, 5, -1, -1, -1, -1, 12, 9, 6, 1}, + { 5, 1, 4, 9, 6, -1, 0, -1, 8, 13, 10, 7, 2}, + { 6, 2, 5, 10, 7, -1, 1, 4, 9, 14, 11, -1, 3}, + { 7, 3, 6, 11, -1, -1, 2, 5, 10, 15, -1, -1, -1}, + { 8, 4, -1, 12, 9, 0, -1, -1, -1, 16, 13, 10, 5}, + { 9, 5, 8, 13, 10, 1, 4, -1, 12, 17, 14, 11, 6}, + {10, 6, 9, 14, 11, 2, 5, 8, 13, 18, 15, -1, 7}, + {11, 7, 10, 15, -1, 3, 6, 9, 14, 19, -1, -1, -1}, + {12, 8, -1, 16, 13, 4, -1, -1, -1, 20, 17, 14, 9}, + {13, 9, 12, 17, 14, 5, 8, -1, 16, 21, 18, 15, 10}, + {14, 10, 13, 18, 15, 6, 9, 12, 17, 22, 19, -1, 11}, + {15, 11, 14, 19, -1, 7, 10, 13, 18, 23, -1, -1, -1}, + {16, 12, -1, 20, 17, 8, -1, -1, -1, 24, 21, 18, 13}, + {17, 13, 16, 21, 18, 9, 12, -1, 20, 25, 22, 19, 14}, + {18, 14, 17, 22, 19, 10, 13, 16, 21, 26, 23, -1, 15}, + {19, 15, 18, 23, -1, 11, 14, 17, 22, 27, -1, -1, -1}, + {20, 16, -1, 24, 21, 12, -1, -1, -1, 28, 25, 22, 17}, + {21, 17, 20, 25, 22, 13, 16, -1, 24, 29, 26, 23, 18}, + {22, 18, 21, 26, 23, 14, 17, 20, 25, 30, 27, -1, 19}, + {23, 19, 22, 27, -1, 15, 18, 21, 26, 31, -1, -1, -1}, + {24, 20, -1, 28, 25, 16, -1, -1, -1, -1, 29, 26, 21}, + {25, 21, 24, 29, 26, 17, 20, -1, 28, -1, 30, 27, 22}, + {26, 22, 25, 30, 27, 18, 21, 24, 29, -1, 31, -1, 23}, + {27, 23, 26, 31, -1, 19, 22, 25, 30, -1, -1, -1, -1}, + {28, 24, -1, -1, 29, 20, -1, -1, -1, -1, -1, 30, 25}, + {29, 25, 28, -1, 30, 21, 24, -1, -1, -1, -1, 31, 26}, + {30, 26, 29, -1, 31, 22, 25, 28, -1, -1, -1, -1, 27}, + {31, 27, 30, -1, -1, 23, 26, 29, -1, -1, -1, -1, -1} +}; +#elif defined GC_36 +int core2test[36][NUM_CORES2TEST] = { + { 0, -1, -1, 6, 1, -1, -1, -1, -1, 12, 7, 2, -1}, + { 1, -1, 0, 7, 2, -1, -1, -1, 6, 13, 8, 3, -1}, + { 2, -1, 1, 8, 3, -1, -1, 0, 7, 14, 9, 4, -1}, + { 3, -1, 2, 9, 4, -1, -1, 1, 8, 15, 10, 5, -1}, + { 4, -1, 3, 10, 5, -1, -1, 2, 9, 16, 11, -1, -1}, + { 5, -1, 4, 11, -1, -1, -1, 3, 10, 17, -1, -1, -1}, + { 6, 0, -1, 12, 7, -1, -1, -1, -1, 18, 13, 8, 1}, + { 7, 1, 6, 13, 8, -1, 0, -1, 12, 19, 14, 9, 2}, + { 8, 2, 7, 14, 9, -1, 1, 6, 13, 20, 15, 10, 3}, + { 9, 3, 8, 15, 10, -1, 2, 7, 14, 21, 16, 11, 4}, + {10, 4, 9, 16, 11, -1, 3, 8, 15, 22, 17, -1, 5}, + {11, 5, 10, 17, -1, -1, 4, 9, 16, 23, -1, -1, -1}, + {12, 6, -1, 18, 13, 0, -1, -1, -1, 24, 19, 14, 7}, + {13, 7, 12, 19, 14, 1, 6, -1, 18, 25, 20, 15, 8}, + {14, 8, 13, 20, 15, 2, 7, 12, 19, 26, 21, 16, 9}, + {15, 9, 14, 21, 16, 3, 8, 13, 20, 27, 22, 17, 10}, + {16, 10, 15, 22, 17, 4, 9, 14, 21, 28, 23, -1, 11}, + {17, 11, 16, 23, -1, 5, 10, 15, 22, 29, -1, -1, -1}, + {18, 12, -1, 24, 19, 6, -1, -1, -1, 30, 25, 20, 13}, + {19, 13, 18, 25, 20, 7, 12, -1, 24, 31, 26, 21, 14}, + {20, 14, 19, 26, 21, 8, 13, 18, 25, 32, 27, 22, 15}, + {21, 15, 20, 27, 22, 9, 14, 19, 26, 33, 28, 23, 16}, + {22, 16, 21, 28, 23, 10, 15, 20, 27, 34, 29, -1, 17}, + {23, 17, 22, 29, -1, 11, 16, 21, 28, 35, -1, -1, -1}, + {24, 18, -1, 30, 25, 12, -1, -1, -1, -1, 31, 26, 19}, + {25, 19, 24, 31, 26, 13, 18, -1, 30, -1, 32, 27, 20}, + {26, 20, 25, 32, 27, 14, 19, 24, 31, -1, 33, 28, 21}, + {27, 21, 26, 33, 28, 15, 20, 25, 32, -1, 34, 29, 22}, + {28, 22, 27, 34, 29, 16, 21, 26, 33, -1, 35, -1, 23}, + {29, 23, 28, 35, -1, 17, 22, 27, 34, -1, -1, -1, -1}, + {30, 24, -1, -1, 31, 18, -1, -1, -1, -1, -1, 32, 25}, + {31, 25, 30, -1, 32, 19, 24, -1, -1, -1, -1, 33, 26}, + {32, 26, 31, -1, 33, 20, 25, 30, -1, -1, -1, 34, 27}, + {33, 27, 32, -1, 34, 21, 26, 31, -1, -1, -1, 35, 28}, + {34, 28, 33, -1, 35, 22, 27, 32, -1, -1, -1, -1, 29}, + {35, 29, 34, -1, -1, 23, 28, 33, -1, -1, -1, -1, -1} +}; +#elif defined GC_48 +int core2test[48][NUM_CORES2TEST] = { + { 0, -1, -1, 6, 1, -1, -1, -1, -1, 12, 7, 2, -1}, + { 1, -1, 0, 7, 2, -1, -1, -1, 6, 13, 8, 3, -1}, + { 2, -1, 1, 8, 3, -1, -1, 0, 7, 14, 9, 4, -1}, + { 3, -1, 2, 9, 4, -1, -1, 1, 8, 15, 10, 5, -1}, + { 4, -1, 3, 10, 5, -1, -1, 2, 9, 16, 11, -1, -1}, + { 5, -1, 4, 11, -1, -1, -1, 3, 10, 17, -1, -1, -1}, + { 6, 0, -1, 12, 7, -1, -1, -1, -1, 18, 13, 8, 1}, + { 7, 1, 6, 13, 8, -1, 0, -1, 12, 19, 14, 9, 2}, + { 8, 2, 7, 14, 9, -1, 1, 6, 13, 20, 15, 10, 3}, + { 9, 3, 8, 15, 10, -1, 2, 7, 14, 21, 16, 11, 4}, + {10, 4, 9, 16, 11, -1, 3, 8, 15, 22, 17, -1, 5}, + {11, 5, 10, 17, -1, -1, 4, 9, 16, 23, -1, -1, -1}, + {12, 6, -1, 18, 13, 0, -1, -1, -1, 24, 19, 14, 7}, + {13, 7, 12, 29, 14, 1, 6, -1, 18, 25, 20, 15, 8}, + {14, 8, 13, 20, 15, 2, 7, 12, 19, 26, 21, 16, 9}, + {15, 9, 14, 21, 16, 3, 8, 13, 20, 27, 22, 17, 10}, + {16, 10, 15, 22, 17, 4, 9, 14, 21, 28, 23, -1, 11}, + {17, 11, 16, 23, -1, 5, 10, 15, 22, 29, -1, -1, -1}, + {18, 12, -1, 24, 19, 6, -1, -1, -1, 30, 25, 20, 13}, + {19, 13, 18, 25, 20, 7, 12, -1, 24, 31, 26, 21, 14}, + {20, 14, 19, 26, 21, 8, 13, 18, 25, 32, 27, 22, 15}, + {21, 15, 20, 27, 22, 9, 14, 19, 26, 33, 28, 23, 16}, + {22, 16, 21, 28, 23, 10, 15, 20, 27, 34, 29, -1, 17}, + {23, 17, 22, 29, -1, 11, 16, 21, 28, 35, -1, -1, -1}, + {24, 18, -1, 30, 25, 12, -1, -1, -1, 36, 31, 26, 19}, + {25, 19, 24, 31, 26, 13, 18, -1, 30, 37, 32, 27, 20}, + {26, 20, 25, 32, 27, 14, 19, 24, 31, 38, 33, 28, 21}, + {27, 21, 26, 33, 28, 15, 20, 25, 32, 39, 34, 29, 22}, + {28, 22, 27, 34, 29, 16, 21, 26, 33, 40, 35, -1, 23}, + {29, 23, 28, 35, -1, 17, 22, 27, 34, 41, -1, -1, -1}, + {30, 24, -1, 36, 31, 18, -1, -1, -1, 42, 37, 32, 25}, + {31, 25, 30, 37, 32, 19, 24, -1, 36, 43, 38, 33, 26}, + {32, 26, 31, 38, 33, 20, 25, 30, 37, 44, 39, 34, 27}, + {33, 27, 32, 39, 34, 21, 26, 31, 38, 45, 40, 35, 28}, + {34, 28, 33, 40, 35, 22, 27, 32, 39, 46, 41, -1, 29}, + {35, 29, 34, 41, -1, 23, 28, 33, 40, 47, -1, -1, -1}, + {36, 30, -1, 42, 37, 24, -1, -1, -1, -1, 43, 38, 31}, + {37, 31, 36, 43, 38, 25, 30, -1, 42, -1, 44, 39, 32}, + {38, 32, 37, 44, 39, 26, 31, 36, 43, -1, 45, 40, 33}, + {39, 33, 38, 45, 40, 27, 32, 37, 44, -1, 46, 41, 34}, + {40, 34, 39, 46, 41, 28, 33, 38, 45, -1, 47, -1, 35}, + {41, 35, 40, 47, -1, 29, 34, 39, 46, -1, -1, -1, -1}, + {42, 36, -1, -1, 43, 30, -1, -1, -1, -1, -1, 44, 37}, + {43, 37, 42, -1, 44, 31, 36, -1, -1, -1, -1, 45, 38}, + {44, 38, 43, -1, 45, 32, 37, 42, -1, -1, -1, 46, 39}, + {45, 39, 44, -1, 46, 33, 38, 43, -1, -1, -1, 47, 40}, + {46, 40, 45, -1, 47, 34, 39, 44, -1, -1, -1, -1, 41}, + {47, 41, 46, -1, -1, 35, 40, 45, -1, -1, -1, -1, -1}, +}; +#elif defined GC_50 +int core2test[50][NUM_CORES2TEST] = { + { 0, -1, -1, 6, 1, -1, -1, -1, -1, 12, 7, 2, -1}, + { 1, -1, 0, 7, 2, -1, -1, -1, 6, 13, 8, 3, -1}, + { 2, -1, 1, 8, 3, -1, -1, 0, 7, 14, 9, 4, -1}, + { 3, -1, 2, 9, 4, -1, -1, 1, 8, 15, 10, 5, -1}, + { 4, -1, 3, 10, 5, -1, -1, 2, 9, 16, 11, -1, -1}, + { 5, -1, 4, 11, -1, -1, -1, 3, 10, 17, -1, -1, -1}, + { 6, 0, -1, 12, 7, -1, -1, -1, -1, 18, 13, 8, 1}, + { 7, 1, 6, 13, 8, -1, 0, -1, 12, 19, 14, 9, 2}, + { 8, 2, 7, 14, 9, -1, 1, 6, 13, 20, 15, 10, 3}, + { 9, 3, 8, 15, 10, -1, 2, 7, 14, 21, 16, 11, 4}, + {10, 4, 9, 16, 11, -1, 3, 8, 15, 22, 17, -1, 5}, + {11, 5, 10, 17, -1, -1, 4, 9, 16, 23, -1, -1, -1}, + {12, 6, -1, 18, 13, 0, -1, -1, -1, 24, 19, 14, 7}, + {13, 7, 12, 29, 14, 1, 6, -1, 18, 25, 20, 15, 8}, + {14, 8, 13, 20, 15, 2, 7, 12, 19, 26, 21, 16, 9}, + {15, 9, 14, 21, 16, 3, 8, 13, 20, 27, 22, 17, 10}, + {16, 10, 15, 22, 17, 4, 9, 14, 21, 28, 23, -1, 11}, + {17, 11, 16, 23, -1, 5, 10, 15, 22, 29, -1, -1, -1}, + {18, 12, -1, 24, 19, 6, -1, -1, -1, 30, 25, 20, 13}, + {19, 13, 18, 25, 20, 7, 12, -1, 24, 31, 26, 21, 14}, + {20, 14, 19, 26, 21, 8, 13, 18, 25, 32, 27, 22, 15}, + {21, 15, 20, 27, 22, 9, 14, 19, 26, 33, 28, 23, 16}, + {22, 16, 21, 28, 23, 10, 15, 20, 27, 34, 29, -1, 17}, + {23, 17, 22, 29, -1, 11, 16, 21, 28, 35, -1, -1, -1}, + {24, 18, -1, 30, 25, 12, -1, -1, -1, 36, 31, 26, 19}, + {25, 19, 24, 31, 26, 13, 18, -1, 30, 37, 32, 27, 20}, + {26, 20, 25, 32, 27, 14, 19, 24, 31, 38, 33, 28, 21}, + {27, 21, 26, 33, 28, 15, 20, 25, 32, 39, 34, 29, 22}, + {28, 22, 27, 34, 29, 16, 21, 26, 33, 40, 35, -1, 23}, + {29, 23, 28, 35, -1, 17, 22, 27, 34, 41, -1, -1, -1}, + {30, 24, -1, 36, 31, 18, -1, -1, -1, 43, 37, 32, 25}, + {31, 25, 30, 37, 32, 19, 24, -1, 36, 44, 38, 33, 26}, + {32, 26, 31, 38, 33, 20, 25, 30, 37, 45, 39, 34, 27}, + {33, 27, 32, 39, 34, 21, 26, 31, 38, 46, 40, 35, 28}, + {34, 28, 33, 40, 35, 22, 27, 32, 39, 47, 41, -1, 29}, + {35, 29, 34, 41, -1, 23, 28, 33, 40, 48, 42, -1, -1}, + {36, 30, -1, 43, 37, 24, -1, -1, -1, -1, 44, 38, 31}, + {37, 31, 36, 44, 38, 25, 30, -1, 43, -1, 45, 39, 32}, + {38, 32, 37, 45, 39, 26, 31, 36, 44, -1, 46, 40, 33}, + {39, 33, 38, 46, 40, 27, 32, 37, 45, -1, 47, 41, 34}, + {40, 34, 39, 47, 41, 28, 33, 38, 46, -1, 48, 42, 35}, + {41, 35, 40, 48, 42, 29, 34, 39, 47, -1, 49, -1, -1}, + {42, -1, 41, 49, -1, -1, 35, 40, 48, -1, -1, -1, -1}, + {43, 36, -1, -1, 44, 30, -1, -1, -1, -1, -1, 45, 37}, + {44, 37, 43, -1, 45, 31, 36, -1, -1, -1, -1, 46, 38}, + {45, 38, 44, -1, 46, 32, 37, 43, -1, -1, -1, 47, 39}, + {46, 39, 45, -1, 47, 33, 38, 44, -1, -1, -1, 48, 40}, + {47, 40, 46, -1, 48, 34, 39, 45, -1, -1, -1, 49, 41}, + {48, 41, 47, -1, 49, 35, 40, 46, -1, -1, -1, -1, 42}, + {49, 42, 48, -1, -1, -1, 41, 47, -1, -1, -1, -1, -1} +}; #elif defined GC_56 int core2test[56][NUM_CORES2TEST] = { { 0, -1, -1, 7, 1, -1, -1, -1, -1, 14, 8, 2, -1}, diff --git a/Robust/src/Runtime/bamboo/multicoremem.h b/Robust/src/Runtime/bamboo/multicoremem.h index aad87def..1c2ac1cb 100644 --- a/Robust/src/Runtime/bamboo/multicoremem.h +++ b/Robust/src/Runtime/bamboo/multicoremem.h @@ -11,17 +11,39 @@ // data structures for shared memory allocation #ifdef TILERA_BME -#define BAMBOO_BASE_VA 0x600000 //0xd000000 +#ifdef MGC +#define BAMBOO_BASE_VA 0x600000 +#else +#define BAMBOO_BASE_VA 0xd000000 +#endif #elif defined TILERA_ZLINUX #ifdef MULTICORE_GC -#define BAMBOO_BASE_VA 0x600000 //0xd000000 +#ifdef MGC +#define BAMBOO_BASE_VA 0x600000 +#else +#define BAMBOO_BASE_VA 0xd000000 +#endif #endif // MULTICORE_GC #endif // TILERA_BME #ifdef BAMBOO_MEMPROF #define GC_BAMBOO_NUMCORES 56 #else -#define GC_BAMBOO_NUMCORES 62 +#define GC_BAMBOO_NUMCORES (NUMCORES) +/*#elif defined GC_2 +#define GC_BAMBOO_NUMCORES 3 +#elif defined GC_4 +#define GC_BAMBOO_NUMCORES 4 +#elif defined GC_8 +#define GC_BAMBOO_NUMCORES 8 +#elif defined GC_16 +#define GC_BAMBOO_NUMCORES 16 +#elif defined GC_32 +#define GC_BAMBOO_NUMCORES 32 +#elif defined GC_50 +#define GC_BAMBOO_NUMCORES 50 +#elif defined GC_62 +#define GC_BAMBOO_NUMCORES 62*/ #endif #ifdef GC_DEBUG @@ -34,6 +56,8 @@ #elif defined GC_CACHE_ADAPT #ifdef GC_LARGESHAREDHEAP #define BAMBOO_NUM_BLOCKS ((unsigned int)((GC_BAMBOO_NUMCORES)*(2+24))) +#elif defined MGC +#define BAMBOO_NUM_BLOCKS ((unsigned int)((GC_BAMBOO_NUMCORES)*(62*4))) // 62M per core #else #define BAMBOO_NUM_BLOCKS ((unsigned int)((GC_BAMBOO_NUMCORES)*(2+14))) #endif @@ -59,8 +83,10 @@ #define BAMBOO_NUM_BLOCKS ((unsigned int)((GC_BAMBOO_NUMCORES)*(2+2))) #elif defined GC_LARGESHAREDHEAP2 #define BAMBOO_NUM_BLOCKS ((unsigned int)((GC_BAMBOO_NUMCORES)*(2+2))) +#elif defined MGC +#define BAMBOO_NUM_BLOCKS ((unsigned int)((GC_BAMBOO_NUMCORES)*72)) // 62M per core #else -#define BAMBOO_NUM_BLOCKS ((unsigned int)((GC_BAMBOO_NUMCORES)*(2+52/*3*/))) //(15 * 1024) //(64 * 4 * 0.75) //(1024 * 1024 * 3.5) 3G +#define BAMBOO_NUM_BLOCKS ((unsigned int)((GC_BAMBOO_NUMCORES)*(2+3))) //(15 * 1024) //(64 * 4 * 0.75) //(1024 * 1024 * 3.5) 3G #endif #ifdef GC_LARGEPAGESIZE #define BAMBOO_PAGE_SIZE ((unsigned int)(4 * 1024 * 1024)) // (4096) @@ -79,6 +105,7 @@ #endif // GC_DEBUG #ifdef MULTICORE_GC +volatile bool gc_localheap_s; #include "multicoregarbage.h" typedef enum { diff --git a/Robust/src/Runtime/bamboo/multicoreruntime.c b/Robust/src/Runtime/bamboo/multicoreruntime.c index a8c1224d..3e5e60f2 100644 --- a/Robust/src/Runtime/bamboo/multicoreruntime.c +++ b/Robust/src/Runtime/bamboo/multicoreruntime.c @@ -263,6 +263,19 @@ void CALL35(___System______arraycopy____L___Object____I_L___Object____I_I, int _ #endif void CALL11(___System______exit____I,int ___status___, int ___status___) { +// gc_profile mode, output gc prfiling data +#ifdef MULTICORE_GC + if(STARTUPCORE == BAMBOO_NUM_OF_CORE) { + BAMBOO_PRINT(BAMBOO_GET_EXE_TIME()); + BAMBOO_PRINT(0xbbbbbbbb); +#ifdef GC_CACHE_ADAPT + bamboo_mask_timer_intr(); // disable the TILE_TIMER interrupt +#endif // GC_CACHE_ADAPT +#ifdef GC_PROFILE + gc_outputProfileData(); +#endif // #ifdef GC_PROFILE + } +#endif // #ifdef MULTICORE_GC BAMBOO_EXIT(___status___); } @@ -283,6 +296,24 @@ long long CALL00(___System______currentTimeMillis____) { return ((unsigned long long)BAMBOO_GET_EXE_TIME())/700000; } +void CALL00(___System______setgcprofileflag____) { +#ifdef GC_PROFILE +#ifdef MGC_SPEC + extern volatile bool gc_profile_flag; + gc_profile_flag = true; +#endif +#endif +} + +void CALL00(___System______resetgcprofileflag____) { +#ifdef GC_PROFILE +#ifdef MGC_SPEC + extern volatile bool gc_profile_flag; + gc_profile_flag = false; +#endif +#endif +} + void CALL01(___System______printString____L___String___,struct ___String___ * ___s___) { #ifdef MGC #ifdef TILERA_BME @@ -575,14 +606,7 @@ INLINE void initruntimedata() { gcself_numsendobjs = 0; gcself_numreceiveobjs = 0; gcmarkedptrbound = 0; -/*#ifdef LOCALHASHTBL_TEST - gcpointertbl = allocateRuntimeHash_I(20); -#else - gcpointertbl = mgchashCreate_I(2000, 0.75); -#endif*/ gcforwardobjtbl = allocateMGCHash_I(20, 3); - /*gcobj2map = 0; - gcmappedobj = 0;*/ gcnumlobjs = 0; gcheaptop = 0; gctopcore = 0; @@ -602,10 +626,13 @@ INLINE void initruntimedata() { gc_num_forwardobj = 0; gc_num_profiles = NUMCORESACTIVE - 1; #endif +#ifdef MGC_SPEC + gc_profile_flag = false; +#endif #ifdef GC_FLUSH_DTLB gc_num_flush_dtlb = 0; #endif - //gc_localheap_s = false; + gc_localheap_s = false; #ifdef GC_CACHE_ADAPT gccachestage = false; #endif // GC_CACHE_ADAPT @@ -1534,9 +1561,15 @@ INLINE void processmsg_gcprofiles_I() { MSG_INDEXINC_I(); int data3 = msgdata[msgdataindex]; MSG_INDEXINC_I(); +#ifdef MGC_SPEC + if(gc_profile_flag) { +#endif gc_num_obj += data1; gc_num_liveobj += data2; gc_num_forwardobj += data3; +#ifdef MGC_SPEC + } +#endif gc_num_profiles--; } #endif // GC_PROFILE diff --git a/Robust/src/Runtime/mem.c b/Robust/src/Runtime/mem.c index ce47feb4..ef28022c 100644 --- a/Robust/src/Runtime/mem.c +++ b/Robust/src/Runtime/mem.c @@ -57,13 +57,29 @@ void * mycalloc_share(int m, #endif void * mycalloc(int m, - int size) { + int size, + char * file, + int line) { void * p = NULL; int isize = size; BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); +#ifdef MULTICORE_GC + extern bool gc_localheap_s; +inermycalloc_i: + p = gc_localheap_s ? BAMBOO_LOCAL_MEM_CALLOC_S(m, isize) : + BAMBOO_LOCAL_MEM_CALLOC(m, isize); +#else p = BAMBOO_LOCAL_MEM_CALLOC(m, isize); // calloc(m, isize); +#endif if(p == NULL) { - BAMBOO_EXIT(0xc003); +#ifdef MULTICORE_GC + if(!gc_localheap_s) { + gc_localheap_s = true; + goto inermycalloc_i; + } +#endif + printf("mycalloc %s %d \n", file, line); + BAMBOO_EXIT(0xc003); } BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); return p; @@ -71,18 +87,42 @@ void * mycalloc(int m, void * mycalloc_i(int m, - int size) { + int size, + char * file, + int line) { void * p = NULL; int isize = size; +#ifdef MULTICORE_GC + extern bool gc_localheap_s; +inermycalloc_i: + p = gc_localheap_s ? BAMBOO_LOCAL_MEM_CALLOC_S(m, isize) : + BAMBOO_LOCAL_MEM_CALLOC(m, isize); +#else p = BAMBOO_LOCAL_MEM_CALLOC(m, isize); // calloc(m, isize); +#endif if(p == NULL) { +#ifdef MULTICORE_GC + if(!gc_localheap_s) { + gc_localheap_s = true; + goto inermycalloc_i; + } +#endif + tprintf("macalloc_i %s %d \n", file, line); BAMBOO_EXIT(0xc004); } return p; } void myfree(void * ptr) { - BAMBOO_LOCAL_MEM_FREE(ptr); +#ifdef MULTICORE_GC + if(ptr >= BAMBOO_LOCAL_HEAP_START_VA ) { +#endif + BAMBOO_LOCAL_MEM_FREE(ptr); +#ifdef MULTICORE_GC + } else if(ptr >= BAMBOO_LOCAL_HEAP_START_VA_S) { + BAMBOO_LOCAL_MEM_FREE_S(ptr); + } +#endif return; } diff --git a/Robust/src/Runtime/mem.h b/Robust/src/Runtime/mem.h index 6f8bee97..9a9d55c1 100644 --- a/Robust/src/Runtime/mem.h +++ b/Robust/src/Runtime/mem.h @@ -23,11 +23,11 @@ #endif #else #ifdef MULTICORE -void * mycalloc(int m, int size); -void * mycalloc_i(int m, int size); +void * mycalloc(int m, int size, char * file, int line); +void * mycalloc_i(int m, int size, char * file, int line); void myfree(void * ptr); -#define RUNMALLOC(x) mycalloc(1,x) // handle interruption inside -#define RUNMALLOC_I(x) mycalloc_i(1,x) //with interruption blocked beforehand +#define RUNMALLOC(x) mycalloc(1,x,__FILE__,__LINE__) // handle interruption inside +#define RUNMALLOC_I(x) mycalloc_i(1,x,__FILE__,__LINE__) //with interruption blocked beforehand #define RUNFREE(x) myfree(x) #ifdef MULTICORE_GC #include "multicoregc.h" diff --git a/Robust/src/buildscript b/Robust/src/buildscript index fe0a4e40..6298e638 100755 --- a/Robust/src/buildscript +++ b/Robust/src/buildscript @@ -188,6 +188,7 @@ TILERABMEFLAG=false TILERAZLINUXFLAG=false TILERAMEMPROFFLAG=false TILERACONFIG='' +TILERACORES='' CACHEFLUSHFLAG=false RAWCONFIG='' DEBUGFLAG=false @@ -424,6 +425,7 @@ JAVAOPTS="$JAVAOPTS -multicore" elif [[ $1 = '-numcore' ]] then JAVAOPTS="$JAVAOPTS -numcore $2" +TILERACORES="$2" if [[ "$2" -gt "1" ]] then TILERAN1COREFLAG=true @@ -930,9 +932,9 @@ cp ../Runtime/*.c ./ cp ../Runtime/*.h ./ cp ../Runtime/*.S ./ cp ../Runtime/*.s ./ -mkdir ./coreprof -cp ../Runtime/coreprof/*.c ./coreprof/ -cp ../Runtime/coreprof/*.h ./coreprof/ +#mkdir ./coreprof +#cp ../Runtime/coreprof/*.c ./coreprof/ +#cp ../Runtime/coreprof/*.h ./coreprof/ cp $BAMBOORUNTIME/*.c ./ cp $BAMBOORUNTIME/*.h ./ cp $BAMBOORUNTIME/RAW/*.c ./ @@ -950,9 +952,9 @@ TILERADIR="$CURDIR/tilera" if $TILERABMEFLAG then # TILERABMEFLAG TILERA_INDIR="BME" -MAKEFILE="Makefile.tilera.$TILERACONFIG" -SIMHVC="sim.hvc.$TILERACONFIG" -PCIHVC="pci.hvc.$TILERACONFIG" +MAKEFILE="Makefile.tilera.$TILERACORES" +#SIMHVC="sim.hvc.$TILERACONFIG" +PCIHVC="pci.hvc.$TILERACORES" if $TILERA56COREFLAG then PCIHVC="$PCIHVC.56" @@ -1041,7 +1043,7 @@ fi #INTERRUPT version if $MGCFLAG then #MGCFLAG -TILERACFLAGS="${TILERACFLAGS} -DMGC" +TILERACFLAGS="${TILERACFLAGS} -DMGC -DMGC_SPEC" fi if $MULTICOREGCFLAG @@ -1152,7 +1154,7 @@ cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$MAKEFILE ./Makefile fi if $TILERABMEFLAG then # TILERABMEFLAG -cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$SIMHVC ./sim.hvc +#cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$SIMHVC ./sim.hvc cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$PCIHVC ./pci.hvc if $TILERA56COREFLAG then