1 #include "pmc_forward.h"
4 //Comment: should build dummy byte arrays to allow skipping data...
5 void pmc_countbytes(struct pmc_region * region, void *bottomptr, void *topptr) {
6 void *tmpptr=bottomptr;
7 unsigned int totalbytes=0;
11 gettype_size(tmpptr, &type, &size);
13 tmpptr+=ALIGNMENTSIZE;
16 size=((size-1)&(~(ALIGNMENTSIZE-1)))+ALIGNMENTSIZE;
17 if (((struct ___Object___ *)tmpptr)->mark)
21 region->numbytes=totalbytes;
25 void pmc_forward(struct pmc_region *region, unsigned int totalbytes, void *bottomptr, void *topptr, bool fwddirection) {
26 void *tmpptr=bottomptr;
27 void *forwardptr=fwddirection?bottomptr:(topptr-totalbytes);
28 struct ___Object___ *lastobj=NULL;
30 while(tmpptr>topptr) {
33 gettype_size(tmpptr, &type, &size);
35 tmpptr+=ALIGNMENTSIZE;
38 size=((size-1)&(~(ALIGNMENTSIZE-1)))+ALIGNMENTSIZE;
40 if (((struct ___Object___ *)tmpptr)->mark) {
41 ((struct ___Object___ *)tmpptr)->mark=forwardptr;
43 if (lastobj&&!fwddirection) {
44 tmpptr->backward=lastobj;
45 lastobj=(struct ___Object___ *)tmpptr;
50 region->lastobj=lastobj;