Add process of global thread queue in gc, not tested yet
authorjzhou <jzhou>
Thu, 14 Oct 2010 22:16:44 +0000 (22:16 +0000)
committerjzhou <jzhou>
Thu, 14 Oct 2010 22:16:44 +0000 (22:16 +0000)
Robust/src/Runtime/bamboo/multicoregarbage.c

index 83967ec5a93061527aad4b0e1f0073a2bd091ee0..76dc433353f93b348b691aeb22b380bc60c1713b 100644 (file)
@@ -1159,6 +1159,21 @@ inline void tomark(struct garbagelist * stackptr) {
     }
   }
 
+  GC_BAMBOO_DEBUGPRINT(0xe509);
+#ifdef MGC
+  // enqueue global thread queue
+  lockthreadqueue();
+  unsigned int thread_counter = *((unsigned int*)(bamboo_thread_queue+1));
+  if(thread_counter > 0) {
+       unsigned int start = *((unsigned int*)(bamboo_thread_queue+2));
+       for(i = thread_counter; i > 0; i--) {
+         markObj((void *)bamboo_thread_queue[4+start]);
+         start = (start+1)&bamboo_max_thread_num_mask;
+       }
+  }
+
+  GC_BAMBOO_DEBUGPRINT(0xe50a);
+#endif
 } // void tomark(struct garbagelist * stackptr)
 
 inline void mark(bool isfirst,
@@ -2264,6 +2279,20 @@ inline void flushRuntimeObj(struct garbagelist * stackptr) {
     }
   }
 
+#ifdef MGC
+  // flush global thread queue
+  unsigned int thread_counter = *((unsigned int*)(bamboo_thread_queue+1));
+  if(thread_counter > 0) {
+       unsigned int start = *((unsigned int*)(bamboo_thread_queue+2));
+       for(i = thread_counter; i > 0; i--) {
+         bamboo_thread_queue[4+start] = 
+               (INTPTR)(flushObj((void *)bamboo_thread_queue[4+start]));
+         start = (start+1)&bamboo_max_thread_num_mask;
+       }
+  }
+
+  unlockthreadqueue();
+#endif
 } // void flushRuntimeObj(struct garbagelist * stackptr)
 
 inline void transmappinginfo() {