8229000: Fix lock and reenable assert in Monitor::check_safepoint_state
Reviewed-by: dholmes, kbarrett
--- a/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp Mon Aug 05 11:11:18 2019 +0530
+++ b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp Mon Aug 05 11:16:48 2019 -0400
@@ -6969,7 +6969,7 @@
}
ConcurrentMarkSweepThread::synchronize(true);
- bml->lock();
+ bml->lock_without_safepoint_check();
_collector->startTimer();
}
--- a/src/hotspot/share/runtime/mutex.cpp Mon Aug 05 11:11:18 2019 +0530
+++ b/src/hotspot/share/runtime/mutex.cpp Mon Aug 05 11:16:48 2019 -0400
@@ -40,6 +40,10 @@
assert(!thread->is_Java_thread() || _safepoint_check_required != not_allowed,
"This lock should %s have a safepoint check for Java threads: %s",
_safepoint_check_required ? "always" : "never", name());
+
+ // If defined with safepoint_check_never, a NonJavaThread should never ask to safepoint check either.
+ assert(thread->is_Java_thread() || !do_safepoint_check || _safepoint_check_required != Monitor::_safepoint_check_never,
+ "NonJavaThread should not check for safepoint");
}
#endif // ASSERT