unsigned int tt_size=tt_pointer[0];
int tt_i;
for(tt_i=1; tt_i<=tt_size; tt_i++) {
- unsigned int tt_offset=tt_pointer[i];
+ unsigned int tt_offset=tt_pointer[tt_i];
void * objptr=*((void **)(((char *)origptr)+tt_offset));
if((objptr!= 0) &&
((gcmappingtbl[OBJMAPPINGINDEX((unsigned int)objptr)] == 0) ||
if((objptr != 0) &&
(gcmappingtbl[OBJMAPPINGINDEX((unsigned int)objptr)] == 0)) {
tprintf("Error moveobj, missing live obj ++: %x, %x, %d, %d, %d, %d, %d, %d, %d, %d \n",
- (int)origptr, (int)objptr, __LINE__, tt_i,
+ (int)origptr, (int)objptr, __LINE__, tt_j,
((int *)(origptr))[0], ((int *)(objptr))[0],
((int *)(objptr))[BAMBOOMARKBIT],
gcmappingtbl[OBJMAPPINGINDEX((unsigned int)objptr)],
unsigned int tt_size=tt_pointer[0];
int tt_i;
for(tt_i=1; tt_i<=tt_size; tt_i++) {
- unsigned int tt_offset=tt_pointer[i];
+ unsigned int tt_offset=tt_pointer[tt_i];
void * objptr=*((void **)(((char *)origptr)+tt_offset));
if((objptr!= 0) &&
((gcmappingtbl[OBJMAPPINGINDEX((unsigned int)objptr)] == 0) ||
}
}
#ifdef GC_TBL_DEBUG
- tprintf("finish mark %x \n", (int)gcmarkedptrbound);
+ //tprintf("finish mark %x \n", (int)gcmarkedptrbound);
#endif
#ifdef GC_CACHE_ADAPT
// end of an to page, wrap up its information
#endif
GC_BAMBOO_DEBUGPRINT(0xe30a);
GC_BAMBOO_DEBUGPRINT_REG(ptr);
- GC_BAMBOO_DEBUGPRINT_REG(tptr);
- GC_BAMBOO_DEBUGPRINT_REG(((int *)(tptr))[0]);
+ GC_BAMBOO_DEBUGPRINT_REG(((int *)(ptr))[0]);
if(ptr == NULL) {
BAMBOO_EXIT(0xb02a);
}
bamboo_smem_size = 0;
bamboo_smem_zero_top = NULL;
+ gcflag = false;
while(true) {
if(FINISHPHASE == gcphase) {
break;
bamboo_smem_size = 0;
bamboo_smem_zero_top = NULL;
+ gcflag = false;
while(true) {
if(FINISHPHASE == gcphase) {
break;
}
#endif
#endif
+ gcflag = false;
gccorestatus[BAMBOO_NUM_OF_CORE] = 1;
for(i = 1; i < NUMCORESACTIVE; ++i) {
// send gc finish messages to all cores
gccorestatus[i] = 1;
}
- gcflag = false;
gcprocessing = false;
+ if(gcflag) {
+ // inform other cores to stop and wait for gc
+ gcprecheck = true;
+ for(int i = 0; i < NUMCORESACTIVE; i++) {
+ // reuse the gcnumsendobjs & gcnumreceiveobjs
+ gccorestatus[i] = 1;
+ gcnumsendobjs[0][i] = 0;
+ gcnumreceiveobjs[0][i] = 0;
+ }
+ for(int i = 0; i < NUMCORESACTIVE; i++) {
+ if(i != BAMBOO_NUM_OF_CORE) {
+ send_msg_1(i, GCSTARTPRE, false);
+ }
+ }
+ }
#ifdef RAWPATH // TODO GC_DEBUG
printf("(%x,%x) gc finished \n", udn_tile_coord_x(),
udn_tile_coord_y());
#ifdef MULTICORE_GC
if(!gcflag) {
gcflag = true;
- // inform other cores to stop and wait for gc
- gcprecheck = true;
- for(int i = 0; i < NUMCORESACTIVE; i++) {
- // reuse the gcnumsendobjs & gcnumreceiveobjs
- gccorestatus[i] = 1;
- gcnumsendobjs[0][i] = 0;
- gcnumreceiveobjs[0][i] = 0;
- }
- for(int i = 0; i < NUMCORESACTIVE; i++) {
- if(i != BAMBOO_NUM_OF_CORE) {
- if(BAMBOO_CHECK_SEND_MODE()) {
- cache_msg_1(i, GCSTARTPRE);
- } else {
- send_msg_1(i, GCSTARTPRE, 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
+ gccorestatus[i] = 1;
+ gcnumsendobjs[0][i] = 0;
+ gcnumreceiveobjs[0][i] = 0;
+ }
+ for(int i = 0; i < NUMCORESACTIVE; i++) {
+ if(i != BAMBOO_NUM_OF_CORE) {
+ if(BAMBOO_CHECK_SEND_MODE()) {
+ cache_msg_1(i, GCSTARTPRE);
+ } else {
+ send_msg_1(i, GCSTARTPRE, true);
+ }
}
}
}
outmsgleft = 0;
isMsgHanging = false;
- smemflag = true;
+ smemflag = false;
bamboo_cur_msp = NULL;
bamboo_smem_size = 0;
int allocsize = 0;
void * mem = NULL;
#ifdef MULTICORE_GC
- if(gcprocessing) {
- // is currently doing gc, dump this msg if at the beginning of the gc
- // if at the end of the gc, send a msg with a block with size of -1
- // to ask the request core to send the mem request again
- if(FINISHPHASE == gcphase) {
- // if still in the finishphase of gc, send a memresponse msg with
- // invalid block: addr 0, size -1
- if(BAMBOO_CHECK_SEND_MODE()) {
- cache_msg_3(data2, MEMRESPONSE, 0, -1);
- } else {
- send_msg_3(data2, MEMRESPONSE, 0, -1, true);
- }
- } else if(INITPHASE == gcphase) {
- if(BAMBOO_CHECK_SEND_MODE()) {
- cache_msg_1(data2, GCSTARTINIT);
- } else {
- send_msg_1(data2, GCSTARTINIT, true);
- }
- }
+ if(gcprocessing && gcflag) {
+ // is currently doing GC and the master core does not decide to stop GC
+ // yet
} else {
+ // either not doing GC or the master core has decided to stop GC but
+ // still sending msgs to other cores to inform them to stop the GC
#endif
mem = smemalloc_I(data2, data1, &allocsize);
if(mem != NULL) {
#ifdef MULTICORE_GC
bamboo_smem_zero_top = 0;
#endif
- } else if(data2 == -1) {
- bamboo_smem_size = data2;
- bamboo_cur_msp = (void *)data1;
} else {
#ifdef MULTICORE_GC
// fill header to store the size of this mem block
}
smemflag = true;
#ifdef MULTICORE_GC
-}
+ }
#endif
}
#ifdef MULTICORE_GC
INLINE void processmsg_gcstartpre_I() {
- if(gcprocessing) {
+ if(gcprocessing && gcflag) {
// already stall for gc
} else {
// the first time to be informed to start gc
case GCFINISH: {
// received a GC finish msg
gcphase = FINISHPHASE;
- gcflag = false;
+ smemflag = false; // TODO
gcprocessing = false;
break;
} // case GCFINISH
int hasgc = 0;
memalloc:
BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT();
- if(gcflag) {
+ while(gcflag) {
BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
gc(stackptr);
BAMBOO_ENTER_RUNTIME_MODE_FROM_CLIENT();