+#include "runtime.h"
+#include "multicoremem.h"
+#include "multicoregarbage.h"
#include "markbit.h"
unsigned int markmappingarray[]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
val=gcmarktbl[hibits];
else {
unsigned INTPTR revlobits=32-lobits;
- unsigned INTPTR val=(gcmarktbl[hibits]<<lobits)
- |(gcmarktbl[hibits+1]>>(revlobits));
+ val=(gcmarktbl[hibits]<<lobits)|(gcmarktbl[hibits+1]>>(revlobits));
}
unsigned int index=val>>26;
if (index>48)
}
}
-INLINE static void completePageConvert(struct moveHelper * orig,struct moveHelper * to,unsigned int current_ptr,bool closeToPage) {
+INLINE static void completePageConvert(struct moveHelper * orig,struct moveHelper * to, void * current_ptr,bool closeToPage) {
void *ptr;
void *tocompare;
if(closeToPage) {
gcself_numreceiveobjs = 0;
gcmarkedptrbound = 0;
gcforwardobjtbl = allocateMGCHash_I(128);
- gcnumlobjs = 0;
gcheaptop = 0;
gctopcore = 0;
gctopblock = 0;
gcself_numsendobjs = 0;
gcself_numreceiveobjs = 0;
gcmarkedptrbound = 0;
- gcnumlobjs = 0;
gcmovestartaddr = 0;
gctomove = false;
gcblock2fill = 0;
GC_PRINTF("Start flush phase\n");
GCPROFILE_INFO_2_MASTER();
- flush(stackptr);
+ update(stackptr);
GC_PRINTF("Finish flush phase\n");
CACHEADAPT_PHASE_CLIENT();
GC_PRINTF("Start flush phase\n");
GCPROFILE_INFO_2_MASTER();
- flush(stackptr);
+ update(stackptr);
GC_PRINTF("Finish flush phase\n");
CACHEADAPT_PHASE_CLIENT();
GCPROFILE_ITEM();
GC_PRINTF("Start flush phase \n");
// flush phase
- flush(stackptr);
+ update(stackptr);
GC_CHECK_ALL_CORE_STATUS(UPDATEPHASE==gc_status_info.gcphase);
GC_PRINTF("Finish flush phase \n");
}
/* Number of bits used for each alignment unit */
-//Takes in size and converts into alignment units
-#define ALIGNOBJSIZE(x) (x>>ALIGNMENTSHIFT)
-
//Takes in pointer to heap object and converts to offset in alignment units
#define OBJMAPPINGINDEX(p) ALIGNOBJSIZE((unsigned INTPTR)(p-gcbaseva))
/* Should be invoked with interrupt turned off. */
-unsigned int assignSpareMem_I(unsigned int sourcecore, unsigned int requiredmem, void ** tomove, void ** startaddr) {
- unsigned int blockindex;
- BLOCKINDEX(blockindex, topptrs[sourcecore]);
- void * boundptr = BOUNDPTR(blockindex);
- unsigned INTPTR remain = (unsigned INTPTR) (boundptr - topptrs[sourcecore]);
- unsigned int memneed = requiredmem + BAMBOO_CACHE_LINE_SIZE;
- *startaddr = topptrs[sourcecore];
- *tomove = gcfilledblocks[sourcecore] + 1;
- if(memneed < remain) {
- topptrs[sourcecore] += memneed;
- return 0;
- } else {
- // next available block
- gcfilledblocks[sourcecore]++;
- void * newbase = NULL;
- BASEPTR(newbase, sourcecore, gcfilledblocks[sourcecore]);
- topptrs[sourcecore] = newbase;
- return requiredmem-remain;
- }
+void * assignSpareMem_I(unsigned int sourcecore, unsigned int requiredmem) {
+ return NULL;
}
-unsigned int assignSpareMem(unsigned int sourcecore,unsigned int requiredmem,unsigned int * tomove, void ** startaddr) {
+void * assignSpareMem(unsigned int sourcecore,unsigned int requiredmem) {
BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT();
- int retval=assignSpareMem_I(sourcecore, requiredmem, tomove, startaddr);
+ void * retval=assignSpareMem_I(sourcecore, requiredmem);
BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
return retval;
}
for(int k = 0; k < NUMCORES4GC; k++) {
if((gccorestatus[k] == 0) && (gcfilledblocks[k] < gcstopblock[k])) {
// check if this stopped core has enough mem
- assignSpareMem_I(k, requiredmem, tomove, &startaddr);
+ startaddr=assignSpareMem_I(k, requiredmem);
return startaddr;
}
}
struct moveHelper to={0,NULL,NULL,0,NULL,0,0,0,0};
initOrig_Dst(&orig, &to);
- CACHEADAPT_SAMPLING_DATA_REVISE_INIT(orig, to);
+ CACHEADAPT_SAMPLING_DATA_REVISE_INIT(&orig, &to);
compacthelper(&orig, &to);
}
while(MARKPHASE == gc_status_info.gcphase) {
int counter = 0;
- while(gc_moreItems2()) {
+ while(gc_moreItems()) {
sendStall = false;
gc_status_info.gcbusystatus = true;
- void * ptr = gc_dequeue2();
+ void * ptr = gc_dequeue();
unsigned int size = 0;
unsigned int type = 0;
if(islarge) {
// ptr is a large object and not marked or enqueued
- gc_lobjenqueue(ptr, size, BAMBOO_NUM_OF_CORE);
- gcnumlobjs++;
+ printf("NEED TO SUPPORT LARGE OBJECTS!\n");
} else {
// ptr is an unmarked active object on this core
unsigned int isize=iunits<<ALIGNMENTSHIFT;
// Zero out the remaining bamboo_cur_msp. Only zero out the first 4 bytes
// of the remaining memory
-#define BAMBOO_CLOSE_CUR_MSP() \
- { \
- if((bamboo_cur_msp!=0)&&(bamboo_smem_zero_top==bamboo_cur_msp) \
- &&(bamboo_smem_size>0)) { \
- *((int *)bamboo_cur_msp) = 0; \
- } \
+#define BAMBOO_CLOSE_CUR_MSP() \
+ { \
+ if((bamboo_cur_msp!=NULL)&&(bamboo_smem_zero_top==bamboo_cur_msp) \
+ &&(bamboo_smem_size>0)) { \
+ *bamboo_cur_msp = NULL; \
+ } \
}
// table recording the number of allocated bytes on each block
int bamboo_free_smem_size;
#endif // MULTICORE_GC
volatile bool smemflag;
-volatile unsigned int bamboo_cur_msp;
+volatile unsigned int * bamboo_cur_msp;
volatile int bamboo_smem_size;
#endif // BAMBOO_MULTICORE_MEM_H
#include "multicoretaskprofile.h"
#include "gcqueue.h"
#include "runtime_arch.h"
+#include "markbit.h"
int msgsizearray[] = {
0, //MSGSTART,
bamboo_smem_zero_top = NULL;
#endif
bamboo_smem_size = 0;
- bamboo_cur_msp = 0;
+ bamboo_cur_msp = NULL;
} else {
#ifdef MULTICORE_GC
- CLOSEBLOCK(data1, data2);
+ //CLOSEBLOCK(data1, data2);
bamboo_smem_size = data2 - BAMBOO_CACHE_LINE_SIZE;
bamboo_cur_msp = data1 + BAMBOO_CACHE_LINE_SIZE;
bamboo_smem_zero_top = bamboo_cur_msp;
INLINE void processmsg_gcmarkconfirm_I() {
BAMBOO_ASSERT(((BAMBOO_NUM_OF_CORE!=STARTUPCORE)&&(BAMBOO_NUM_OF_CORE<=NUMCORESACTIVE-1)));
- gc_status_info.gcbusystatus = gc_moreItems2_I();
+ gc_status_info.gcbusystatus = gc_moreItems_I();
// send response msg, cahce the msg first
if(BAMBOO_CHECK_SEND_MODE()) {
cache_msg_5_I(STARTUPCORE,GCMARKREPORT,BAMBOO_NUM_OF_CORE,gc_status_info.gcbusystatus,gcself_numsendobjs,gcself_numreceiveobjs);