@@ -1397,6 +1397,9 @@ SetForceEarlyReturn::doit(Thread *target, bool self) {
13971397 Thread* current_thread = Thread::current ();
13981398 HandleMark hm (current_thread);
13991399
1400+ if (java_thread->is_exiting ()) {
1401+ return ; /* JVMTI_ERROR_THREAD_NOT_ALIVE (default) */
1402+ }
14001403 if (!self) {
14011404 if (!java_thread->is_suspended ()) {
14021405 _result = JVMTI_ERROR_THREAD_NOT_SUSPENDED;
@@ -1527,6 +1530,10 @@ UpdateForPopTopFrameClosure::doit(Thread *target, bool self) {
15271530 Thread* current_thread = Thread::current ();
15281531 HandleMark hm (current_thread);
15291532 JavaThread* java_thread = target->as_Java_thread ();
1533+
1534+ if (java_thread->is_exiting ()) {
1535+ return ; /* JVMTI_ERROR_THREAD_NOT_ALIVE (default) */
1536+ }
15301537 assert (java_thread == _state->get_thread (), " Must be" );
15311538
15321539 if (!self && !java_thread->is_suspended ()) {
@@ -1603,21 +1610,22 @@ UpdateForPopTopFrameClosure::doit(Thread *target, bool self) {
16031610 // It's fine to update the thread state here because no JVMTI events
16041611 // shall be posted for this PopFrame.
16051612
1606- if (!java_thread->is_exiting () && java_thread->threadObj () != NULL ) {
1607- _state->update_for_pop_top_frame ();
1608- java_thread->set_popframe_condition (JavaThread::popframe_pending_bit);
1609- // Set pending step flag for this popframe and it is cleared when next
1610- // step event is posted.
1611- _state->set_pending_step_for_popframe ();
1612- _result = JVMTI_ERROR_NONE;
1613- }
1613+ _state->update_for_pop_top_frame ();
1614+ java_thread->set_popframe_condition (JavaThread::popframe_pending_bit);
1615+ // Set pending step flag for this popframe and it is cleared when next
1616+ // step event is posted.
1617+ _state->set_pending_step_for_popframe ();
1618+ _result = JVMTI_ERROR_NONE;
16141619}
16151620
16161621void
16171622SetFramePopClosure::doit (Thread *target, bool self) {
16181623 ResourceMark rm;
16191624 JavaThread* java_thread = target->as_Java_thread ();
16201625
1626+ if (java_thread->is_exiting ()) {
1627+ return ; /* JVMTI_ERROR_THREAD_NOT_ALIVE (default) */
1628+ }
16211629 assert (_state->get_thread () == java_thread, " Must be" );
16221630
16231631 if (!self && !java_thread->is_suspended ()) {
@@ -1637,9 +1645,6 @@ SetFramePopClosure::doit(Thread *target, bool self) {
16371645 }
16381646
16391647 assert (vf->frame_pointer () != NULL , " frame pointer mustn't be NULL" );
1640- if (java_thread->is_exiting () || java_thread->threadObj () == NULL ) {
1641- return ; /* JVMTI_ERROR_THREAD_NOT_ALIVE (default) */
1642- }
16431648 int frame_number = _state->count_frames () - _depth;
16441649 _state->env_thread_state ((JvmtiEnvBase*)_env)->set_frame_pop (frame_number);
16451650 _result = JVMTI_ERROR_NONE;
0 commit comments