changes
[IRC.git] / Robust / src / Runtime / bamboo / pmc_garbage.h
1 #ifndef PMC_GARBAGE_H
2 #define PMC_GARBAGE_H
3 #include <tmc/spin.h>
4 #include "pmc_queue.h"
5 #include "structdefs.h"
6
7 #define PMC_MINALLOC 131072
8 #define NUMPMCUNITS (4*NUMCORES4GC)
9 #define UNITSIZE (BAMBOO_SHARED_MEM_SIZE/NUMPMCUNITS)
10
11 struct pmc_unit {
12   tmc_spin_mutex_t lock;
13   unsigned int numbytes;
14   unsigned int regionnum;
15   void * endptr;
16 };
17
18 struct pmc_region {
19   void * allocptr;
20   void * lastptr;
21   void * startptr;
22   void * endptr;
23   unsigned int lowunit;
24   unsigned int highunit;
25   tmc_spin_mutex_t lock;
26   struct ___Object___ * lastobj;
27   struct pmc_queue markqueue;
28 };
29
30 struct pmc_heap {
31   struct pmc_unit units[NUMPMCUNITS];
32   struct pmc_region regions[NUMCORES4GC];
33   tmc_spin_mutex_t lock;
34   volatile unsigned int numthreads;
35   tmc_spin_barrier_t barrier;
36 };
37
38 extern struct pmc_heap * pmc_heapptr;
39 extern struct pmc_queue * pmc_localqueue;
40
41 void * pmc_unitend(unsigned int index);
42 void incrementthreads();
43 void decrementthreads();
44 void pmc_onceInit();
45 void pmc_init();
46 void gc(struct garbagelist *gl);
47 #endif