#include "multicoregc.h"
#include "multicoreruntime.h"
+#include "multicoregcprofile.h"
#include "pmc_garbage.h"
#include "runtime_arch.h"
#include "pmc_mark.h"
pmc_heapptr->regions[i].lastptr=pmc_heapptr->units[i*4-1].endptr;
pmc_heapptr->regions[i].lowunit=4*i;
pmc_heapptr->regions[i].highunit=4*(i+1);
- pmc_heapptr->regions[i+1].lastptr=pmc_heapptr->units[(i+1)*4+3].endptr;
- pmc_heapptr->regions[i+1].lowunit=4*(i+1);
- pmc_heapptr->regions[i+1].highunit=4*(i+2);
+ if ((i+1)<NUMCORES4GC) {
+ pmc_heapptr->regions[i+1].lastptr=pmc_heapptr->units[(i+1)*4+3].endptr;
+ pmc_heapptr->regions[i+1].lowunit=4*(i+1);
+ pmc_heapptr->regions[i+1].highunit=4*(i+2);
+ }
}
//for(int i=0;i<NUMCORES4GC;i++) {
//tprintf("%u lastptr=%x\n", i, pmc_heapptr->regions[i].lastptr);
pmc_heapptr->numthreads=NUMCORES4GC;
for(int i=0;i<NUMCORES4GC;i+=2) {
void *startptr=pmc_heapptr->regions[i].lastptr;
- void *finishptr=pmc_heapptr->regions[i+1].lastptr;
+ void *finishptr=(i+1)<NUMCORES4GC?pmc_heapptr->regions[i+1].lastptr:pmc_heapptr->regions[i].endptr;
struct pmc_region *region=&pmc_heapptr->regions[i];
unsigned int startindex=region->lowunit;
- unsigned int endindex=pmc_heapptr->regions[i+1].highunit;
+ unsigned int endindex=(i+1)<NUMCORES4GC?pmc_heapptr->regions[i+1].highunit:pmc_heapptr->regions[i].highunit;
//tprintf("Free space in partition %u from %x to %x\n", i, startptr, finishptr);
for(unsigned int index=startindex;index<endindex;index++) {
void *ptr=pmc_heapptr->units[index].endptr;
#ifdef PERFCOUNT
profile_start(GC_REGION);
#endif
- if (BAMBOO_NUM_OF_CORE==STARTUPCORE)
+ if (BAMBOO_NUM_OF_CORE==STARTUPCORE) {
tprintf("start GC\n");
+ GCPROFILE_START_MASTER();
+ }
pmc_init();
+ if (BAMBOO_NUM_OF_CORE==STARTUPCORE) {
+ GCPROFILE_ITEM_MASTER();
+ }
//mark live objects
//tprintf("mark\n");
pmc_mark(gl);
//count live objects per unit
tmc_spin_barrier_wait(&pmc_heapptr->barrier);
+ if (BAMBOO_NUM_OF_CORE==STARTUPCORE) {
+ GCPROFILE_ITEM_MASTER();
+ }
//tprintf("count\n");
pmc_count();
tmc_spin_barrier_wait(&pmc_heapptr->barrier);
+ if (BAMBOO_NUM_OF_CORE==STARTUPCORE) {
+ GCPROFILE_ITEM_MASTER();
+ }
//divide up work
//tprintf("divide\n");
if (BAMBOO_NUM_OF_CORE==STARTUPCORE) {
pmc_processunits();
+ GCPROFILE_ITEM_MASTER();
}
tmc_spin_barrier_wait(&pmc_heapptr->barrier);
//set up forwarding pointers
//tprintf("forward\n");
pmc_doforward();
tmc_spin_barrier_wait(&pmc_heapptr->barrier);
+ if (BAMBOO_NUM_OF_CORE==STARTUPCORE) {
+ GCPROFILE_ITEM_MASTER();
+ }
//update pointers
//tprintf("updaterefs\n");
pmc_doreferenceupdate(gl);
tmc_spin_barrier_wait(&pmc_heapptr->barrier);
+ if (BAMBOO_NUM_OF_CORE==STARTUPCORE) {
+ GCPROFILE_ITEM_MASTER();
+ }
//compact data
//tprintf("compact\n");
pmc_docompact();
gcflag=false;
tmc_spin_barrier_wait(&pmc_heapptr->barrier);
+ if (BAMBOO_NUM_OF_CORE==STARTUPCORE) {
+ GCPROFILE_RECORD_SPACE_MASTER();
+ GCPROFILE_END_MASTER();
+ }
#ifdef PERFCOUNT
profile_start(APP_REGION);