1 #ifndef MULTICORE_GARBAGE_H
2 #define MULTICORE_GARBAGE_H
5 // data structures for GC
6 #define BAMBOO_NUM_PAGES 1024 * 512
7 #define BAMBOO_PAGE_SIZE 4096
8 #define BAMBOO_SHARED_MEM_SIZE BAMBOO_PAGE_SIZE * BAMBOO_PAGE_SIZE
9 #define BAMBOO_BASE_VA 0xd000000
10 #define BAMBOO_SMEM_SIZE 16 * BAMBOO_PAGE_SIZE
11 #define BAMBOO_SMEM_SIZE_L 512 * BAMBOO_PAGE_SIZE
12 #define BAMBOO_LARGE_SMEM_BOUND BAMBOO_SMEM_SIZE_L * NUMCORES // NUMCORES = 62
14 struct markedObjItem {
17 struct markedObjItem * next;
24 struct largeObjItem * next;
36 struct moveObj * tomoveobjs;
37 struct moveObj * incomingobjs;
38 struct largeObjItem * largeobjs;
42 MARKPHASE = 0x0, // 0x0
49 GCPHASETYPE gcphase; // indicating GC phase
50 bool gctomove; // flag indicating if can start moving objects to other cores
51 struct Queue * gcdsts;
52 struct Queue gctomark; // global queue of objects to mark
53 // for mark phase termination
54 int gccorestatus[NUMCORES]; // records status of each core
57 int gcnumsendobjs[NUMCORES]; // records how many objects a core has sent out
58 int gcnumreceiveobjs[NUMCORES]; // records how many objects a core has received
62 int gcself_numsendobjs;
63 int gcself_numreceiveobjs;
64 // compact instruction
65 struct compactInstr * cinstruction;
66 // mapping of old address to new address
67 struct genhashtable * pointertbl;
72 #define BLOCKNUM(p, b) \
73 if((p) < BAMBOO_LARGE_SMEM_BOUND) { \
74 (*((int*)b)) = (p) / BAMBOO_SMEM_SIZE_L; \
76 (*((int*)b)) = NUMCORES + ((p) - BAMBOO_LARGE_SMEM_BOUND) / BAMBOO_SMEM_SIZE; \
79 #define RESIDECORE(p, x, y) \
82 bool reverse = (b / NUMCORES) % 2; \
83 int l = b % NUMCORES; \
90 (*((int*)y)) = 7 - l / 8; \
97 (*((int*)y)) = l / 8; \
100 (*((int*)x)) = 1 - l % 8; \
102 (*((int*)x)) = l % 8; \
105 void gc(); // core coordinator routine
106 void gc_collect(); // core collector routine
107 void transferMarkResults();