index

src/share/vm/memory/freeList.cpp

Print this page
rev 7214 : imported patch rev3
rev 7216 : [mq]: rev5


 270 
 271 // verify_chunk_in_free_lists() is used to verify that an item is in this free list.
 272 // It is used as a debugging aid.
 273 template <class Chunk>
 274 bool FreeList<Chunk>::verify_chunk_in_free_list(Chunk* fc) const {
 275   // This is an internal consistency check, not part of the check that the
 276   // chunk is in the free lists.
 277   guarantee(fc->size() == size(), "Wrong list is being searched");
 278   Chunk* curFC = head();
 279   while (curFC) {
 280     // This is an internal consistency check.
 281     guarantee(size() == curFC->size(), "Chunk is in wrong list.");
 282     if (fc == curFC) {
 283       return true;
 284     }
 285     curFC = curFC->next();
 286   }
 287   return false;
 288 }
 289 
 290 #ifndef PRODUCT
 291 template <class Chunk>
 292 void FreeList<Chunk>::assert_proper_lock_protection_work() const {
 293   assert(protecting_lock() != NULL, "Don't call this directly");
 294   assert(ParallelGCThreads > 0, "Don't call this directly");



 295   Thread* thr = Thread::current();
 296   if (thr->is_VM_thread() || thr->is_ConcurrentGC_thread()) {
 297     // assert that we are holding the freelist lock
 298   } else if (thr->is_GC_task_thread()) {
 299     assert(protecting_lock()->owned_by_self(), "FreeList RACE DETECTED");
 300   } else if (thr->is_Java_thread()) {
 301     assert(!SafepointSynchronize::is_at_safepoint(), "Should not be executing");
 302   } else {
 303     ShouldNotReachHere();  // unaccounted thread type?
 304   }
 305 }
 306 #endif
 307 
 308 // Print the "label line" for free list stats.
 309 template <class Chunk>
 310 void FreeList<Chunk>::print_labels_on(outputStream* st, const char* c) {
 311   st->print("%16s\t", c);
 312   st->print("%14s\t"    "%14s\t"    "%14s\t"    "%14s\t"    "%14s\t"
 313             "%14s\t"    "%14s\t"    "%14s\t"    "%14s\t"    "%14s\t"    "\n",
 314             "bfrsurp", "surplus", "desired", "prvSwep", "bfrSwep",




 270 
 271 // verify_chunk_in_free_lists() is used to verify that an item is in this free list.
 272 // It is used as a debugging aid.
 273 template <class Chunk>
 274 bool FreeList<Chunk>::verify_chunk_in_free_list(Chunk* fc) const {
 275   // This is an internal consistency check, not part of the check that the
 276   // chunk is in the free lists.
 277   guarantee(fc->size() == size(), "Wrong list is being searched");
 278   Chunk* curFC = head();
 279   while (curFC) {
 280     // This is an internal consistency check.
 281     guarantee(size() == curFC->size(), "Chunk is in wrong list.");
 282     if (fc == curFC) {
 283       return true;
 284     }
 285     curFC = curFC->next();
 286   }
 287   return false;
 288 }
 289 
 290 #ifdef ASSERT
 291 template <class Chunk>
 292 void FreeList<Chunk>::assert_proper_lock_protection_work() const {
 293   // Nothing to do if the list has no assigned protecting lock
 294   if (protecting_lock() == NULL) {
 295     return;
 296   }
 297 
 298   Thread* thr = Thread::current();
 299   if (thr->is_VM_thread() || thr->is_ConcurrentGC_thread()) {
 300     // assert that we are holding the freelist lock
 301   } else if (thr->is_GC_task_thread()) {
 302     assert(protecting_lock()->owned_by_self(), "FreeList RACE DETECTED");
 303   } else if (thr->is_Java_thread()) {
 304     assert(!SafepointSynchronize::is_at_safepoint(), "Should not be executing");
 305   } else {
 306     ShouldNotReachHere();  // unaccounted thread type?
 307   }
 308 }
 309 #endif
 310 
 311 // Print the "label line" for free list stats.
 312 template <class Chunk>
 313 void FreeList<Chunk>::print_labels_on(outputStream* st, const char* c) {
 314   st->print("%16s\t", c);
 315   st->print("%14s\t"    "%14s\t"    "%14s\t"    "%14s\t"    "%14s\t"
 316             "%14s\t"    "%14s\t"    "%14s\t"    "%14s\t"    "%14s\t"    "\n",
 317             "bfrsurp", "surplus", "desired", "prvSwep", "bfrSwep",


index