--- a/hotspot/src/share/vm/memory/freeList.cpp Mon Oct 20 10:18:17 2014 +0200
+++ b/hotspot/src/share/vm/memory/freeList.cpp Tue Oct 21 11:57:22 2014 +0200
@@ -287,11 +287,14 @@
return false;
}
-#ifndef PRODUCT
+#ifdef ASSERT
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");
+ // 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