}
}
+void pmc_doforward() {
+ int startregion=-1;
+ int endregion=-1;
+ unsigned int totalbytes=0;
+ struct pmc_region * region=&pmc_heapptr->regions[BAMBOO_NUM_OF_CORE];
+ for(int i=0;i<NUMPMCUNITS;i++) {
+ if (startregion==-1&&BAMBOO_NUM_OF_CORE==pmc_heapptr->units[i].regionnum) {
+ startregion=i;
+ }
+ if (BAMBOO_NUM_OF_CORE<pmc_heapptr->units[i].regionnum) {
+ endregion=i;
+ break;
+ }
+ if (startregion!=-1) {
+ totalbytes+=pmc_heapptr->units[i].numbytes;
+ }
+ }
+ if (startregion==-1)
+ return;
+ if (endregion==-1)
+ endregion=NUMPMCUNITS;
+ region->startptr=gcbaseva+startregion*UNITSIZE;
+ region->endptr=gcbaseva+endregion*UNITSIZE;
+ pmc_forward(region, totalbytes, region->startptr, region->endptr, BAMBOO_NUM_OF_CORE&1);
+}
+
void pmc_forward(struct pmc_region *region, unsigned int totalbytes, void *bottomptr, void *topptr, bool fwddirection) {
void *tmpptr=bottomptr;
void gc(struct garbagelist *gl) {
pmc_init();
+ //mark live objects
pmc_mark(gl);
+ //count live objects per unit
pmc_count();
tmc_spin_barrier_wait(&pmc_heapptr->barrier);
+ //divide up work
if (BAMBOO_NUM_OF_THREADS==STARTUPCORE) {
pmc_processunits();
}
tmc_spin_barrier_wait(&pmc_heapptr->barrier);
-
+ //set up forwarding pointers
+ pmc_doforward();
+ tmc_spin_barrier_wait(&pmc_heapptr->barrier);
+ //update pointers
+ pmc_doreferenceupdate();
+ tmc_spin_barrier_wait(&pmc_heapptr->barrier);
+ //compact data
+ pmc_docompact();
+ tmc_spin_barrier_wait(&pmc_heapptr->barrier);
}
struct pmc_region {
void * lastptr;
+ void * startptr;
+ void * endptr;
struct ___Object___ * lastobj;
struct pmc_queue markqueue;
};
}
}
+void pmc_doreferenceupdate() {
+ struct pmc_region * region=&pmc_heapptr->regions[BAMBOO_NUM_OF_CORE];
+ pmc_referenceupdate(region->startptr, region->endptr);
+}
+
void pmc_referenceupdate(void *bottomptr, void *topptr) {
void *tmpptr=bottomptr;
while(tmpptr<topptr) {
}
}
+void pmc_docompact() {
+ struct pmc_region * region=&pmc_heapptr->regions[BAMBOO_NUM_OF_CORE];
+ pmc_compact(region, BAMBOO_NUM_OF_CORE&1, region->startptr, region->endptr);
+}
+
void pmc_compact(struct pmc_region * region, int forward, void *bottomptr, void *topptr) {
if (forward) {