From ec1f2bbea0ac282e75e47e95b0192bad9b7ba82b Mon Sep 17 00:00:00 2001 From: jzhou Date: Mon, 1 Aug 2011 22:42:02 +0000 Subject: [PATCH] Fix bug in pmc garbage collector --- Robust/src/Runtime/bamboo/pmc_forward.c | 8 +++++++- Robust/src/Runtime/bamboo/pmc_garbage.c | 15 ++++++++------- Robust/src/Runtime/bamboo/pmc_mem.c | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Robust/src/Runtime/bamboo/pmc_forward.c b/Robust/src/Runtime/bamboo/pmc_forward.c index c2c158af..975b7991 100644 --- a/Robust/src/Runtime/bamboo/pmc_forward.c +++ b/Robust/src/Runtime/bamboo/pmc_forward.c @@ -128,7 +128,13 @@ void pmc_forward(struct pmc_region *region, unsigned int totalbytes, void *botto if (!lower) { //We're resetting the boundaries of units at the low address end of the region... //Be sure not to reset the boundary of our last unit...it is shared with another region - + //Very bottom most unit defines boundary of region...we can't move that right now + while((endunitstartptr)&&(currunitunits[currunit].endptr=region->startptr; + //tprintf("Ch6: %u -> %x\n", currunit, endunit); + currunit++; + endunit=pmc_unitend(currunit); + } while(endunit<=region->lastptr&&(currunitunits[currunit].endptr=endunit; //tprintf("Ch2: %u -> %x\n", currunit, endunit); diff --git a/Robust/src/Runtime/bamboo/pmc_garbage.c b/Robust/src/Runtime/bamboo/pmc_garbage.c index 334005f9..caaff1aa 100644 --- a/Robust/src/Runtime/bamboo/pmc_garbage.c +++ b/Robust/src/Runtime/bamboo/pmc_garbage.c @@ -145,12 +145,12 @@ void gc(struct garbagelist *gl) { //tprintf("done\n"); //if (BAMBOO_NUM_OF_CORE==STARTUPCORE) { - // for(int i=0;iregions[i].lastptr; - // void *finishptr=pmc_heapptr->regions[i+1].lastptr; - // tprintf("Partition %u from %x to %x\n", i, startptr, finishptr); - // tprintf("%x %x %x %x\n", pmc_heapptr->regions[i].startptr, pmc_heapptr->regions[i].endptr, pmc_heapptr->regions[i+1].startptr, pmc_heapptr->regions[i+1].endptr); - // } + // for(int i=0;iregions[i].lastptr; + // void *finishptr=pmc_heapptr->regions[i+1].lastptr; + // tprintf("Partition %u from %x to %x\n", i, startptr, finishptr); + // tprintf("%x %x %x %x\n", pmc_heapptr->regions[i].startptr, pmc_heapptr->regions[i].endptr, pmc_heapptr->regions[i+1].startptr, pmc_heapptr->regions[i+1].endptr); + // } // } gcflag=false; @@ -182,8 +182,9 @@ void padspace(void *ptr, unsigned int length) { void gettype_size(void * ptr, unsigned int * ttype, unsigned int * tsize) { int type = ((int *)ptr)[0]; - // if (type>TOTALNUMCLASSANDARRAY) { + // if ((type>TOTALNUMCLASSANDARRAY)||(type<0)) { // tprintf("ptr=%x type=%u\n", ptr, type); + // BAMBOO_EXIT(); // } if(type < NUMCLASSES) { diff --git a/Robust/src/Runtime/bamboo/pmc_mem.c b/Robust/src/Runtime/bamboo/pmc_mem.c index ac25f6b5..fc8ba4d7 100644 --- a/Robust/src/Runtime/bamboo/pmc_mem.c +++ b/Robust/src/Runtime/bamboo/pmc_mem.c @@ -27,7 +27,7 @@ void * pmc_alloc(unsigned int * numbytesallocated, unsigned int minimumbytes) { //update unit end points for(unsigned int index=startindex;index<(endindex-1);index++) { - void *ptr=pmc_unitend(index); + void *ptr=(pmc_unitend(index)>pmc_heapptr->units[index].endptr)?(pmc_unitend(index)):(pmc_heapptr->units[index].endptr); if ((ptr>startptr)&&(ptr<=newstartptr)) { //tprintf("Ch: %u -> %x\n", index, newstartptr); pmc_heapptr->units[index].endptr=newstartptr; -- 2.34.1