--- old/src/share/vm/prims/jvmtiExport.cpp 2016-12-03 12:35:41.259570634 +0300 +++ new/src/share/vm/prims/jvmtiExport.cpp 2016-12-03 12:35:41.174570635 +0300 @@ -130,8 +130,7 @@ private: JavaThread *_thread; JNIEnv* _jni_env; - bool _exception_detected; - bool _exception_caught; + JvmtiThreadState::ExceptionState _exception_state; #if 0 JNIHandleBlock* _hblock; #endif @@ -149,11 +148,11 @@ // we are before an event. // Save current jvmti thread exception state. if (state != NULL) { - _exception_detected = state->is_exception_detected(); - _exception_caught = state->is_exception_caught(); - } else { - _exception_detected = false; - _exception_caught = false; + state->save_exception_state(&_exception_state); + } + else { + // For safety ... + _exception_state = JvmtiThreadState::ES_CLEARED; } JNIHandleBlock* old_handles = thread->active_handles(); @@ -186,12 +185,7 @@ // we are continuing after an event. if (state != NULL) { // Restore the jvmti thread exception state. - if (_exception_detected) { - state->set_exception_detected(); - } - if (_exception_caught) { - state->set_exception_caught(); - } + state->restore_exception_state(_exception_state); } } @@ -1387,7 +1381,6 @@ } } - void JvmtiExport::post_exception_throw(JavaThread *thread, Method* method, address location, oop exception) { HandleMark hm(thread); methodHandle mh(thread, method); @@ -2289,7 +2282,7 @@ JvmtiThreadState* state = thread->jvmti_thread_state(); if (state != NULL) { - state->clear_exception_detected(); + state->clear_exception_state(); } }