//System.printString("task t1\n");
int threadnum = 62; // 56;
- int ncities = 4080;
+ int ncities = 4080*2;
for(int i = 0; i < threadnum; ++i) {
TestRunner tr = newflag TestRunner(ncities){run};
}
gcheadindex=gctailindex=gctailindex2 = 0;
gchead=gctail=gctail2=RUNMALLOC(sizeof(struct pointerblock));
} else {
- gctailindex = gctailindex2 = gcheadindex = 0;
- gctail = gctail2 = gchead;
+ gctailindex=gctailindex2=gcheadindex=0;
+ gctail=gctail2=gchead;
}
+ gchead->next=NULL;
// initialize the large obj queues
if (gclobjhead==NULL) {
gclobjheadindex=0;
gclobjtailindex=0;
- gclobjtailindex2 = 0;
+ gclobjtailindex2=0;
gclobjhead=gclobjtail=gclobjtail2=
- RUNMALLOC(sizeof(struct lobjpointerblock));
+ RUNMALLOC(sizeof(struct lobjpointerblock));
} else {
- gclobjtailindex = gclobjtailindex2 = gclobjheadindex = 0;
- gclobjtail = gclobjtail2 = gclobjhead;
+ gclobjtailindex=gclobjtailindex2=gclobjheadindex=0;
+ gclobjtail=gclobjtail2=gclobjhead;
}
- gclobjhead->next = gclobjhead->prev = NULL;
+ gclobjhead->next=gclobjhead->prev=NULL;
freeMGCHash(gcforwardobjtbl);
gcforwardobjtbl = allocateMGCHash(20, 3);
gcnumsendobjs[entry_index][BAMBOO_NUM_OF_CORE] = gcself_numsendobjs;
gcnumreceiveobjs[entry_index][BAMBOO_NUM_OF_CORE] = gcself_numreceiveobjs;
// check the status of all cores
- bool allStall = gc_checkAllCoreStatus_I();
- if(allStall) {
+ if(gc_checkAllCoreStatus_I()) {
// ask for confirm
if(!waitconfirm) {
// the first time found all cores stall
INLINE void gc_collect(struct garbagelist * stackptr) {
gcprocessing = true;
- tprintf("gc \n");
// inform the master that this core is at a gc safe point and is ready to
// do gc
send_msg_4(STARTUPCORE, GCFINISHPRE, BAMBOO_NUM_OF_CORE, self_numsendobjs,
INLINE void gc_nocollect(struct garbagelist * stackptr) {
gcprocessing = true;
- tprintf("gc \n");
// inform the master that this core is at a gc safe point and is ready to
// do gc
send_msg_4(STARTUPCORE, GCFINISHPRE, BAMBOO_NUM_OF_CORE, self_numsendobjs,
GCPROFILE_ITEM();
CACHEADAPT_OUTPUT_CACHE_SAMPLING();
- GC_PRINTF("(%x,%x) Start mark phase \n");
+ GC_PRINTF("Start mark phase \n");
GC_SEND_MSG_1_TO_CLIENT(GCSTART);
gcphase = MARKPHASE;
// mark phase
if(isfirst) {
isfirst = false;
}
-
+
// check gcstatus
checkMarkStatue();
}
} \
}
-// send a 1-word msg to all client
+// send a 1-word msg to all clients
#define GC_SEND_MSG_1_TO_CLIENT(m) \
{ \
for(int i = 0; i < NUMCORESACTIVE; ++i) { \
+ gccorestatus[i] = 1; \
if(BAMBOO_NUM_OF_CORE != i) { \
send_msg_1(i, (m), false); \
} \
- gccorestatus[i] = 1; \
} \
}
gcspare->next = NULL;
}
}
- int loopiter = 0;
return gctail->ptrs[gctailindex++];
}
gctail2=gctail2->next;
gctailindex2=0;
}
- int loopiter = 0;
return gctail2->ptrs[gctailindex2++];
}
/* Array of primitives */
pointer=pointerarray[OBJECTTYPE];
//handle object class
- unsigned int size=pointer[0];
+ int size=pointer[0];
int i;
for(i=1; i<=size; i++) {
unsigned int offset=pointer[i];
{
pointer=pointerarray[OBJECTTYPE];
//handle object class
- unsigned int size=pointer[0];
+ int size=pointer[0];
int i;
for(i=1; i<=size; i++) {
unsigned int offset=pointer[i];
}
}
} else {
- unsigned int size=pointer[0];
+ int size=pointer[0];
int i;
for(i=1; i<=size; i++) {
unsigned int offset=pointer[i];
bool sendStall = false;
// mark phase
while(MARKPHASE == gcphase) {
+ int counter = 0;
while(true) {
BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT();
if(!gc_moreItems2_I()) {
if(mem == NULL) {
// no enough shared global memory
*allocsize = 0;
- if(!gcflag) {
- gcflag = true;
- if(!gcprocessing) {
- // inform other cores to stop and wait for gc
- gcprecheck = true;
- for(int i = 0; i < NUMCORESACTIVE; i++) {
- // reuse the gcnumsendobjs & gcnumreceiveobjs
- gcnumsendobjs[0][i] = 0;
- gcnumreceiveobjs[0][i] = 0;
+ if(!gcflag) {
+ gcflag = true;
+ if(!gcprocessing) {
+ // inform other cores to stop and wait for gc
+ gcprecheck = true;
+ for(int i = 0; i < NUMCORESACTIVE; i++) {
+ // reuse the gcnumsendobjs & gcnumreceiveobjs
+ gcnumsendobjs[0][i] = 0;
+ gcnumreceiveobjs[0][i] = 0;
+ }
+ GC_SEND_MSG_1_TO_CLIENT(GCSTARTPRE);
}
- GC_SEND_MSG_1_TO_CLIENT(GCSTARTPRE);
- }
- }
- return NULL;
+ }
+ return NULL;
}
return mem;
}
#define BAMBOO_PAGE_SIZE ((unsigned int)(256 * 1024)) // (4096)
#define BAMBOO_SMEM_SIZE ((unsigned int)(BAMBOO_PAGE_SIZE))
#elif defined GC_SMALLPAGESIZE2
-#define BAMBOO_PAGE_SIZE ((unsigned int)(64 * 1024)) // (4096)
+#define BAMBOO_PAGE_SIZE ((unsigned int)(256 * 1024)) // (4096) 64
#define BAMBOO_SMEM_SIZE ((unsigned int)(BAMBOO_PAGE_SIZE))
#else
#define BAMBOO_PAGE_SIZE ((unsigned int)(1024 * 1024)) // (4096)
#ifdef MULTICORE_GC
INLINE void processmsg_gcstartpre_I() {
- // the first time to be informed to start gc
- tprintf("pre msg \n");
+ // the first time to be informed to start gc
gcflag = true;
if(!smemflag) {
// Zero out the remaining memory here because for the GC_CACHE_ADAPT
if(receiveMsg(send_port_pending) == -1) {
return -1;
}
+ if(BAMBOO_CHECK_SEND_MODE()) {
+ // during send, don't process the msg now
+ return -3;
+ }
processmsg:
// processing received msgs
int size = 0;
}
INLINE void checkCoreStatus() {
- bool allStall = false;
int i = 0;
int sumsendobj = 0;
if((!waitconfirm) ||
numsendobjs[BAMBOO_NUM_OF_CORE] = self_numsendobjs;
numreceiveobjs[BAMBOO_NUM_OF_CORE] = self_numreceiveobjs;
// check the status of all cores
- allStall = true;
for(i = 0; i < NUMCORESACTIVE; ++i) {
if(corestatus[i] != 0) {
- allStall = false;
break;
}
}
- if(allStall) {
+ if(i == NUMCORESACTIVE) {
// check if the sum of send objs and receive obj are the same
// yes->check if the info is the latest; no->go on executing
sumsendobj = 0;
corestatus[i] = 1;
// send status confirm msg to core i
send_msg_1(i, STATUSCONFIRM, false);
- } // for(i = 1; i < NUMCORESACTIVE; ++i)
+ }
return;
} else {
// all the core status info are the latest
disruntimedata();
BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
terminate(); // All done.
- } // if(!waitconfirm)
+ }
} else {
// still some objects on the fly on the network
// reset the waitconfirm and numconfirm
waitconfirm = false;
numconfirm = 0;
- } // if(0 == sumsendobj)
+ }
} else {
// not all cores are stall, keep on waiting
waitconfirm = false;
numconfirm = 0;
- } // if(allStall)
+ }
BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
- } // if((!waitconfirm) ||
+ }
}
// main function for each core
}
}
}
-} // run()
+}
#endif // MULTICORE