Missing changes
[IRC.git] / Robust / src / Runtime / bamboo / multicorecache.c
index 6cbe2789e17fd33f5eb88d1846cc0bdaf0b0b50a..6c41b9f49adfecd46f5d7cee91c04dfd12fb7c66 100644 (file)
@@ -103,6 +103,18 @@ void cacheadapt_finish_dst_page(void *origptr, void *tostart, void *toptr, unsig
 //   -- clean dtlb entries
 //   -- change cache strategy
 void cacheAdapt_gc(bool isgccachestage) {
+#ifdef GC_CACHE_COHERENT_ON
+  if(!isgccachestage) {
+    // get out of GC
+#if (defined(GC_CACHE_ADAPT_POLICY4)||defined(GC_CACHE_ADAPT_POLICY3))
+    // flush the shared heap
+    BAMBOO_CACHE_FLUSH_L2();
+
+    // clean the dtlb entries
+    BAMBOO_CLEAN_DTLB();
+#endif
+  } 
+#else
   // flush the shared heap
   BAMBOO_CACHE_FLUSH_L2();
 
@@ -114,6 +126,7 @@ void cacheAdapt_gc(bool isgccachestage) {
   } else {
     bamboo_install_dtlb_handler_for_mutator();
   }
+#endif
 } 
 
 // the master core decides how to adapt cache strategy for the mutator 
@@ -229,7 +242,7 @@ void cacheAdapt_policy_hottest(int coren){
   }
 } 
 
-#define GC_CACHE_ADAPT_DOMINATE_THRESHOLD  1
+#define GC_CACHE_ADAPT_DOMINATE_THRESHOLD  2
 // cache the page on the core that accesses it the most if that core accesses 
 // it more than (GC_CACHE_ADAPT_DOMINATE_THRESHOLD)% of the total.  Otherwise,
 // h4h the page.
@@ -252,7 +265,7 @@ void cacheAdapt_policy_dominate(int coren){
     // Format: page start va + cache policy
     if(hotfreq != 0) {
       totalfreq=totalfreq>>GC_CACHE_ADAPT_DOMINATE_THRESHOLD;
-      if((unsigned int)hotfreq < (unsigned int)totalfreq) {
+      if(hotfreq < totalfreq) {
         // use hfh
         policy.cache_mode = BAMBOO_CACHE_MODE_HASH;
         /*unsigned int block = 0;
@@ -284,7 +297,7 @@ unsigned int cacheAdapt_decision(int coren) {
 #elif defined(GC_CACHE_ADAPT_POLICY2)
   //cacheAdapt_policy_local(coren);
 #elif defined(GC_CACHE_ADAPT_POLICY3)
-  //cacheAdapt_policy_hottest(coren);
+  cacheAdapt_policy_hottest(coren);
 #elif defined(GC_CACHE_ADAPT_POLICY4)
   cacheAdapt_policy_dominate(coren);
 #endif
@@ -292,7 +305,7 @@ unsigned int cacheAdapt_decision(int coren) {
 
 // adapt the cache strategy for the mutator
 void cacheAdapt_mutator() {
-#if defined(GC_CACHE_ADAPT_POLICY4)
+#if (defined(GC_CACHE_ADAPT_POLICY4)||defined(GC_CACHE_ADAPT_POLICY3))
   BAMBOO_CACHE_MF();
   // check the changes and adapt them
   unsigned int * tmp_p = gccachepolicytbl;
@@ -327,7 +340,7 @@ void cacheAdapt_phase_client() {
   send_msg_2(STARTUPCORE, GCFINISHPREF, BAMBOO_NUM_OF_CORE);
   GC_PRINTF("Finish prefinish phase\n");
 
-#if defined(GC_CACHE_ADAPT_POLICY4)
+#if (defined(GC_CACHE_ADAPT_POLICY4)||defined(GC_CACHE_ADAPT_POLICY3))
   CACHEADAPT_SAMPLING_RESET();
   if(BAMBOO_NUM_OF_CORE < NUMCORESACTIVE) {
     // zero out the gccachesamplingtbl
@@ -365,7 +378,7 @@ void cacheAdapt_phase_master() {
   cacheAdapt_gc(false);
   GC_CHECK_ALL_CORE_STATUS();
   
-#if defined(GC_CACHE_ADAPT_POLICY4)
+#if (defined(GC_CACHE_ADAPT_POLICY4)||defined(GC_CACHE_ADAPT_POLICY3))
   CACHEADAPT_SAMPLING_RESET();
   if(BAMBOO_NUM_OF_CORE < NUMCORESACTIVE) {
     // zero out the gccachesamplingtbl