#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);
}
}
}
((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);
}
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
#include "pmc_garbage.h"
+#include "multicoregc.h"
+#inclued "runtime_arch.h"
struct pmc_queue * pmc_localqueue;
#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)
};
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;
#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);}}
#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);
+#include "pmc_garbage.h"
#include "pmc_mem.h"
void * pmc_alloc(unsigned int * numbytesallocated, unsigned int minimumbytes) {
+#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;
}
}
//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) {
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);
#ifndef PMC_QUEUE_H
#define PMC_QUEUE_H
+#include "multicore.h"
#include <tmc/spin.h>
#define NUM_PMC_QUEUE_OBJECTS 256
volatile int headindex;
volatile int tailindex;
tmc_spin_mutex_t lock;
- tmc_spin_barrier_t barrier;
};
void * pmc_dequeue(struct pmc_queue *queue);
+#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);}}