bug fixes
[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 PMC_MINALLOC 2048
9 #define NUMPMCUNITS (4*NUMCORES4GC)
10 #define UNITSIZE (BAMBOO_SHARED_MEM_SIZE/NUMPMCUNITS)
11
12 struct pmc_unit {
13   tmc_spin_mutex_t lock;
14   unsigned int numbytes;
15   unsigned int regionnum;
16   void * endptr;
17 };
18
19 struct pmc_region {
20   void * allocptr;
21   void * lastptr;
22   void * startptr;
23   void * endptr;
24   unsigned int lowunit;
25   unsigned int highunit;
26   tmc_spin_mutex_t lock;
27   struct ___Object___ * lastobj;
28   struct pmc_queue markqueue;
29 };
30
31 struct pmc_heap {
32   struct pmc_unit units[NUMPMCUNITS];
33   struct pmc_region regions[NUMCORES4GC];
34   tmc_spin_mutex_t lock;
35   volatile unsigned int numthreads;
36   tmc_spin_barrier_t barrier;
37 };
38
39 extern struct pmc_heap * pmc_heapptr;
40 extern struct pmc_queue * pmc_localqueue;
41
42 void padspace(void *ptr, unsigned int length);
43 void * pmc_unitend(unsigned int index);
44 void incrementthreads();
45 void decrementthreads();
46 void pmc_onceInit();
47 void pmc_init();
48 void gc(struct garbagelist *gl);
49 #endif