8229000: Fix lock and reenable assert in Monitor::check_safepoint_state
authorcoleenp
Mon, 05 Aug 2019 11:16:48 -0400
changeset 57637 c38cca5ffb66
parent 57636 e7acf5388c29
child 57639 b5ab9a71aa95
8229000: Fix lock and reenable assert in Monitor::check_safepoint_state Reviewed-by: dholmes, kbarrett
src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp
src/hotspot/share/runtime/mutex.cpp
--- 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