changes
authorbdemsky <bdemsky>
Wed, 6 Jul 2011 21:18:26 +0000 (21:18 +0000)
committerbdemsky <bdemsky>
Wed, 6 Jul 2011 21:18:26 +0000 (21:18 +0000)
Robust/src/Runtime/bamboo/pmc_forward.c
Robust/src/Runtime/bamboo/pmc_forward.h
Robust/src/Runtime/bamboo/pmc_garbage.c
Robust/src/Runtime/bamboo/pmc_garbage.h
Robust/src/Runtime/bamboo/pmc_mark.c
Robust/src/Runtime/bamboo/pmc_mark.h
Robust/src/Runtime/bamboo/pmc_mem.c
Robust/src/Runtime/bamboo/pmc_queue.c
Robust/src/Runtime/bamboo/pmc_queue.h
Robust/src/Runtime/bamboo/pmc_refupdate.c

index e073b3651214e81f2af84d178d6b356a378ccbe1..94d3fd90f1e5f5a05dd7bea562b2accb3f9b9bba 100644 (file)
@@ -1,12 +1,16 @@
 #include "pmc_forward.h"
+#include "runtime_arch.h"
+#include "bambooalign.h"
+#include "pmc_garbage.h"
+#include "multicoregc.h"
 
 void pmc_count() {
   for(int i=0;i<NUMPMCUNITS;i++) {
     if (!tmc_spin_mutex_trylock(&pmc_heapptr->units[i].lock)) {
       //got lock
-      void *unitbase=(i==0)?gcbaseva:pmc_heapptr->unit[i-1]->endptr;
-      void *unittop=pmc_heapptr->unit[i]->endptr;
-      pmc_countbytes(&pmc_heapptr->unit[i], unitbase, unittop);
+      void *unitbase=(i==0)?gcbaseva:pmc_heapptr->units[i-1]->endptr;
+      void *unittop=pmc_heapptr->units[i]->endptr;
+      pmc_countbytes(&pmc_heapptr->units[i], unitbase, unittop);
     }
   }
 }
@@ -132,7 +136,7 @@ void pmc_forward(struct pmc_region *region, unsigned int totalbytes, void *botto
       ((struct ___Object___ *)tmpptr)->marked=forwardptr;
       void *newforwardptr=forwardptr+size;
       while(newforwardptr>endunit) {
-       pmc_heapptr->region[currunit].endptr=newforwardptr;
+       pmc_heapptr->regions[currunit].endptr=newforwardptr;
        currunit++;
        endunit=pmc_unitend(currunit);
       }
index c851479236029c322936a11e2ebbed4848681d2a..7f63bbb83005ea54430f230a74ea4e5d836f0270 100644 (file)
@@ -7,7 +7,7 @@ void pmc_count();
 void pmc_countbytes(struct pmc_unit * region, void *bottomptr, void *topptr);
 void pmc_processunits();
 void pmc_doforward();
-void pmc_forward(unsigned int totalbytes, void *bottomptr, void *topptr, bool fwddirection);
+void pmc_forward(struct pmc_region *region, unsigned int totalbytes, void *bottomptr, void *topptr, bool fwddirection);
 
 
 #endif
index 0b8301a9f051b4c9a1cbb0cf46a1b9fb40853e99..46285737b78aade7257f5c42ddb24f9452ce399d 100644 (file)
@@ -1,4 +1,6 @@
 #include "pmc_garbage.h"
+#include "multicoregc.h"
+#inclued "runtime_arch.h"
 
 struct pmc_queue * pmc_localqueue;
 
index 9f565252acf86f3df1e9787e3120f07e46055f42..1662f0c197f94f68d5ee62641e27437c733763c3 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef PMC_GARBAGE_H
 #define PMC_GARBAGE_H
 #include <tmc/spin.h>
+#include "pmc_queue.h"
+#include "structdefs.h"
 
 #define PMC_MINALLOC 131072
 #define NUMPMCUNITS (4*NUMCORES4GC)
@@ -26,10 +28,11 @@ struct pmc_region {
 };
 
 struct pmc_heap {
-  struct pmc_region units[NUMPMCUNITS];
+  struct pmc_unit units[NUMPMCUNITS];
   struct pmc_region regions[NUMCORES4GC];
   tmc_spin_mutex_t lock;
   volatile unsigned int numthreads;
+  tmc_spin_barrier_t barrier;
 };
 
 extern struct pmc_heap * pmc_heapptr;
index 894c6516960d3728a3379bb6006e1b5a35052adc..dc933ed0460e09d9d89b372824ed3fd8509cd235 100644 (file)
@@ -1,4 +1,7 @@
 #include "pmc_mark.h"
+#include "pmc_garbage.h"
+#include "multicoremgc.h"
+#include <stdlib.h>
 
 #define PMC_MARKOBJ(objptr) {void * marktmpptr=objptr; if (marktmpptr!=NULL) {pmc_markObj(marktmpptr);}}
 
index 2c1c8739869bd24aee96fe533d02778a9e94880a..dbe18924693ec9b516d0d6397573c164c4760741 100644 (file)
@@ -1,5 +1,8 @@
 #ifndef PMC_MARK_H
 #define PMC_MARK_H
+#include "multicore.h"
+#include "multicoregc.h"
+#include "structdefs.h"
 
 void pmc_markObj(struct ___Object___ *ptr);
 void pmc_scanPtrsInObj(void * ptr, int type);
index a939bf30c4bc15ecb74af63859fbed0cb067cb58..6179a3b7aaf37f74b64de17e36a15b9aef0b5246 100644 (file)
@@ -1,3 +1,4 @@
+#include "pmc_garbage.h"
 #include "pmc_mem.h"
 
 void * pmc_alloc(unsigned int * numbytesallocated, unsigned int minimumbytes) {
index 82fbcc1da9812a08c382a3142810289f5669e00f..c2d51b9f20b6304a0419922e34d2eef4cfaea146 100644 (file)
@@ -1,7 +1,8 @@
+#include <stdlib.h>
 #include "pmc_queue.h"
 
 void pmc_queueinit(struct pmc_queue *queue) {
-  queue->head=queue->tail=RUNMALLOC(struct pmc_queue_segment);
+  queue->head=queue->tail=RUNMALLOC(sizeof(struct pmc_queue_segment));
   queue->headindex=queue->tailindex=0;
 }
 
@@ -21,12 +22,12 @@ void * pmc_dequeue(struct pmc_queue *queue) {
     }
     //now try to decrement
     if (queue->tailindex!=queue->headindex) {
-      value=queue->tail[queue->tailindex];
+      value=queue->tail->objects[queue->tailindex];
       queue->tailindex++;
     }
   } while(false);
   tmc_spin_mutex_unlock(&queue->lock);
-  return status;
+  return value;
 }
 
 void pmc_enqueue(struct pmc_queue* queue, void *ptr) {
@@ -37,7 +38,7 @@ void pmc_enqueue(struct pmc_queue* queue, void *ptr) {
     queue->headindex++;
     return;
   } else {
-    struct pmc_queue_segment * seg=RUNMALLOC(struct pmc_queue_segment);
+    struct pmc_queue_segment * seg=RUNMALLOC(sizeof(struct pmc_queue_segment));
     seg->objects[0]=ptr;
     //simplify everything by grabbing a lock on segment change
     tmc_spin_mutex_lock(&queue->lock);
index 692019a71dd0a910e20c5b1c4a4ff7613c01db62..dda1350d35fc2eede430478ff92babd9a7f382aa 100644 (file)
@@ -1,5 +1,6 @@
 #ifndef PMC_QUEUE_H
 #define PMC_QUEUE_H
+#include "multicore.h"
 #include <tmc/spin.h>
 
 #define NUM_PMC_QUEUE_OBJECTS 256
@@ -14,7 +15,6 @@ struct pmc_queue {
   volatile int headindex;
   volatile int tailindex;
   tmc_spin_mutex_t lock;
-  tmc_spin_barrier_t barrier;
 };
 
 void * pmc_dequeue(struct pmc_queue *queue);
index c5dff1caf88054b48bbdd75d06fe8bc3539ac22d..be58e88cc30209b7d25b009f8c726537924b423f 100644 (file)
@@ -1,6 +1,9 @@
+#include <stdlib.h>
+#include "structdefs.h"
 #include "pmc_forward.h"
 #include "pmc_refupdate.h"
 
+
 #define pmcupdateObj(objptr) ((void *)((struct ___Object___ *)objptr)->marked)
 
 #define PMCUPDATEOBJ(obj) {void *updatetmpptr=obj; if (updatetmpptr!=NULL) {obj=pmcupdateObj(updatetmpptr);}}