From 1fc8228b762f4c5f6124ca43244c615db6b042e9 Mon Sep 17 00:00:00 2001 From: jzhou Date: Tue, 21 Sep 2010 22:08:15 +0000 Subject: [PATCH] fix performance bug --- Robust/src/Runtime/bamboo/multicoregarbage.c | 58 ++++++++++---------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.c b/Robust/src/Runtime/bamboo/multicoregarbage.c index e84afc67..9f6f714f 100644 --- a/Robust/src/Runtime/bamboo/multicoregarbage.c +++ b/Robust/src/Runtime/bamboo/multicoregarbage.c @@ -2114,6 +2114,7 @@ innermoveobj: to->ptr += isize; to->offset += isize; to->top += isize; +#if 0 #ifdef GC_CACHE_ADAPT int tmp_ptr = to->ptr; #endif // GC_CACHE_ADAPT @@ -2122,35 +2123,36 @@ innermoveobj: BAMBOO_MEMSET_WH(to->base, '\0', BAMBOO_CACHE_LINE_SIZE); (*((int*)(to->base))) = to->offset; nextBlock(to); - } #ifdef GC_CACHE_ADAPT - if((to->base+to->bound) >= gc_cache_revise_infomation.to_page_end_va) { - // end of an to page, wrap up its information - int tmp_factor = tmp_ptr-gc_cache_revise_infomation.to_page_start_va; - int topage=gc_cache_revise_infomation.to_page_index; - int oldpage = gc_cache_revise_infomation.orig_page_index; - int * newtable=&gccachesamplingtbl_r[topage]; - int * oldtable=&gccachesamplingtbl[oldpage]; - - for(int tt = 0; tt < NUMCORESACTIVE; tt++) { - (*newtable)=((*newtable)+(*oldtable)*tmp_factor); - newtable=(int*) (((char *)newtable)+size_cachesamplingtbl_local_r); - oldtable=(int*) (((char *)oldtable)+size_cachesamplingtbl_local); - } - // prepare for an new to page - int tmp_index = (orig->ptr-gcbaseva)/(BAMBOO_PAGE_SIZE); - gc_cache_revise_infomation.orig_page_start_va = orig->ptr; - gc_cache_revise_infomation.orig_page_end_va = gcbaseva + - (BAMBOO_PAGE_SIZE)*((orig->ptr-gcbaseva)/(BAMBOO_PAGE_SIZE)+1); - gc_cache_revise_infomation.orig_page_index = - (orig->ptr-gcbaseva)/(BAMBOO_PAGE_SIZE); - gc_cache_revise_infomation.to_page_start_va = to->ptr; - gc_cache_revise_infomation.to_page_end_va = gcbaseva + - (BAMBOO_PAGE_SIZE)*((to->ptr-gcbaseva)/(BAMBOO_PAGE_SIZE)+1); - gc_cache_revise_infomation.to_page_index = + if((to->base+to->bound) >= gc_cache_revise_infomation.to_page_end_va) { + // end of an to page, wrap up its information + int tmp_factor = tmp_ptr-gc_cache_revise_infomation.to_page_start_va; + int topage=gc_cache_revise_infomation.to_page_index; + int oldpage = gc_cache_revise_infomation.orig_page_index; + int * newtable=&gccachesamplingtbl_r[topage]; + int * oldtable=&gccachesamplingtbl[oldpage]; + + for(int tt = 0; tt < NUMCORESACTIVE; tt++) { + (*newtable)=((*newtable)+(*oldtable)*tmp_factor); + newtable=(int*) (((char *)newtable)+size_cachesamplingtbl_local_r); + oldtable=(int*) (((char *)oldtable)+size_cachesamplingtbl_local); + } + // prepare for an new to page + int tmp_index = (orig->ptr-gcbaseva)/(BAMBOO_PAGE_SIZE); + gc_cache_revise_infomation.orig_page_start_va = orig->ptr; + gc_cache_revise_infomation.orig_page_end_va = gcbaseva + + (BAMBOO_PAGE_SIZE)*((orig->ptr-gcbaseva)/(BAMBOO_PAGE_SIZE)+1); + gc_cache_revise_infomation.orig_page_index = + (orig->ptr-gcbaseva)/(BAMBOO_PAGE_SIZE); + gc_cache_revise_infomation.to_page_start_va = to->ptr; + gc_cache_revise_infomation.to_page_end_va = gcbaseva + + (BAMBOO_PAGE_SIZE)*((to->ptr-gcbaseva)/(BAMBOO_PAGE_SIZE)+1); + gc_cache_revise_infomation.to_page_index = (to->ptr-gcbaseva)/(BAMBOO_PAGE_SIZE); - } + } #endif // GC_CACHE_ADAPT + } +#endif } // if(mark == 1) #ifdef DEBUG BAMBOO_DEBUGPRINT(0xe205); @@ -3335,9 +3337,9 @@ void cacheAdapt_master() { int numchanged = 0; // check the statistic data // for each page, decide the new cache strategy - //numchanged = cacheAdapt_policy_h4h(); + numchanged = cacheAdapt_policy_h4h(); //numchanged = cacheAdapt_policy_local(); - numchanged = cacheAdapt_policy_hotest(); + //numchanged = cacheAdapt_policy_hotest(); //numchanged = cacheAdapt_policy_dominate(); //numchanged = cacheAdapt_policy_overload(); //numchanged = cacheAdapt_policy_crowd(); -- 2.34.1