Fix the 'markbit' bug of cache-adapt multicoregc version. In the compact phase,...
authorjzhou <jzhou>
Thu, 2 Sep 2010 18:57:58 +0000 (18:57 +0000)
committerjzhou <jzhou>
Thu, 2 Sep 2010 18:57:58 +0000 (18:57 +0000)
Robust/src/Runtime/bamboo/multicoregarbage.c
Robust/src/Runtime/bamboo/multicoreruntime.h

index 8ecfb6eefa6b5b19c6c5dea3292ece40aeb754a2..b3ef31f7f11e3b0dfa6e656257b9ec6cfb187981 100644 (file)
@@ -243,7 +243,7 @@ inline void * gc_lobjdequeue_I(int * length,
       gclobjspare=tmp;
       tmp->next = NULL;
       tmp->prev = NULL;
-    }             // if (gclobjspare!=NULL)
+    }  // if (gclobjspare!=NULL)
   } // if (gclobjtailindex==NUMLOBJPTRS)
   if(length != NULL) {
     *length = gclobjtail->lengths[gclobjtailindex];
@@ -1223,6 +1223,7 @@ inline void markObj(void * objptr) {
                // this is the first time that this object is discovered,
                // set the flag as DISCOVERED
                ((int *)objptr)[6] |= DISCOVERED;
+               BAMBOO_CACHE_FLUSH_RANGE_NO_FENCE(objptr, (7*sizeof(int)));
                gc_enqueue_I(objptr);
          }
       BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
@@ -1436,6 +1437,7 @@ inline void mark(bool isfirst,
                        BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
                        // mark this obj
                        ((int *)ptr)[6] = ((int *)ptr)[6] & (~DISCOVERED) | MARKED;
+                       BAMBOO_CACHE_FLUSH_RANGE_NO_FENCE(ptr, (7*sizeof(int)));
                  } else if(isnotmarked) {
                        // ptr is an unmarked active object on this core
                        ALIGNSIZE(size, &isize);
@@ -1448,6 +1450,7 @@ inline void mark(bool isfirst,
 #endif
                        // mark this obj
                        ((int *)ptr)[6] = ((int *)ptr)[6] & (~DISCOVERED) | MARKED;
+                       BAMBOO_CACHE_FLUSH_RANGE_NO_FENCE(ptr, (7*sizeof(int)));
                  
                        if(ptr + size > gcmarkedptrbound) {
                          gcmarkedptrbound = ptr + size;
@@ -1541,7 +1544,10 @@ inline void mark(bool isfirst,
 #endif
       return;
     }
-  }       // while(MARKPHASE == gcphase)
+  } // while(MARKPHASE == gcphase)
+
+  BAMBOO_CLEAN_DTLB();
+  BAMBOO_CACHE_MEM_FENCE_INCOHERENT();
 } // mark()
 
 inline void compact2Heaptophelper_I(int coren,
@@ -3164,6 +3170,9 @@ inline void gc_master(struct garbagelist * stackptr) {
        gcrequiredmems[i] = 0;
   }
 
+  BAMBOO_CLEAN_DTLB();
+  BAMBOO_CACHE_MEM_FENCE_INCOHERENT();
+
 #ifdef GC_PROFILE
   gc_profileItem();
 #endif
index c734d5cc37ae185b4dc910b200dc6b0ae553cf18..958f9f657fc29377e919b1026d664df38b7c8098 100644 (file)
@@ -598,6 +598,10 @@ void outputProfileData();
 // BAMBOO_CLEAN_DTLB(): zero-out all the dtlb entries                      //
 // BAMBOO_CACHE_FLUSH_L2(): Flush the contents of this tile's L2 back to   //
 //                          main memory                                    //
+// BAMBOO_CACHE_FLUSH_RANGE_NO_FENCE(x, y): flush a range of mem without   //
+//                                          mem fence                      //
+// BAMBOO_CACHE_MEM_FENCE_INCOHERENT(): fence to guarantee visibility of   //
+//                                      stores to incoherent memory        //
 /////////////////////////////////////////////////////////////////////////////
 
 #endif  // #ifdef MULTICORE