- region->startptr=gcbaseva+startregion*UNITSIZE;
- region->endptr=gcbaseva+endregion*UNITSIZE;
- pmc_forward(region, totalbytes, region->startptr, region->endptr, BAMBOO_NUM_OF_CORE&1);
+ region->startptr=(i==0)?gcbaseva:pmc_heapptr->units[i-1].endptr;
+ region->endptr=pmc_heapptr->units[i].endptr;
+
+ if (BAMBOO_NUM_OF_CORE&1) {
+ //backward direction
+ region->lastptr=region->endptr-totalbytes;
+ } else {
+ //forward direction
+ region->lastptr=region->startptr+totalbytes;
+ }
+
+ pmc_forward(region, totalbytes, region->startptr, region->endptr, !(BAMBOO_NUM_OF_CORE&1));