8234433: TestUnloadEventClassCount fails with "assert(SafepointSynchronize::is_at_safepoint()) failed: invariant"
authormgronlun
Mon, 25 Nov 2019 11:08:30 +0100
changeset 59244 6a897a8ef4af
parent 59243 fb1d9bf1be2b
child 59245 de882051f7a5
8234433: TestUnloadEventClassCount fails with "assert(SafepointSynchronize::is_at_safepoint()) failed: invariant" Reviewed-by: pliden
src/hotspot/share/jfr/jni/jfrGetAllEventClasses.cpp
--- a/src/hotspot/share/jfr/jni/jfrGetAllEventClasses.cpp	Fri Nov 22 10:29:12 2019 +0100
+++ b/src/hotspot/share/jfr/jni/jfrGetAllEventClasses.cpp	Mon Nov 25 11:08:30 2019 +0100
@@ -33,12 +33,11 @@
 #include "memory/resourceArea.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/mutexLocker.hpp"
-#include "runtime/safepoint.hpp"
 #include "runtime/thread.inline.hpp"
 #include "utilities/growableArray.hpp"
 #include "utilities/stack.inline.hpp"
 
- // incremented during class unloading (safepoint) for each unloaded event class
+ // incremented during class unloading for each unloaded event class
 static jlong unloaded_event_classes = 0;
 
 jlong JfrEventClasses::unloaded_event_classes_count() {
@@ -46,8 +45,7 @@
 }
 
 void JfrEventClasses::increment_unloaded_event_class() {
-  // incremented during class unloading (safepoint) for each unloaded event class
-  assert(SafepointSynchronize::is_at_safepoint(), "invariant");
+  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
   ++unloaded_event_classes;
 }