From: bdemsky Date: Fri, 8 Jul 2011 21:02:46 +0000 (+0000) Subject: more change for PMC X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0d4f2d12f975e69f640cd6f4240c927915c723ee;p=IRC.git more change for PMC --- diff --git a/Robust/src/Runtime/bamboo/pmc_forward.c b/Robust/src/Runtime/bamboo/pmc_forward.c index b4ec94e3..83a01b42 100644 --- a/Robust/src/Runtime/bamboo/pmc_forward.c +++ b/Robust/src/Runtime/bamboo/pmc_forward.c @@ -1,8 +1,9 @@ +#include "multicoregc.h" #include "pmc_forward.h" #include "runtime_arch.h" #include "bambooalign.h" #include "pmc_garbage.h" -#include "multicoregc.h" + void pmc_count() { for(int i=0;iunits[i-1].endptr; void *unittop=pmc_heapptr->units[i].endptr; - //tprintf("Cnt: %x - %x\n", unitbase, unittop); + tprintf("Cnt: %x - %x\n", unitbase, unittop); pmc_countbytes(&pmc_heapptr->units[i], unitbase, unittop); } } @@ -23,6 +24,7 @@ void pmc_countbytes(struct pmc_unit * unit, void *bottomptr, void *topptr) { while(tmpptrlastobj=lastobj; } diff --git a/Robust/src/Runtime/bamboo/pmc_garbage.c b/Robust/src/Runtime/bamboo/pmc_garbage.c index 2e0a8fc1..91547146 100644 --- a/Robust/src/Runtime/bamboo/pmc_garbage.c +++ b/Robust/src/Runtime/bamboo/pmc_garbage.c @@ -2,6 +2,9 @@ #include "multicoreruntime.h" #include "pmc_garbage.h" #include "runtime_arch.h" +#include "pmc_mark.h" +#include "pmc_forward.h" +#include "pmc_refupdate.h" struct pmc_heap * pmc_heapptr; struct pmc_queue * pmc_localqueue; @@ -30,7 +33,7 @@ void pmc_onceInit() { tmc_spin_barrier_init(&pmc_heapptr->barrier, NUMCORES4GC); for(int i=0;iunits[i].endptr=pmc_unitend(i); - //tprintf("%u endptr=%x\n", i, pmc_heapptr->units[i].endptr); + tprintf("%u endptr=%x\n", i, pmc_heapptr->units[i].endptr); } for(int i=0;iregions[i+1].lowunit=4*(i+1); pmc_heapptr->regions[i+1].highunit=4*(i+2); } - // for(int i=0;iregions[i].lastptr); - // } + for(int i=0;iregions[i].lastptr); + } } } @@ -59,7 +62,7 @@ void pmc_init() { struct pmc_region *region=&pmc_heapptr->regions[i]; unsigned int startindex=region->lowunit; unsigned int endindex=pmc_heapptr->regions[i+1].highunit; - // tprintf("Free space in partition %u from %x to %x\n", i, startptr, finishptr); + tprintf("Free space in partition %u from %x to %x\n", i, startptr, finishptr); for(unsigned int index=startindex;indexunits[index].endptr; if ((ptr>startptr)&&(ptr<=finishptr)) { @@ -67,76 +70,61 @@ void pmc_init() { startptr=ptr; } if (ptr>finishptr) { - void *prevunitptr=pmc_heapptr->units[index-1].endptr; - padspace(startptr, finishptr-startptr); + padspace(startptr, (unsigned int) (finishptr-startptr)); break; } } } } if (bamboo_smem_size) { - // tprintf("Left over alloc space from %x to %x\n", bamboo_cur_msp, bamboo_cur_msp+bamboo_smem_size); + tprintf("Left over alloc space from %x to %x\n", bamboo_cur_msp, bamboo_cur_msp+bamboo_smem_size); padspace(bamboo_cur_msp, bamboo_smem_size); } tmc_spin_barrier_wait(&pmc_heapptr->barrier); } void gc(struct garbagelist *gl) { - if (BAMBOO_NUM_OF_CORE==STARTUPCORE) - tprintf("start GC\n"); + tprintf("start GC\n"); pmc_init(); //mark live objects - // tprintf("mark\n"); + tprintf("mark\n"); pmc_mark(gl); //count live objects per unit tmc_spin_barrier_wait(&pmc_heapptr->barrier); - // tprintf("count\n"); + tprintf("count\n"); pmc_count(); tmc_spin_barrier_wait(&pmc_heapptr->barrier); //divide up work - // tprintf("divide\n"); + tprintf("divide\n"); if (BAMBOO_NUM_OF_CORE==STARTUPCORE) { pmc_processunits(); } tmc_spin_barrier_wait(&pmc_heapptr->barrier); //set up forwarding pointers - // tprintf("forward\n"); + tprintf("forward\n"); pmc_doforward(); tmc_spin_barrier_wait(&pmc_heapptr->barrier); //update pointers - // tprintf("updaterefs\n"); + tprintf("updaterefs\n"); pmc_doreferenceupdate(gl); tmc_spin_barrier_wait(&pmc_heapptr->barrier); //compact data - // tprintf("compact\n"); + tprintf("compact\n"); pmc_docompact(); //reset memory allocation bamboo_cur_msp=NULL; bamboo_smem_size=0; - // tprintf("done\n"); + tprintf("done\n"); - if (BAMBOO_NUM_OF_CORE==STARTUPCORE) { - tmc_spin_barrier_wait(&pmc_heapptr->barrier); - //people will resend...no need to get gcflag so quickly - gcflag=false; - // for(int i=0;iregions[i].lastptr, pmc_heapptr->regions[i+1].lastptr); - // 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); - // tprintf("%u %u %u %u\n", pmc_heapptr->regions[i].lowunit, pmc_heapptr->regions[i].highunit, pmc_heapptr->regions[i+1].lowunit, pmc_heapptr->regions[i+1].highunit); - // } - // for(int i=0;iunits[i].endptr, pmc_heapptr->units[i].regionnum); - // } - } else { - //start to listen for gcflags before we exit - gcflag=false; - tmc_spin_barrier_wait(&pmc_heapptr->barrier); - } + gcflag=false; + tmc_spin_barrier_wait(&pmc_heapptr->barrier); + + tprintf("exit GC\n"); } void padspace(void *ptr, unsigned int length) { //zero small blocks - // tprintf("Padspace from %x to %x\n", ptr, ptr+length); + tprintf("Padspace from %x to %x\n", ptr, ptr+length); if (lengthTOTALNUMCLASSANDARRAY) { + tprintf("ptr=%x type=%u\n", ptr, type); + } + if(type < NUMCLASSES) { // a normal object *tsize = classsize[type]; diff --git a/Robust/src/Runtime/bamboo/pmc_garbage.h b/Robust/src/Runtime/bamboo/pmc_garbage.h index ab0f4499..e6c26e54 100644 --- a/Robust/src/Runtime/bamboo/pmc_garbage.h +++ b/Robust/src/Runtime/bamboo/pmc_garbage.h @@ -39,6 +39,7 @@ struct pmc_heap { extern struct pmc_heap * pmc_heapptr; extern struct pmc_queue * pmc_localqueue; +void gettype_size(void * ptr, unsigned int * ttype, unsigned int * tsize); void padspace(void *ptr, unsigned int length); void * pmc_unitend(unsigned int index); void incrementthreads(); diff --git a/Robust/src/Runtime/bamboo/pmc_mem.c b/Robust/src/Runtime/bamboo/pmc_mem.c index 7da2af76..40d7f437 100644 --- a/Robust/src/Runtime/bamboo/pmc_mem.c +++ b/Robust/src/Runtime/bamboo/pmc_mem.c @@ -44,17 +44,15 @@ void * pmc_alloc(unsigned int * numbytesallocated, unsigned int minimumbytes) { } } if (BAMBOO_NUM_OF_CORE==STARTUPCORE) { - BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT(); if (!gcflag) { gcflag = true; - for(int i=0;i -#define NUM_PMC_QUEUE_OBJECTS 500000 +#define NUM_PMC_QUEUE_OBJECTS 1500000 struct pmc_queue { volatile void * objects[NUM_PMC_QUEUE_OBJECTS]; diff --git a/Robust/src/Runtime/bamboo/pmc_refupdate.c b/Robust/src/Runtime/bamboo/pmc_refupdate.c index 7587b36c..100cb9ed 100644 --- a/Robust/src/Runtime/bamboo/pmc_refupdate.c +++ b/Robust/src/Runtime/bamboo/pmc_refupdate.c @@ -1,6 +1,7 @@ #include #include "structdefs.h" #include "bambooalign.h" +#include "multicoregc.h" #include "runtime_arch.h" #include "pmc_forward.h" #include "pmc_refupdate.h" @@ -11,16 +12,13 @@ #define pmcupdateObj(objptr) ((void *)((struct ___Object___ *)objptr)->marked) -#define PMCUPDATEOBJ(obj) {void *updatetmpptr=obj; if (updatetmpptr!=NULL) {obj=pmcupdateObj(updatetmpptr);}} +#define PMCUPDATEOBJ(obj) {void *updatetmpptr=obj; if (updatetmpptr!=NULL) {obj=pmcupdateObj(updatetmpptr);if (obj==NULL) {tprintf("BAD REF UPDATE %x->%x in %u\n",updatetmpptr,obj,__LINE__);}}} -//if (obj==NULL) {tprintf("BAD REF UPDATE %x->%x in %u\n",updatetmpptr,obj,__LINE__);}}} - -#define PMCUPDATEOBJNONNULL(obj) {void *updatetmpptr=obj; obj=pmcupdateObj(updatetmpptr);} -//if (obj==NULL) {tprintf("BAD REF UPDATE in %x->%x %u\n",updatetmpptr,obj,__LINE__);}} +#define PMCUPDATEOBJNONNULL(obj) {void *updatetmpptr=obj; obj=pmcupdateObj(updatetmpptr);if (obj==NULL) {tprintf("BAD REF UPDATE in %x->%x %u\n",updatetmpptr,obj,__LINE__);}} void pmc_updatePtrs(void *ptr, int type) { unsigned int * pointer=pointerarray[type]; - //tprintf("Updating pointers in %x\n", ptr); + tprintf("Updating pointers in %x\n", ptr); if (pointer==0) { /* Array of primitives */ } else if (((unsigned int)pointer)==1) { @@ -38,7 +36,7 @@ void pmc_updatePtrs(void *ptr, int type) { PMCUPDATEOBJ(*((void **)(((char *)ptr)+offset))); } } - //tprintf("done\n"); + tprintf("done\n"); } void pmc_updategarbagelist(struct garbagelist *listptr) { @@ -151,7 +149,7 @@ void pmc_doreferenceupdate(struct garbagelist *stackptr) { void pmc_referenceupdate(void *bottomptr, void *topptr) { void *tmpptr=bottomptr; - //tprintf("%x -- %x\n", bottomptr, topptr); + tprintf("%x -- %x\n", bottomptr, topptr); while(tmpptr