}
void checkMarkStatus_p2() {
+ // tprintf("Check mark status 2\n");
// 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
unsigned int sumsendobj = 0;
}
}
if(i == NUMCORESACTIVE) {
+ //tprintf("Mark terminated\n");
// all the core status info are the latest,stop mark phase
gc_status_info.gcphase = COMPACTPHASE;
// restore the gcstatus for all cores
}
void checkMarkStatus() {
+ // tprintf("Check mark status\n");
if((!waitconfirm)||(waitconfirm && (numconfirm == 0))) {
unsigned int entry_index = 0;
if(waitconfirm) {
CACHEADAPT_OUTPUT_CACHE_POLICY();
gc_output_cache_policy_time += (BAMBOO_GET_EXE_TIME()-tmpt);
gcflag = false;
+
GC_SEND_MSG_1_TO_CLIENT(GCFINISH);
-
- gc_status_info.gcprocessing = false;
+ gc_status_info.gcprocessing = false;
+
if(gcflag) {
// inform other cores to stop and wait for gc
+ GC_PRINTF("Back to Back gc case\n");
gcprecheck = true;
for(int i = 0; i < NUMCORESACTIVE; i++) {
// reuse the gcnumsendobjs & gcnumreceiveobjs
}
void gc_master(struct garbagelist * stackptr) {
- tprintf("start GC !!!!!!!!!!!!! \n");
+ //tprintf("start GC !!!!!!!!!!!!! \n");
gc_status_info.gcprocessing = true;
gc_status_info.gcphase = INITPHASE;
initGC();
GC_SEND_MSG_1_TO_CLIENT(GCSTARTINIT);
CACHEADAPT_GC(true);
- GC_PRINTF("Check core status \n");
+ //tprintf("Check core status \n");
GC_CHECK_ALL_CORE_STATUS();
GCPROFILE_ITEM();
unsigned long long tmpt = BAMBOO_GET_EXE_TIME();
CACHEADAPT_OUTPUT_CACHE_SAMPLING();
gc_output_cache_policy_time += (BAMBOO_GET_EXE_TIME()-tmpt);
-
+ //tprintf("start mark phase\n");
// do mark phase
master_mark(stackptr);
-
+ //tprintf("finish mark phase\n");
// get large objects from all cores
master_getlargeobjs();
-
+ //tprintf("start compact phase\n");
// compact the heap
master_compact();
-
+ //tprintf("start update phase\n");
// update the references
master_updaterefs(stackptr);
- GC_PRINTF("gc master finished update \n");
+ //tprintf("gc master finished update \n");
// do cache adaptation
CACHEADAPT_PHASE_MASTER();
-
+ //tprintf("finish cachdapt phase\n");
// do finish up stuff
master_finish();
- GC_PRINTF("gc finished \n");
- tprintf("finish GC ! %d \n",gcflag);
+ //tprintf("finish GC ! %d \n",gcflag);
}
void pregccheck() {
pregcprocessing();
gc_master(stackptr);
} else if(BAMBOO_NUM_OF_CORE < NUMCORES4GC) {
+ GC_PRINTF("Core reporting for gc.\n");
pregcprocessing();
gc_collect(stackptr);
} else {
gc_nocollect(stackptr);
}
postgcprocessing();
-
return true;
}
unsigned int length=ALIGNSIZETOBYTES(objlength);
//code between this and next comment should be removed
+#ifdef GC_DEBUG
unsigned int size;
unsigned int type;
gettype_size(origptr, &type, &size);
unsigned INTPTR lobits=(alignsize&15)<<1;
tprintf("hibits=%x lobits=%x\n", hibits, lobits);
tprintf("hi=%x lo=%x\n", gcmarktbl[hibits], gcmarktbl[hibits+1]);
-
}
+#endif
//end of code to remove
void *endtoptr=toptr+length;
// compact phase
compact();
/* wait for all cores to finish compacting */
- tprintf("MASTER WAITING\n");
while(!gc_checkCoreStatus())
;
- tprintf("POST_WAIT\n");
GCPROFILE_ITEM();
//just in case we didn't get blocks back...
#define updateObj(objptr) gcmappingtbl[OBJMAPPINGINDEX(objptr)]
//#define UPDATEOBJ(obj) {void *updatetmpptr=obj; if (updatetmpptr!=NULL) obj=updateObj(updatetmpptr);if (obj<gcbaseva) tprintf("BAD PTR %x to %x in %u\n", updatetmpptr, obj, __LINE__);}
#define UPDATEOBJ(obj) {void *updatetmpptr=obj; if (updatetmpptr!=NULL) {obj=updateObj(updatetmpptr);}}
+
//if (obj==NULL) tprintf("Mapping problem for object %x, mark=%u, line=%u\n", updatetmpptr, getMarkedLength(updatetmpptr),__LINE__);}}
+
#define UPDATEOBJNONNULL(obj) {void *updatetmpptr=obj; obj=updateObj(updatetmpptr);}
//if (updatetmpptr!=NULL&&obj==NULL) tprintf("Mapping parameter for object %x, mark=%u, line=%u\n", updatetmpptr, getMarkedLength(updatetmpptr),__LINE__);}
unsigned int iunits = ALIGNUNITS(size);
//debugging for the next five lines
+#ifdef GC_DEBUG
unsigned INTPTR alignsize=ALIGNOBJSIZE((unsigned INTPTR)(ptr-gcbaseva));
unsigned INTPTR hibits=alignsize>>4;
unsigned INTPTR lobits=(alignsize&15)<<1;
unsigned INTPTR ohigh=gcmarktbl[hibits];
unsigned INTPTR olow=gcmarktbl[hibits+1];
+#endif
setLengthMarked(ptr,iunits);
+
+#ifdef GC_DEBUG
unsigned int unit=getMarkedLength(ptr);
if (unit!=iunits) {
tprintf("Bad mark on %x %u!=%u\n", ptr, unit, iunits);
unsigned INTPTR nlow=gcmarktbl[hibits+1];
tprintf("nhigh=%x nlow=%x", nhigh, nlow);
}
-
+#endif
if(islarge) {
// ptr is a large object and not marked or enqueued
printf("NEED TO SUPPORT LARGE OBJECTS!\n");