my changes
authorjzhou <jzhou>
Tue, 21 Sep 2010 21:46:12 +0000 (21:46 +0000)
committerjzhou <jzhou>
Tue, 21 Sep 2010 21:46:12 +0000 (21:46 +0000)
Robust/src/Analysis/Scheduling/ScheduleAnalysis.java
Robust/src/Runtime/bamboo/multicoregarbage.c
Robust/src/Runtime/bamboo/multicoreruntime.h
Robust/src/Runtime/bamboo/multicoretask.c

index 44910e3d37a7ef5c80d0e6a81fa4a3ec7294d816..54586210dd7f1ac9463ed8b0adb0c159f04c14b7 100644 (file)
@@ -419,6 +419,7 @@ public class ScheduleAnalysis {
                       (cdname.equals("KMeans")) || 
                       (cdname.equals("ZTransform")) ||
                       (cdname.equals("TestRunner")) || 
+                                         (cdname.equals("TestRunner2")) ||
                       (cdname.equals("LinkList")) ||
                       (cdname.equals("BHRunner"))) {
                     newRate = this.coreNum;
index c80e7a7f2b1fe9a4c708de67e68560df53c9c33a..e84afc6754db148daf460a2e8fa0375bdf069c65 100644 (file)
@@ -1878,7 +1878,7 @@ inline bool initOrig_Dst(struct moveHelper * orig,
        ((to->base-gcbaseva)/(BAMBOO_PAGE_SIZE)+1);
   gc_cache_revise_infomation.to_page_index = 
        (to->base-gcbaseva)/(BAMBOO_PAGE_SIZE);
-  gc_cache_revise_infomation.orig_page_start_va = -1; 
+  gc_cache_revise_infomation.orig_page_start_va = -1;
 #endif // GC_CACHE_ADAPT
 
   // init the orig ptr
@@ -1961,22 +1961,23 @@ innermoveobj:
   if(orig->ptr >= gc_cache_revise_infomation.orig_page_end_va) {
        // end of an orig page
        // compute the impact of this page for the new page
-       int  tmp_factor = to->ptr-gc_cache_revise_infomation.to_page_start_va; 
-       int topage=gc_cache_revise_information.to_page_index;
+       int tmp_factor = to->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[gc_cache_revise_infomation.orig_page_index];
+       int * oldtable=&gccachesamplingtbl[oldpage];
        
        for(int tt = 0; tt < NUMCORESACTIVE; tt++) {
          (*newtable) += (*oldtable)*tmp_factor;
-         newtable=(int*) (((char *)newtable)+size_cachesamplingtbl_local_r);
-         oldtable=(int*) (((char *)oldtable)+size_cachesamplingtbl_local);
+         newtable=(int*)(((char *)newtable)+size_cachesamplingtbl_local_r);
+         oldtable=(int*)(((char *)oldtable)+size_cachesamplingtbl_local);
        }
        // prepare for an new orig 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);
+         (BAMBOO_PAGE_SIZE)*(tmp_index+1);
+       gc_cache_revise_infomation.orig_page_index = tmp_index;
        gc_cache_revise_infomation.to_page_start_va = to->ptr;
   }
 #endif
@@ -2042,31 +2043,30 @@ innermoveobj:
 #endif // GC_CACHE_ADAPT
       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_information.to_page_index;
-       int * newtable=&gccachesamplingtbl_r[topage];
-       int * oldtable=&gccachesamplingtbl[gc_cache_revise_infomation.orig_page_index];
-       
-       
-       for(int tt = 0; tt < NUMCORESACTIVE; tt++) {
-         (*newtable)=((*newtable)+(*oldtable)*tmp_factor)/BAMBOO_PAGE_SIZE;
-         newtable=(int*) (((char *)newtable)+size_cachesamplingtbl_local_r);
-         oldtable=(int*) (((char *)oldtable)+size_cachesamplingtbl_local);
-       }
-       // prepare for an new to page
-       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);
+         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)*(tmp_index+1);
+               gc_cache_revise_infomation.orig_page_index = tmp_index;
+               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
       if(stopblock == to->numblocks) {
@@ -2127,18 +2127,18 @@ innermoveobj:
        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_information.to_page_index;
+         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[gc_cache_revise_infomation.orig_page_index];
+         int * oldtable=&gccachesamplingtbl[oldpage];
        
-
          for(int tt = 0; tt < NUMCORESACTIVE; tt++) {
-           (*newtable)=((*newtable)+(*oldtable)*tmp_factor)/BAMBOO_PAGE_SIZE;
-           newtable=(int*) (((char *)newtable)+size_cachesamplingtbl_local_r);
-           oldtable=(int*) (((char *)oldtable)+size_cachesamplingtbl_local);
+               (*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);
@@ -2148,7 +2148,7 @@ innermoveobj:
          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);
+                 (to->ptr-gcbaseva)/(BAMBOO_PAGE_SIZE);
        }
 #endif // GC_CACHE_ADAPT
   } // if(mark == 1)
@@ -2249,12 +2249,13 @@ innercompact:
 #ifdef GC_CACHE_ADAPT
   // end of an to page, wrap up its information
   int tmp_factor = to->ptr-gc_cache_revise_infomation.to_page_start_va;
-  int topage=gc_cache_revise_information.to_page_index;
+  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[gc_cache_revise_infomation.orig_page_index];
+  int * oldtable=&gccachesamplingtbl[oldpage];
   
   for(int tt = 0; tt < NUMCORESACTIVE; tt++) {
-    (*newtable) += (*oldtable)*tmp_factor;
+    (*newtable) = ((*newtable)+(*oldtable)*tmp_factor);
     newtable=(int*) (((char *)newtable)+size_cachesamplingtbl_local_r);
     oldtable=(int*) (((char *)oldtable)+size_cachesamplingtbl_local);
   }
@@ -2944,7 +2945,7 @@ int cacheAdapt_policy_hotest(){
        for(int i = 0; i < NUMCORESACTIVE; i++) {
          int * local_tbl = (int *)((void *)gccachesamplingtbl_r
                  +size_cachesamplingtbl_local_r*i);
-         int freq = local_tbl[page_index];
+         int freq = local_tbl[page_index]/BAMBOO_PAGE_SIZE;
          // TODO
          // check the freqency, decide if this page is hot for the core
          if(hotfreq < freq) {
@@ -2998,7 +2999,7 @@ int cacheAdapt_policy_dominate(){
        for(int i = 0; i < NUMCORESACTIVE; i++) {
          int * local_tbl = (int *)((void *)gccachesamplingtbl_r
                  +size_cachesamplingtbl_local_r*i);
-         int freq = local_tbl[page_index];
+         int freq = local_tbl[page_index]/BAMBOO_PAGE_SIZE;
          totalfreq += freq;
          // TODO
          // check the freqency, decide if this page is hot for the core
@@ -3101,7 +3102,7 @@ int cacheAdapt_policy_overload(){
        for(int i = 0; i < NUMCORESACTIVE; i++) {
          int * local_tbl = (int *)((void *)gccachesamplingtbl_r
                  +size_cachesamplingtbl_local_r*i);
-         int freq = local_tbl[page_index];
+         int freq = local_tbl[page_index]/BAMBOO_PAGE_SIZE;
          totalfreq += freq;
          // TODO
          // check the freqency, decide if this page is hot for the core
@@ -3210,7 +3211,7 @@ int cacheAdapt_policy_crowd(){
        for(int i = 0; i < NUMCORESACTIVE; i++) {
          int * local_tbl = (int *)((void *)gccachesamplingtbl_r
                  +size_cachesamplingtbl_local_r*i);
-         int freq = local_tbl[page_index];
+         int freq = local_tbl[page_index]/BAMBOO_PAGE_SIZE;
          totalfreq += freq;
          // TODO
          // check the freqency, decide if this page is hot for the core
@@ -3383,7 +3384,7 @@ void gc_output_cache_sampling() {
        for(int i = 0; i < NUMCORESACTIVE; i++) {
          int * local_tbl = (int *)((void *)gccachesamplingtbl
                  +size_cachesamplingtbl_local*i);
-         int freq = local_tbl[page_index];
+         int freq = local_tbl[page_index]/BAMBOO_PAGE_SIZE;
          printf("%8d ",freq);
        }
        printf("\n");
@@ -3405,7 +3406,7 @@ void gc_output_cache_sampling_r() {
        for(int i = 0; i < NUMCORESACTIVE; i++) {
          int * local_tbl = (int *)((void *)gccachesamplingtbl_r
                  +size_cachesamplingtbl_local_r*i);
-         int freq = local_tbl[page_index];
+         int freq = local_tbl[page_index]/BAMBOO_PAGE_SIZE;
          printf("%8d ",freq);
        }
        printf("\n");
index b532a33ce61fdbf40d025cdb429337bc98724429..0651c7c60e4f42c958f4227423e9e8f3476008a7 100644 (file)
 unsigned long long bamboo_start_time;
 
 // data structures for msgs
-#define BAMBOO_OUT_BUF_LENGTH 3000
-#define BAMBOO_MSG_BUF_LENGTH 3000
+#define BAMBOO_OUT_BUF_LENGTH 2048
+#define BAMBOO_OUT_BUF_MASK (0x7FF)
+#define BAMBOO_MSG_BUF_LENGTH 2048
+#define BAMBOO_MSG_BUF_MASK (0x7FF)
 int msgdata[BAMBOO_MSG_BUF_LENGTH];
 volatile int msgdataindex;
 volatile int msgdatalast;
@@ -34,10 +36,10 @@ volatile bool isMsgHanging;
 //volatile bool isMsgSending;
 
 #define MSG_INDEXINC_I() \
-  msgdataindex = (msgdataindex + 1) % (BAMBOO_MSG_BUF_LENGTH)
+  msgdataindex = (msgdataindex + 1) & (BAMBOO_MSG_BUF_MASK) //% (BAMBOO_MSG_BUF_LENGTH)
 
 #define MSG_LASTINDEXINC_I() \
-  msgdatalast = (msgdatalast + 1) % (BAMBOO_MSG_BUF_LENGTH)
+  msgdatalast = (msgdatalast + 1) & (BAMBOO_MSG_BUF_MASK) // % (BAMBOO_MSG_BUF_LENGTH)
 
 #define MSG_CACHE_I(n) \
   msgdata[msgdatalast] = (n); \
@@ -56,10 +58,10 @@ volatile bool isMsgHanging;
   }
 
 #define OUTMSG_INDEXINC() \
-  outmsgindex = (outmsgindex + 1) % (BAMBOO_OUT_BUF_LENGTH)
+  outmsgindex = (outmsgindex + 1) & (BAMBOO_OUT_BUF_MASK) //% (BAMBOO_OUT_BUF_LENGTH)
 
 #define OUTMSG_LASTINDEXINC() \
-  outmsglast = (outmsglast + 1) % (BAMBOO_OUT_BUF_LENGTH); \
+  outmsglast = (outmsglast + 1) & (BAMBOO_OUT_BUF_MASK) //% (BAMBOO_OUT_BUF_LENGTH); \
   if(outmsglast == outmsgindex) { \
     BAMBOO_EXIT(0xdd01); \
   }
index 2c61dba4a8138b6c4b718fb4601bca16b10be095..9a40381f6eb901fba4910a532748f2b07e1c55ce 100644 (file)
@@ -2062,9 +2062,9 @@ INLINE int checkMsgLength_I(int size) {
 #ifdef MULTICORE_GC
   case GCLOBJINFO:
 #endif
-  {             // nonfixed size
+  {  // nonfixed size
        if(size > 1) {
-         msglength = msgdata[msgdataindex+1];
+         msglength = msgdata[(msgdataindex+1)%(BAMBOO_MSG_BUF_LENGTH)];
        } else {
          return -1;
        }