fix odd core pmc bug
authorbdemsky <bdemsky>
Fri, 15 Jul 2011 03:42:41 +0000 (03:42 +0000)
committerbdemsky <bdemsky>
Fri, 15 Jul 2011 03:42:41 +0000 (03:42 +0000)
Robust/src/Runtime/bamboo/pmc_garbage.c
Robust/src/Runtime/bamboo/pmc_mem.c

index 0a769c3b5d84c9d50b80d3565c85285576764ff4..3a9f99dc7e75a3a21e5a79e0f01c2540ff785486 100644 (file)
@@ -46,9 +46,11 @@ void pmc_onceInit() {
        pmc_heapptr->regions[i].lastptr=pmc_heapptr->units[i*4-1].endptr;
       pmc_heapptr->regions[i].lowunit=4*i;
       pmc_heapptr->regions[i].highunit=4*(i+1);
-      pmc_heapptr->regions[i+1].lastptr=pmc_heapptr->units[(i+1)*4+3].endptr;
-      pmc_heapptr->regions[i+1].lowunit=4*(i+1);
-      pmc_heapptr->regions[i+1].highunit=4*(i+2);
+      if ((i+1)<NUMCORES4GC) {
+       pmc_heapptr->regions[i+1].lastptr=pmc_heapptr->units[(i+1)*4+3].endptr;
+       pmc_heapptr->regions[i+1].lowunit=4*(i+1);
+       pmc_heapptr->regions[i+1].highunit=4*(i+2);
+      }
     }
     //for(int i=0;i<NUMCORES4GC;i++) {
       //tprintf("%u lastptr=%x\n", i, pmc_heapptr->regions[i].lastptr);
@@ -61,7 +63,7 @@ void pmc_init() {
     pmc_heapptr->numthreads=NUMCORES4GC;
     for(int i=0;i<NUMCORES4GC;i+=2) {
       void *startptr=pmc_heapptr->regions[i].lastptr;
-      void *finishptr=pmc_heapptr->regions[i+1].lastptr;
+      void *finishptr=(i+1)<NUMCORES4GC?pmc_heapptr->regions[i+1].lastptr:pmc_heapptr->regions[i].endptr;
       struct pmc_region *region=&pmc_heapptr->regions[i];
       unsigned int startindex=region->lowunit;
       unsigned int endindex=pmc_heapptr->regions[i+1].highunit;
index 1b488741104167432d09acb016aeddd59cdeadee..191ce43b4973ee51a754032c303e30c412b9543a 100644 (file)
@@ -11,8 +11,8 @@ void * pmc_alloc(unsigned int * numbytesallocated, unsigned int minimumbytes) {
 
   for(int i=0;i<NUMCORES4GC;i+=2) {
     void *startptr=pmc_heapptr->regions[i].lastptr;
-    void *finishptr=pmc_heapptr->regions[i+1].lastptr;
-
+    void *finishptr=(i+1)<NUMCORES4GC?pmc_heapptr->regions[i+1].lastptr:pmc_heapptr->regions[i].endptr;
+    
     if ((finishptr-startptr)>memcheck) {
       struct pmc_region *region=&pmc_heapptr->regions[i];
       tmc_spin_mutex_lock(&region->lock);