index

src/share/vm/memory/freeList.cpp

Print this page
rev 7212 : imported patch rev3

@@ -285,27 +285,30 @@
     curFC = curFC->next();
   }
   return false;
 }
 
-#ifndef PRODUCT
 template <class Chunk>
-void FreeList<Chunk>::assert_proper_lock_protection_work() const {
-  assert(protecting_lock() != NULL, "Don't call this directly");
-  assert(ParallelGCThreads > 0, "Don't call this directly");
+void FreeList<Chunk>::assert_proper_lock_protection() const {
+#ifdef ASSERT
+  // Nothing to do if the list has no assigned protecting lock
+  if (protecting_lock() == NULL) {
+    return;
+  }
+
   Thread* thr = Thread::current();
   if (thr->is_VM_thread() || thr->is_ConcurrentGC_thread()) {
     // assert that we are holding the freelist lock
   } else if (thr->is_GC_task_thread()) {
     assert(protecting_lock()->owned_by_self(), "FreeList RACE DETECTED");
   } else if (thr->is_Java_thread()) {
     assert(!SafepointSynchronize::is_at_safepoint(), "Should not be executing");
   } else {
     ShouldNotReachHere();  // unaccounted thread type?
   }
-}
 #endif
+}
 
 // Print the "label line" for free list stats.
 template <class Chunk>
 void FreeList<Chunk>::print_labels_on(outputStream* st, const char* c) {
   st->print("%16s\t", c);
index