--- a/src/hotspot/share/prims/jvmtiExport.cpp Wed Aug 14 11:14:54 2019 +0100
+++ b/src/hotspot/share/prims/jvmtiExport.cpp Wed Aug 14 10:07:00 2019 -0400
@@ -2279,7 +2279,9 @@
address code_begin, address code_end)
{
// register the stub with the current dynamic code event collector
- JvmtiThreadState* state = JvmtiThreadState::state_for(JavaThread::current());
+ // Cannot take safepoint here so do not use state_for to get
+ // jvmti thread state.
+ JvmtiThreadState* state = JavaThread::current()->jvmti_thread_state();
// state can only be NULL if the current thread is exiting which
// should not happen since we're trying to post an event
guarantee(state != NULL, "attempt to register stub via an exiting thread");
@@ -2294,7 +2296,7 @@
if (thread != NULL && thread->is_Java_thread()) {
// Can not take safepoint here.
NoSafepointVerifier no_sfpt;
- // Can not take safepoint here so can not use state_for to get
+ // Cannot take safepoint here so do not use state_for to get
// jvmti thread state.
JvmtiThreadState *state = ((JavaThread*)thread)->jvmti_thread_state();
if (state != NULL) {
@@ -2318,7 +2320,7 @@
if (thread != NULL && thread->is_Java_thread()) {
// Can not take safepoint here.
NoSafepointVerifier no_sfpt;
- // Can not take safepoint here so can not use state_for to get
+ // Cannot take safepoint here so do not use state_for to get
// jvmti thread state.
JvmtiThreadState *state = ((JavaThread*)thread)->jvmti_thread_state();
if (state != NULL) {