From: bdemsky Date: Mon, 27 Jun 2011 06:18:57 +0000 (+0000) Subject: runs the memory benchmark now... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=52b5e7ba69994ba19c2129b5968aed1b2af4a1ab;p=IRC.git runs the memory benchmark now... --- diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.c b/Robust/src/Runtime/bamboo/multicoregarbage.c index d85eb299..320bf91e 100644 --- a/Robust/src/Runtime/bamboo/multicoregarbage.c +++ b/Robust/src/Runtime/bamboo/multicoregarbage.c @@ -8,6 +8,7 @@ #include "multicoregcprofile.h" #include "gcqueue.h" #include "multicoremem_helper.h" +#include "bambooalign.h" volatile bool gcflag; gc_status_t gc_status_info; diff --git a/Robust/src/Runtime/bamboo/multicoregccompact.c b/Robust/src/Runtime/bamboo/multicoregccompact.c index 0efbbbf8..be964cd5 100644 --- a/Robust/src/Runtime/bamboo/multicoregccompact.c +++ b/Robust/src/Runtime/bamboo/multicoregccompact.c @@ -78,7 +78,7 @@ void handleReturnMem_I(unsigned int cnum, void *heaptop) { handleMemoryRequests_I(); } else { //see if returned memory blocks let us resolve requests - useReturnedMem(); + useReturnedMem(cnum, allocationinfo.lowestfreeblock); } } @@ -92,24 +92,24 @@ void useReturnedMem(unsigned int corenum, block_t localblockindex) { for(block_t nextlocalblocknum=localblockindex;nextlocalblocknumstatus==BS_FREE) { - unsigned INTPTR freespace=block->freespace&~BAMBOO_CACHE_LINE_MASK; + unsigned INTPTR freespace=nextblockrecord->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; + nextblockrecord->status=BS_USED; + void *blockptr=OFFSET2BASEVA(blocknum)+gcbaseva; + unsigned INTPTR usedspace=((nextblockrecord->usedspace-1)&~BAMBOO_CACHE_LINE_MASK)+BAMBOO_CACHE_LINE_SIZE; //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); + cache_msg_2_I(corenum,GCMOVESTART,startaddr); } else { - send_msg_2_I(core,GCMOVESTART,startaddr); + send_msg_2_I(corenum,GCMOVESTART,startaddr); } } } @@ -374,6 +374,16 @@ unsigned int compactblocks(struct moveHelper * orig, struct moveHelper * to) { if (objlength!=NOTMARKED) { unsigned int length=ALIGNSIZETOBYTES(objlength); + + /* unsigned int size; + unsigned int type; + gettype_size(origptr, &type, &size); + size=((size-1)&(~(ALIGNMENTSIZE-1)))+ALIGNMENTSIZE; + + if (size!=length) { + tprintf("BAD SIZE IN BITMAP: type=%u object=%x size=%u length=%u\n", type, origptr, size, length); + }*/ + void *endtoptr=toptr+length; if (endtoptr>tobound) { gccurr_heaptop-=(unsigned INTPTR)(toptr-toptrinit); @@ -382,6 +392,7 @@ unsigned int compactblocks(struct moveHelper * orig, struct moveHelper * to) { return length; } //good to move objects and update pointers + //tprintf("Decided to compact obj %x to %x\n", origptr, toptr); gcmappingtbl[OBJMAPPINGINDEX(origptr)]=toptr; origptr+=length; diff --git a/Robust/src/Runtime/bamboo/multicoregcflush.c b/Robust/src/Runtime/bamboo/multicoregcflush.c index 4706c6a6..6d79bc7f 100644 --- a/Robust/src/Runtime/bamboo/multicoregcflush.c +++ b/Robust/src/Runtime/bamboo/multicoregcflush.c @@ -221,6 +221,8 @@ void * updateblocks(struct moveHelper * orig, struct moveHelper * to) { memcpy(dstptr, origptr, length); } + //tprintf("Moving object %x to %x with lenght %u\n", origptr, dstptr, length); + /* Update the pointers in the object */ updatePtrsInObj(dstptr); diff --git a/Robust/src/Runtime/bamboo/multicoregcmark.c b/Robust/src/Runtime/bamboo/multicoregcmark.c index 336d83f0..804c1cad 100644 --- a/Robust/src/Runtime/bamboo/multicoregcmark.c +++ b/Robust/src/Runtime/bamboo/multicoregcmark.c @@ -248,6 +248,7 @@ void mark(struct garbagelist * stackptr) { bool islarge=isLarge(ptr, &type, &size); unsigned int iunits = ALIGNUNITS(size); setLengthMarked(ptr,iunits); + //tprintf("Marking object %x, type %u, length %u, units %u\n", ptr, type, size, iunits); if(islarge) { // ptr is a large object and not marked or enqueued diff --git a/Robust/src/Runtime/bamboo/multicoremem.c b/Robust/src/Runtime/bamboo/multicoremem.c index f84ac450..aeb9353c 100644 --- a/Robust/src/Runtime/bamboo/multicoremem.c +++ b/Robust/src/Runtime/bamboo/multicoremem.c @@ -98,6 +98,7 @@ void * smemalloc_I(int coren, int isize, int * allocsize) { #elif defined(SMEMG) void *mem = globalmalloc_I(coren, isize, allocsize); #endif + // tprintf("Handing core %u memory block %x of size %u\n", coren, mem, *allocsize); if(mem == NULL) { // no enough shared global memory // trigger gc diff --git a/Robust/src/Runtime/bamboo/multicoremem.h b/Robust/src/Runtime/bamboo/multicoremem.h index 6297a687..a307c24d 100644 --- a/Robust/src/Runtime/bamboo/multicoremem.h +++ b/Robust/src/Runtime/bamboo/multicoremem.h @@ -105,7 +105,8 @@ #endif // GC_SMALLPAGESIZE //keeps track of the top address that has been zero'd by the allocator -volatile unsigned int bamboo_smem_zero_top; +volatile void * bamboo_smem_zero_top; +volatile unsigned int totalbytestozero; //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)