WAITFORGCPHASE(MARKPHASE);
GC_PRINTF("Start mark phase\n");
- GCPROFILE_ITEM();
-
mark(stackptr);
GC_PRINTF("Finish mark phase, start compact phase\n");
compact();
WAITFORGCPHASE(MARKPHASE);
GC_PRINTF("Start mark phase\n");
- GCPROFILE_ITEM();
mark(stackptr);
GC_PRINTF("Finish mark phase, wait for update\n");
void master_updaterefs(struct garbagelist * stackptr) {
gc_status_info.gcphase = UPDATEPHASE;
GC_SEND_MSG_1_TO_CLIENT(GCSTARTUPDATE);
- GCPROFILE_ITEM();
GC_PRINTF("Start update phase \n");
// update phase
update(stackptr);
unsigned long long tmpt = BAMBOO_GET_EXE_TIME();
CACHEADAPT_OUTPUT_CACHE_SAMPLING();
gc_output_cache_policy_time += (BAMBOO_GET_EXE_TIME()-tmpt);
- GCPROFILE_ITEM();
//tprintf("start mark phase\n");
// do mark phase
master_mark(stackptr);
+ GCPROFILE_ITEM();
//tprintf("finish mark phase\n");
// get large objects from all cores
master_getlargeobjs();
while(!gc_checkCoreStatus())
;
- GCPROFILE_START();
pregccheck();
+ GCPROFILE_START();
GC_PRINTF("start gc! \n");
pregcprocessing();
gc_master(stackptr);
if (allocationinfo.lowestfreeblock==NOFREEBLOCK)
allocationinfo.lowestfreeblock=numblockspercore*NUMCORES4GC;
+ // compute live object space
+ GCPROFILE_RECORD_SPACE();
GC_PRINTF("compact phase finished \n");
}
} else {
// ptr is an unmarked active object on this core
unsigned int isize=iunits<<ALIGNMENTSHIFT;
+ GCPROFILE_RECORD_LIVE_OBJ();
gccurr_heaptop += isize;
}
// scan the pointers in object
#define GCINFOLENGTH 100
#ifdef GC_CACHE_ADAPT
-#define GC_PROFILE_NUM_FIELD 20
+#define GC_PROFILE_NUM_FIELD 15
#else
-#define GC_PROFILE_NUM_FIELD 19
+#define GC_PROFILE_NUM_FIELD 14
#endif // GC_CACHE_ADAPT
typedef struct gc_info {
#define GCPROFILE_RECORD_SPACE() \
{ \
if(gc_profile_flag) { \
- gc_num_livespace = 0; \
- for(int tmpi = 0; tmpi < GCNUMBLOCK; tmpi++) { \
- gc_num_livespace += bamboo_smemtbl[tmpi]; \
+ gc_num_freespace = 0; \
+ block_t lowestblock=allocationinfo.lowestfreeblock; \
+ for(block_t searchblock=lowestblock;searchblock<GCNUMBLOCK;searchblock++) { \
+ struct blockrecord * block=&allocationinfo.blocktable[searchblock]; \
+ if (block->status==BS_FREE) { \
+ gc_num_freespace+=block->freespace&~BAMBOO_CACHE_LINE_MASK; \
+ } \
} \
- gc_num_freespace = (BAMBOO_SHARED_MEM_SIZE) - gc_num_livespace; \
+ gc_num_livespace = (BAMBOO_SHARED_MEM_SIZE) - gc_num_freespace; \
} \
}
// record forward obj info