void ThreadLocalAllocBuffer::accumulate_statistics_before_gc() {
  global_stats()->initialize();

#ifdef COLORED_TLABS
  if(UseColoredSpaces) {
    for(JavaThread *thread = Threads::first(); thread; thread = thread->next()) {
      //tty->print("early: %p\n", thread);
      thread->tlab(HC_RED).accumulate_statistics();
      thread->tlab(HC_RED).initialize_statistics();
      thread->tlab(HC_BLUE).accumulate_statistics();
      thread->tlab(HC_BLUE).initialize_statistics();
    }
  } else {
    for(JavaThread *thread = Threads::first(); thread; thread = thread->next()) {
      //tty->print("early: %p\n", thread);
      thread->tlab().accumulate_statistics();
      thread->tlab().initialize_statistics();
    }
  }
#else
  for (JavaThread *thread = Threads::first(); thread != NULL; thread = thread->next()) {
    thread->tlab().accumulate_statistics();
    thread->tlab().initialize_statistics();
  }
#endif

  // Publish new stats if some allocation occurred.
  if (global_stats()->allocation() != 0) {
    global_stats()->publish();
    if (PrintTLAB) {
      global_stats()->print();
    }
  }
}
void ThreadLocalAllocBuffer::resize_all_tlabs() {
  if (ResizeTLAB) {
    if (UseColoredSpaces) {
      for(JavaThread *thread = Threads::first(); thread; thread = thread->next()) {
        thread->tlab(HC_RED).resize();
        thread->tlab(HC_BLUE).resize();
      }
    } else {
      for(JavaThread *thread = Threads::first(); thread; thread = thread->next()) {
        thread->tlab().resize();
      }
    }
  }
}
void ThreadLocalAllocBuffer::resize_all_tlabs() {
  if (ResizeTLAB) {
    for (JavaThread *thread = Threads::first(); thread != NULL; thread = thread->next()) {
      thread->tlab().resize();
    }
  }
}
void ThreadLocalAllocBuffer::accumulate_statistics_before_gc() {
  global_stats()->initialize();

  for(JavaThread *thread = Threads::first(); thread; thread = thread->next()) {
    thread->tlab().accumulate_statistics();
    thread->tlab().initialize_statistics();
  }

  // Publish new stats if some allocation occurred.
  if (global_stats()->allocation() != 0) {
    global_stats()->publish();
    if (PrintTLAB) {
      global_stats()->print();
    }
  }
}