void pmc_countbytes(struct pmc_unit * unit, void *bottomptr, void *topptr) {
void *tmpptr=bottomptr;
unsigned int totalbytes=0;
+ void * lastunmarked=NULL;
+ bool padokay=false;
while(tmpptr<topptr) {
unsigned int type;
unsigned int size;
continue;
}
size=((size-1)&(~(ALIGNMENTSIZE-1)))+ALIGNMENTSIZE;
- if (((struct ___Object___ *)tmpptr)->marked)
+ if (((struct ___Object___ *)tmpptr)->marked) {
+ if (lastunmarked!=NULL) {
+ if (padokay)
+ padspace(lastunmarked, (unsigned INTPTR) (tmpptr-lastunmarked));
+ padokay=false;
+ lastunmarked=NULL;
+ }
totalbytes+=size;
+ } else if (lastunmarked!=NULL)
+ lastunmarked=tmpptr;
+ else
+ padokay=true;
tmpptr+=size;
}
unit->numbytes=totalbytes;
for(;regionnum<NUMCORES4GC;regionnum++) {
pmc_heapptr->regions[regionnum].highunit=NUMPMCUNITS;
pmc_heapptr->regions[regionnum].endptr=pmc_heapptr->units[NUMPMCUNITS-1].endptr;
- pmc_heapptr->regions[regionnum+1].startptr=pmc_heapptr->units[NUMPMCUNITS-1].endptr;
- pmc_heapptr->regions[regionnum+1].lowunit=NUMPMCUNITS;
+ if ((regionnum+1)<NUMCORES4GC) {
+ pmc_heapptr->regions[regionnum+1].startptr=pmc_heapptr->units[NUMPMCUNITS-1].endptr;
+ pmc_heapptr->regions[regionnum+1].lowunit=NUMPMCUNITS;
+ }
}
}