From 9c33fa100ef6862873c717677eeabf6e65f56ddb Mon Sep 17 00:00:00 2001 From: bdemsky Date: Sat, 25 Jun 2011 00:48:40 +0000 Subject: [PATCH] code change --- .../src/Runtime/bamboo/multicoregccompact.c | 47 ++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/Robust/src/Runtime/bamboo/multicoregccompact.c b/Robust/src/Runtime/bamboo/multicoregccompact.c index 8c7b14d2..0efbbbf8 100644 --- a/Robust/src/Runtime/bamboo/multicoregccompact.c +++ b/Robust/src/Runtime/bamboo/multicoregccompact.c @@ -70,6 +70,52 @@ void handleReturnMem_I(unsigned int cnum, void *heaptop) { nextblockrecord->freespace=BLOCKSIZE(1); } } + + //this could be the last one.... + int count=gc_countRunningCores(); + if (gcmovepending==count) { + // All cores have stopped...hand out memory as necessary to handle all requests + handleMemoryRequests_I(); + } else { + //see if returned memory blocks let us resolve requests + useReturnedMem(); + } +} + +void useReturnedMem(unsigned int corenum, block_t localblockindex) { + for(int i=0;ithreshold?requiredmem:threshold; + + + for(block_t nextlocalblocknum=localblockindex;nextlocalblocknumstatus==BS_FREE) { + unsigned INTPTR freespace=block->freespace&~BAMBOO_CACHE_LINE_MASK; + if (freespace>=memcheck) { + block->status=BS_USED; + void *blockptr=OFFSET2BASEVA(searchblock)+gcbaseva; + unsigned INTPTR usedspace=((block->usedspace-1)&~BAMBOO_CACHE_LINE_MASK)+BAMBOO_CACHE_LINE_SIZE; + allocationinfo.lowestfreeblock=firstfree; + //taken care of one block + gcmovepending--; + void *startaddr=blockptr+usedspace; + gcrequiredmems[i]=0; + maxusefulmems[i]=0; + if(BAMBOO_CHECK_SEND_MODE()) { + cache_msg_2_I(core,GCMOVESTART,startaddr); + } else { + send_msg_2_I(core,GCMOVESTART,startaddr); + } + } + } + } + } + } } void handleReturnMem(unsigned int cnum, void *heaptop) { @@ -96,7 +142,6 @@ void getSpaceRemotely(struct moveHelper *to, unsigned int minimumbytes) { //send request for memory send_msg_4(STARTUPCORE,GCFINISHCOMPACT,BAMBOO_NUM_OF_CORE, minimumbytes, gccurr_heaptop); //wait for flag to be set that we received message - int cc=0; while(!gctomove) ; } -- 2.34.1