From: bdemsky Date: Sun, 19 Jun 2011 01:34:26 +0000 (+0000) Subject: clean up stuff...will add back later... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=721471aaa0ba4466d334d1a9d3046b1e2fa4cba4;p=IRC.git clean up stuff...will add back later... --- diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.c b/Robust/src/Runtime/bamboo/multicoregarbage.c index 40b3d83f..0e131bbd 100644 --- a/Robust/src/Runtime/bamboo/multicoregarbage.c +++ b/Robust/src/Runtime/bamboo/multicoregarbage.c @@ -10,11 +10,6 @@ #include "multicoregcprofile.h" #include "gcqueue.h" -#ifdef SMEMM -extern unsigned int gcmem_mixed_threshold; -extern unsigned int gcmem_mixed_usedmem; -#endif // SMEMM - volatile bool gcflag; gc_status_t gc_status_info; @@ -93,41 +88,14 @@ void dumpSMem() { #endif void initmulticoregcdata() { - if(STARTUPCORE == BAMBOO_NUM_OF_CORE) { - // startup core to initialize corestatus[] - for(int i = 0; i < NUMCORESACTIVE; i++) { - gccorestatus[i] = 1; - gcnumsendobjs[0][i] = gcnumsendobjs[1][i] = 0; - gcnumreceiveobjs[0][i] = gcnumreceiveobjs[1][i] = 0; - } - for(int i = 0; i < NUMCORES4GC; i++) { - gcloads[i] = 0; - gcrequiredmems[i] = 0; - gcstopblock[i] = 0; - gcfilledblocks[i] = 0; - } - } - bamboo_smem_zero_top = NULL; gcflag = false; gc_status_info.gcprocessing = false; gc_status_info.gcphase = FINISHPHASE; gcprecheck = true; - gccurr_heaptop = 0; - gcself_numsendobjs = 0; - gcself_numreceiveobjs = 0; - gcmarkedptrbound = 0; gcforwardobjtbl = allocateMGCHash_I(128); gcheaptop = 0; - gcmovestartaddr = 0; - gctomove = false; - gcmovepending = 0; - gcblock2fill = 0; -#ifdef SMEMM - gcmem_mixed_threshold=(unsigned int)((BAMBOO_SHARED_MEM_SIZE-bamboo_reserved_smem*BAMBOO_SMEM_SIZE)*0.8); - gcmem_mixed_usedmem = 0; -#endif #ifdef MGC_SPEC gc_profile_flag = false; #endif @@ -298,38 +266,6 @@ int loadbalance(void ** heaptop) { return numbpc; } - -// update the bmmboo_smemtbl to record current shared mem usage -void updateSmemTbl(unsigned int coren, void * localtop) { - unsigned int ltopcore = 0; - unsigned int bound = BAMBOO_SMEM_SIZE_L; - BLOCKINDEX(ltopcore, localtop); - if((unsigned int)localtop>=(unsigned int)(gcbaseva+BAMBOO_LARGE_SMEM_BOUND)){ - bound = BAMBOO_SMEM_SIZE; - } - unsigned int load = (unsigned INTPTR)(localtop-gcbaseva)%(unsigned int)bound; - unsigned int toset = 0; - for(int j=0; 1; j++) { - for(int i=0; i<2; i++) { - toset = gc_core2block[2*coren+i]+(unsigned int)(NUMCORES4GC*2)*j; - if(toset < ltopcore) { - bamboo_smemtbl[toset]=BLOCKSIZE(toset=gcbaseva)&&(((unsigned int)p)<(gcbaseva+(BAMBOO_SHARED_MEM_SIZE)))) - #define MAXBLOCK 0x4fffffff //local block number that can never be reached... diff --git a/Robust/src/Runtime/bamboo/multicoregc.h b/Robust/src/Runtime/bamboo/multicoregc.h index 929fa0e9..f0f2c02e 100644 --- a/Robust/src/Runtime/bamboo/multicoregc.h +++ b/Robust/src/Runtime/bamboo/multicoregc.h @@ -7,10 +7,4 @@ struct garbagelist { void * array[]; }; -struct listitem { - struct listitem * prev; - struct listitem * next; - struct garbagelist * stackptr; -}; - #endif // BAMBOO_MULTICORE_GC_H diff --git a/Robust/src/Runtime/bamboo/multicoregcmark.c b/Robust/src/Runtime/bamboo/multicoregcmark.c index 0ccb476f..df1a692a 100644 --- a/Robust/src/Runtime/bamboo/multicoregcmark.c +++ b/Robust/src/Runtime/bamboo/multicoregcmark.c @@ -18,11 +18,6 @@ extern int runtime_locklen; extern struct global_defs_t * global_defs_p; -#ifdef SMEMM -extern unsigned int gcmem_mixed_threshold; -extern unsigned int gcmem_mixed_usedmem; -#endif - #ifdef MGC extern struct lockvector bamboo_threadlocks; #endif diff --git a/Robust/src/Runtime/bamboo/multicoremem.c b/Robust/src/Runtime/bamboo/multicoremem.c index a4484501..86590cba 100644 --- a/Robust/src/Runtime/bamboo/multicoremem.c +++ b/Robust/src/Runtime/bamboo/multicoremem.c @@ -13,15 +13,6 @@ INLINE void * mallocmem(int tofindb, int * allocsize) { void * mem = NULL; // find suitable block - mem=gcbaseva+bamboo_smemtbl[tofindb]+OFFSET2BASEVA(tofindb); - *allocsize = size; - // set bamboo_smemtbl - for(int i = tofindb; i <= totest; i++) { - bamboo_smemtbl[i]=BLOCKSIZE(iminremain)) { - bound = BLOCKSIZE(*totest= isize) { - // have enough space in the block, malloc - return mallocmem(*tofindb, *totest, size, allocsize); - } else { - // no enough space yet, try to append next continuous block - *totest = *totest + 1; - } - } - } return NULL; } @@ -75,35 +32,7 @@ INLINE void * searchBlock4Mem_global(int* tofindb, int* totest, int isize, int * allocsize) { - int size = 0; - int bound = BAMBOO_SMEM_SIZE_L; - while(*totest<(gcnumblock-bamboo_reserved_smem)) { - bound = BLOCKSIZE(*totest= isize) { - // have enough space in the block, malloc - return mallocmem(*tofindb, *totest, size, allocsize); - } else { - // no enough space yet, try to append next continuous block - *totest = *totest + 1; - } - } - } + return NULL; } @@ -180,22 +109,13 @@ void * mixedmalloc_I(int coren, tofindb=totest=gc_core2block[2*core2test[gccorenum][k]]; mem=searchBlock4Mem(&tofindb,&totest,core2test[gccorenum][k],isize,allocsize,(k==0)?0:((gcnumblock/NUMCORES4GC)>>LOCALMEMRESERVATION)); if(mem!=NULL) { - gcmem_mixed_usedmem+=size; return mem; } } - if(gcmem_mixed_usedmem>=gcmem_mixed_threshold) { - // no more memory available on either coren or its neighbour cores - *allocsize = 0; - return NULL; - } else { - // try allocate globally - mem=globalmalloc_I(coren,isize,allocsize); - if(mem!=NULL) { - gcmem_mixed_usedmem+=size; - } - return mem; - } + + // try allocate globally + mem=globalmalloc_I(coren,isize,allocsize); + return mem; } #endif @@ -204,19 +124,7 @@ void * mixedmalloc_I(int coren, void * globalmalloc_I(int coren, int isize, int * allocsize) { - void * mem = NULL; - int tofindb = bamboo_free_block; - int totest = tofindb; - if(tofindb > gcnumblock-1-bamboo_reserved_smem) { - // Out of shared memory - *allocsize = 0; - return NULL; - } - mem=searchBlock4Mem_global(&tofindb, &totest, isize, allocsize); - if(mem == NULL) { - *allocsize = 0; - } - return mem; + return NULL; } void * smemalloc(int coren, int isize, int * allocsize) { diff --git a/Robust/src/Runtime/bamboo/multicoremem.h b/Robust/src/Runtime/bamboo/multicoremem.h index 86e6f289..2680fb4e 100644 --- a/Robust/src/Runtime/bamboo/multicoremem.h +++ b/Robust/src/Runtime/bamboo/multicoremem.h @@ -104,45 +104,22 @@ #define BAMBOO_THREAD_QUEUE_SIZE (BAMBOO_SMEM_SIZE) // (45 * 16 * 1024) #endif // GC_SMALLPAGESIZE -volatile bool gc_localheap_s; - -struct freeMemItem { - unsigned int ptr; - int size; - int startblock; - int endblock; - struct freeMemItem * next; -}; - -struct freeMemList { - struct freeMemItem * head; - struct freeMemItem * backuplist; // hold removed freeMemItem for reuse; - // only maintain 1 freemMemItem -}; - -// table recording the number of allocated bytes on each block -// Note: this table resides on the bottom of the shared heap for all cores -// to access -volatile unsigned int * bamboo_smemtbl; -#ifdef GC_TBL_DEBUG -// the length of the bamboo_smemtbl is gcnumblock -#endif -volatile unsigned int bamboo_free_block; -unsigned 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 +//keeps track of the top address that has been zero'd by the allocator volatile unsigned int bamboo_smem_zero_top; //BAMBOO_SMEM_ZERO_UNIT_SIZE must evenly divide the page size and be a //power of two(we rely on both in the allocation function) #define BAMBOO_SMEM_ZERO_UNIT_SIZE 4096 #else -//volatile mspace bamboo_free_msp; +//This is for memory allocation with no garbage collection unsigned int bamboo_free_smemp; int bamboo_free_smem_size; #endif // MULTICORE_GC +//This flag indicates that a memory request was services volatile bool smemflag; +//Pointer to new block of memory after request volatile unsigned int * bamboo_cur_msp; +//Number of bytes in new block of memory volatile int bamboo_smem_size; #endif // BAMBOO_MULTICORE_MEM_H diff --git a/Robust/src/Runtime/bamboo/multicoremem_helper.h b/Robust/src/Runtime/bamboo/multicoremem_helper.h index ca8fdd84..2bd6a57c 100644 --- a/Robust/src/Runtime/bamboo/multicoremem_helper.h +++ b/Robust/src/Runtime/bamboo/multicoremem_helper.h @@ -57,8 +57,6 @@ int core2test[62][NUM_CORES2TEST] = { }; #endif // GC_1 #elif defined SMEMM -unsigned int gcmem_mixed_threshold = 0; -unsigned int gcmem_mixed_usedmem = 0; #define NUM_CORES2TEST 13 #ifdef GC_1 int core2test[1][NUM_CORES2TEST] = { diff --git a/Robust/src/Runtime/mem.c b/Robust/src/Runtime/mem.c index 9cc5884c..0ab608f1 100644 --- a/Robust/src/Runtime/mem.c +++ b/Robust/src/Runtime/mem.c @@ -56,21 +56,9 @@ void * mycalloc(int size, 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(isize) : - BAMBOO_LOCAL_MEM_CALLOC(isize); -#else - p = BAMBOO_LOCAL_MEM_CALLOC(isize); // calloc(m, isize); -#endif + p = BAMBOO_LOCAL_MEM_CALLOC(isize); + if(p == NULL) { -#ifdef MULTICORE_GC - if(!gc_localheap_s) { - gc_localheap_s = true; - goto inermycalloc_i; - } -#endif printf("mycalloc %s %d \n", file, line); BAMBOO_EXIT(); } @@ -84,21 +72,8 @@ void * mycalloc_i(int size, 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(isize) : - BAMBOO_LOCAL_MEM_CALLOC(isize); -#else - p = BAMBOO_LOCAL_MEM_CALLOC(isize); // calloc(m, isize); -#endif + p = BAMBOO_LOCAL_MEM_CALLOC(isize); if(p == NULL) { -#ifdef MULTICORE_GC - if(!gc_localheap_s) { - gc_localheap_s = true; - goto inermycalloc_i; - } -#endif tprintf("mycalloc_i %s %d \n", file, line); BAMBOO_EXIT(); } @@ -107,29 +82,13 @@ inermycalloc_i: void myfree(void * ptr) { BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); -#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 BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME(); return; } void myfree_i(void * 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 2c47cbfb..08f0da54 100644 --- a/Robust/src/Runtime/mem.h +++ b/Robust/src/Runtime/mem.h @@ -47,7 +47,6 @@ void mycalloc_free_ngc_I(void * ptr); void * mycalloc_share(int size); #define FREEMALLOC(x) mycalloc_share(x) #endif // #ifdef MULTICORE_GC -//#define PTR(x) (32+(x-1)&~31) #endif // #ifdef MULTICORE #endif // #ifdef PRECISE_GC #endif // #ifdef BOEHM_GC