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;
void *endtoptr=dstptr+length;
if(origptr < endtoptr&&dstptr < origptr+length) {
- unsigned int *sptr=origptr+length;
- unsigned int *dptr=endtoptr;
+ unsigned int *sptr=origptr+length-4;
+ unsigned int *dptr=endtoptr-4;
unsigned int len=length;
//we will never have an object of size 0....