* 1b (size if always 1 * sizeof(int))
* 1c + size of msg + corenum + gcsendobjs + gcreceiveobjs
* (size is always 5 * sizeof(int))
- * 1d + obj's address
- * (size is always 2 * sizeof(int))
+ * 1d + obj's address + request core
+ * (size is always 3 * sizeof(int))
* 1e + corenum + start addr + end addr
* (size if always 4 * sizeof(int))
* 1f + obj's address + corenum
MEMREQUEST, // 0xE0
MEMRESPONSE, // 0xE1
#ifdef MULTICORE_GC
- GCSTARTINIT, // 0xE2
- GCSTART, // 0xE3
- GCSTARTCOMPACT, // 0xE4
- GCSTARTFLUSH, // 0xE5
- GCFINISHINIT, // 0xE6
- GCFINISHMARK, // 0xE7
- GCFINISHCOMPACT, // 0xE8
- GCFINISHFLUSH, // 0xE9
- GCFINISH, // 0xEa
- GCMARKCONFIRM, // 0xEb
- GCMARKREPORT, // 0xEc
- GCMARKEDOBJ, // 0xEd
- GCMOVESTART, // 0xEe
- GCMAPREQUEST, // 0xEf
- GCMAPINFO, // 0xF0
- GCLOBJREQUEST, // 0xF1
- GCLOBJINFO, // 0xF2
- GCLOBJMAPPING, // 0xF3
+ GCSTARTPRE, // 0xE2
+ GCSTARTINIT, // 0xE3
+ GCSTART, // 0xE4
+ GCSTARTCOMPACT, // 0xE5
+ GCSTARTMAPINFO, // 0xE6
+ GCSTARTFLUSH, // 0xE7
+ GCFINISHPRE, // 0xE8
+ GCFINISHINIT, // 0xE9
+ GCFINISHMARK, // 0xEa
+ GCFINISHCOMPACT, // 0xEb
+ GCFINISHMAPINFO, // 0xEc
+ GCFINISHFLUSH, // 0xEd
+ GCFINISH, // 0xEe
+ GCMARKCONFIRM, // 0xEf
+ GCMARKREPORT, // 0xF0
+ GCMARKEDOBJ, // 0xF1
+ GCMOVESTART, // 0xF2
+ GCMAPREQUEST, // 0xF3
+ GCMAPINFO, // 0xF4
+ GCMAPTBL, // 0xF5
+ GCLOBJREQUEST, // 0xF6
+ GCLOBJINFO, // 0xF7
+ GCLOBJMAPPING, // 0xF8
+#ifdef GC_PROFILE
+ GCPROFILES, // 0xF9
+#endif
+#ifdef GC_CACHE_ADAPT
+ GCSTARTPOSTINIT, // 0xFa
+ GCSTARTPREF, // 0xFb
+ GCFINISHPOSTINIT, // 0xFc
+ GCFINISHPREF, // 0xFd
+#endif // GC_CACHE_ADAPT
#endif
MSGEND
} MSGTYPE;
#define BAMBOO_BASE_VA 0xd000000
#endif // MULTICORE_GC
#endif // TILERA_BME
+
+#ifdef BAMBOO_MEMPROF
+#define GC_BAMBOO_NUMCORES 56
+#else
+#define GC_BAMBOO_NUMCORES 62
+#endif
+
#ifdef GC_DEBUG
#include "structdefs.h"
#define BAMBOO_NUM_PAGES (NUMCORES4GC*(2+1)+3)
#define BAMBOO_SMEM_SIZE (64 * 64) // (BAMBOO_PAGE_SIZE)
#define BAMBOO_SHARED_MEM_SIZE ((BAMBOO_PAGE_SIZE) *(BAMBOO_NUM_PAGES))
#else
-#define BAMBOO_NUM_PAGES (15 * 1024) //(64 * 4 * 0.75) //(1024 * 1024 * 3.5) 3G
-#define BAMBOO_PAGE_SIZE (16 * 1024) // * 1024) // (4096)
-#define BAMBOO_SMEM_SIZE (16 * 1024)
-#define BAMBOO_SHARED_MEM_SIZE (1024 * 1024 * 240) //(1024 * 1024 * 1024)
-//(3.0 * 1024 * 1024 * 1024) // 3G// ((BAMBOO_PAGE_SIZE) * (BAMBOO_NUM_PAGES))
+#ifdef GC_LARGESHAREDHEAP
+#define BAMBOO_NUM_PAGES ((GC_BAMBOO_NUMCORES)*(2+2))
+#elif defined GC_LARGESHAREDHEAP2
+#define BAMBOO_NUM_PAGES ((GC_BAMBOO_NUMCORES)*(2+2))
+#else
+#define BAMBOO_NUM_PAGES ((GC_BAMBOO_NUMCORES)*(2+3)) //(15 * 1024) //(64 * 4 * 0.75) //(1024 * 1024 * 3.5) 3G
+#endif
+#ifdef GC_LARGEPAGESIZE
+#define BAMBOO_PAGE_SIZE (4 * 1024 * 1024) // (4096)
+#define BAMBOO_SMEM_SIZE (4 * 1024 * 1024)
+#elif defined GC_SMALLPAGESIZE
+#define BAMBOO_PAGE_SIZE (256 * 1024) // (4096)
+#define BAMBOO_SMEM_SIZE (256 * 1024)
+#elif defined GC_SMALLPAGESIZE2
+#define BAMBOO_PAGE_SIZE (64 * 1024) // (4096)
+#define BAMBOO_SMEM_SIZE (64 * 1024)
+#else
+#define BAMBOO_PAGE_SIZE (1024 * 1024) // (4096)
+#define BAMBOO_SMEM_SIZE (1024 * 1024)
+#endif // GC_LARGEPAGESIZE
+#define BAMBOO_SHARED_MEM_SIZE ((BAMBOO_PAGE_SIZE) * (BAMBOO_NUM_PAGES)) //(1024 * 1024 * 240)
+//((unsigned long long int)(3.0 * 1024 * 1024 * 1024)) // 3G
#endif // GC_DEBUG
+#ifdef MULTICORE_GC
+volatile bool gc_localheap_s;
+#endif
+
#ifdef MULTICORE_GC
#include "multicoregarbage.h"
typedef enum {
- SMEMLOCAL = 0x0, // 0x0, using local mem only
- SMEMFIXED, // 0x1, use local mem in lower address space(1 block only)
- // and global mem in higher address space
- SMEMMIXED, // 0x2, like FIXED mode but use a threshold to control
- SMEMGLOBAL, // 0x3, using global mem only
+ SMEMLOCAL = 0x0,// 0x0, using local mem only
+ SMEMFIXED, // 0x1, use local mem in lower address space(1 block only)
+ // and global mem in higher address space
+ SMEMMIXED, // 0x2, like FIXED mode but use a threshold to control
+ SMEMGLOBAL, // 0x3, using global mem only
SMEMEND
} SMEMSTRATEGY;
struct freeMemList {
struct freeMemItem * head;
struct freeMemItem * backuplist; // hold removed freeMemItem for reuse;
- // only maintain 1 fremmMemItem
+ // only maintain 1 freemMemItem
};
// table recording the number of allocated bytes on each block
//struct freeMemList * bamboo_free_mem_list;
int bamboo_reserved_smem; // reserved blocks on the top of the shared heap
// e.g. 20% of the heap and should not be allocated
-// otherwise gc is invoked
+ // otherwise gc is invoked
+volatile INTPTR bamboo_smem_zero_top;
+#define BAMBOO_SMEM_ZERO_UNIT_SIZE (4 * 1024) // 4KB
#else
//volatile mspace bamboo_free_msp;
INTPTR bamboo_free_smemp;
// data structures for profile mode
#ifdef PROFILE
-#define TASKINFOLENGTH 30000
-#define INTERRUPTINFOLENGTH 500
+#define TASKINFOLENGTH 3000 // 0
+#ifdef PROFILE_INTERRUPT
+#define INTERRUPTINFOLENGTH 50 //0
+#endif // PROFILE_INTERRUPT
bool stall;
//bool isInterrupt;
struct Queue * newObjs;
} TaskInfo;
-// TODO
+TaskInfo * taskInfoArray[TASKINFOLENGTH];
+int taskInfoIndex;
+bool taskInfoOverflow;
+#ifdef PROFILE_INTERRUPT
typedef struct interrupt_info {
unsigned long long startTime;
unsigned long long endTime;
} InterruptInfo;
-TaskInfo * taskInfoArray[TASKINFOLENGTH];
-int taskInfoIndex;
-bool taskInfoOverflow;
-// TODO
InterruptInfo * interruptInfoArray[INTERRUPTINFOLENGTH];
int interruptInfoIndex;
bool interruptInfoOverflow;
+#endif // PROFILE_INTERUPT
volatile int profilestatus[NUMCORESACTIVE]; // records status of each core
// 1: running tasks
// 0: stall
INLINE void fakeExecution(void);
INLINE void terminate(void);
INLINE void initlock(struct ___Object___ * v);
+#ifdef BAMBOO_MEMPROF
+INLINE void terminatememprof(void);
+#endif
// lock related functions
bool getreadlock(void* ptr);
// request response //
// BAMBOO_LOCAL_MEM_CALLOC(x, y): allocate an array of x elements each of //
// whose size in bytes is y on local memory //
+// which is given by the hypervisor //
// BAMBOO_LOCAL_MEM_FREE(x): free space with ptr x on local memory //
// BAMBOO_LOCAL_MEM_CLOSE(): close the local heap //
+// BAMBOO_LOCAL_MEM_CALLOC_S(x, y): allocate an array of x elements each of//
+// whose size in bytes is y on local //
+// memory which is not from the hypervisor//
+// but is allocated from the free memory //
+// BAMBOO_LOCAL_MEM_FREE_S(x): free space with ptr x on self-allocated //
+// local memory //
+// BAMBOO_LOCAL_MEM_CLOSE_S(): close the self-allocated local heap //
// BAMBOO_SHARE_MEM_CALLOC_I(x, y): allocate an array of x elements each of//
// whose size in bytes is y on shared memory//
-// BAMBOO_SHARE_MEM_CLOSE(): close the shared heap //
+// BAMBOO_SHARE_MEM_CLOSE(): close the shared heap //
// BAMBOO_CACHE_LINE_SIZE: the cache line size //
// BAMBOO_CACHE_LINE_MASK: mask for a cache line //
// BAMBOO_CACHE_FLUSH_RANGE(x, y): flush cache lines started at x with //
// hint, the processor will not fetch the //
// current content of the memory and directly //
// write //
+// BAMBOO_CLEAN_DTLB(): zero-out all the dtlb entries //
+// BAMBOO_CACHE_FLUSH_L2(): Flush the contents of this tile's L2 back to //
+// main memory //
/////////////////////////////////////////////////////////////////////////////
#endif // #ifdef MULTICORE