@@ -1393,6 +1393,9 @@ SetForceEarlyReturn::doit(Thread *target, bool self) {
13931393 Thread* current_thread = Thread::current ();
13941394 HandleMark hm (current_thread);
13951395
1396+ if (java_thread->is_exiting ()) {
1397+ return ; /* JVMTI_ERROR_THREAD_NOT_ALIVE (default) */
1398+ }
13961399 if (!self) {
13971400 if (!java_thread->is_suspended ()) {
13981401 _result = JVMTI_ERROR_THREAD_NOT_SUSPENDED;
@@ -1523,6 +1526,10 @@ UpdateForPopTopFrameClosure::doit(Thread *target, bool self) {
15231526 Thread* current_thread = Thread::current ();
15241527 HandleMark hm (current_thread);
15251528 JavaThread* java_thread = JavaThread::cast (target);
1529+
1530+ if (java_thread->is_exiting ()) {
1531+ return ; /* JVMTI_ERROR_THREAD_NOT_ALIVE (default) */
1532+ }
15261533 assert (java_thread == _state->get_thread (), " Must be" );
15271534
15281535 if (!self && !java_thread->is_suspended ()) {
@@ -1599,21 +1606,22 @@ UpdateForPopTopFrameClosure::doit(Thread *target, bool self) {
15991606 // It's fine to update the thread state here because no JVMTI events
16001607 // shall be posted for this PopFrame.
16011608
1602- if (!java_thread->is_exiting () && java_thread->threadObj () != NULL ) {
1603- _state->update_for_pop_top_frame ();
1604- java_thread->set_popframe_condition (JavaThread::popframe_pending_bit);
1605- // Set pending step flag for this popframe and it is cleared when next
1606- // step event is posted.
1607- _state->set_pending_step_for_popframe ();
1608- _result = JVMTI_ERROR_NONE;
1609- }
1609+ _state->update_for_pop_top_frame ();
1610+ java_thread->set_popframe_condition (JavaThread::popframe_pending_bit);
1611+ // Set pending step flag for this popframe and it is cleared when next
1612+ // step event is posted.
1613+ _state->set_pending_step_for_popframe ();
1614+ _result = JVMTI_ERROR_NONE;
16101615}
16111616
16121617void
16131618SetFramePopClosure::doit (Thread *target, bool self) {
16141619 ResourceMark rm;
16151620 JavaThread* java_thread = JavaThread::cast (target);
16161621
1622+ if (java_thread->is_exiting ()) {
1623+ return ; /* JVMTI_ERROR_THREAD_NOT_ALIVE (default) */
1624+ }
16171625 assert (_state->get_thread () == java_thread, " Must be" );
16181626
16191627 if (!self && !java_thread->is_suspended ()) {
@@ -1633,9 +1641,6 @@ SetFramePopClosure::doit(Thread *target, bool self) {
16331641 }
16341642
16351643 assert (vf->frame_pointer () != NULL , " frame pointer mustn't be NULL" );
1636- if (java_thread->is_exiting () || java_thread->threadObj () == NULL ) {
1637- return ; /* JVMTI_ERROR_THREAD_NOT_ALIVE (default) */
1638- }
16391644 int frame_number = _state->count_frames () - _depth;
16401645 _state->env_thread_state ((JvmtiEnvBase*)_env)->set_frame_pop (frame_number);
16411646 _result = JVMTI_ERROR_NONE;
0 commit comments