more change for PMC
[IRC.git] / Robust / src / Runtime / bamboo / pmc_refupdate.c
index 7bc9baa260e8dee875514bd495699842d2cb96ab..100cb9ed5031a8df56b5ce399e72f0c23c3e2749 100644 (file)
@@ -1,6 +1,7 @@
 #include <stdlib.h>
 #include "structdefs.h"
 #include "bambooalign.h"
+#include "multicoregc.h"
 #include "runtime_arch.h"
 #include "pmc_forward.h"
 #include "pmc_refupdate.h"
@@ -17,6 +18,7 @@
 
 void pmc_updatePtrs(void *ptr, int type) {
   unsigned int * pointer=pointerarray[type];
+  tprintf("Updating pointers in %x\n", ptr);
   if (pointer==0) {
     /* Array of primitives */
   } else if (((unsigned int)pointer)==1) {
@@ -33,7 +35,8 @@ void pmc_updatePtrs(void *ptr, int type) {
       unsigned int offset=pointer[i];
       PMCUPDATEOBJ(*((void **)(((char *)ptr)+offset)));
     }
-  }  
+  }
+  tprintf("done\n");
 }
 
 void pmc_updategarbagelist(struct garbagelist *listptr) {
@@ -186,12 +189,13 @@ void pmc_compact(struct pmc_region * region, int forward, void *bottomptr, void
       void *forwardptr=(void *)((struct ___Object___ *) tmpptr)->marked;
       ((struct ___Object___ *) tmpptr)->marked=NULL;
       if (forwardptr) {
+       //tprintf("Compacting %x\n",tmpptr);
        memmove(forwardptr, tmpptr, size);
       }
       tmpptr+=size;
     }
   } else {
-    struct ___Object___ *backward=((struct ___Object___ *) region)->backward;
+    struct ___Object___ *backward=region->lastobj;
     struct ___Object___ *lastobj=NULL;
     while(backward) {
       lastobj=backward;
@@ -202,9 +206,8 @@ void pmc_compact(struct pmc_region * region, int forward, void *bottomptr, void
       size=((size-1)&(~(ALIGNMENTSIZE-1)))+ALIGNMENTSIZE;
       void *forwardptr=(void *)((struct ___Object___ *) lastobj)->marked;
       ((struct ___Object___ *) lastobj)->marked=NULL;
-      if (forwardptr) {
-       memmove(forwardptr, lastobj, size);
-      }
+      //tprintf("Compacting %x\n",lastobj);
+      memmove(forwardptr, lastobj, size);
     }
   }
 }