< prev index next >

src/share/vm/prims/jvmtiExport.cpp

Print this page

        

@@ -128,12 +128,11 @@
 
 class JvmtiEventMark : public StackObj {
 private:
   JavaThread *_thread;
   JNIEnv* _jni_env;
-  bool _exception_detected;
-  bool _exception_caught;
+  JvmtiThreadState::ExceptionState _exception_state;
 #if 0
   JNIHandleBlock* _hblock;
 #endif
 
 public:

@@ -147,15 +146,15 @@
     // for now, steal JNI push local frame code
     JvmtiThreadState *state = thread->jvmti_thread_state();
     // 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();
     JNIHandleBlock* new_handles = JNIHandleBlock::allocate_block(thread);
     assert(new_handles != NULL, "should not be NULL");

@@ -184,16 +183,11 @@
 
     JvmtiThreadState* state = _thread->jvmti_thread_state();
     // 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);
     }
   }
 
 #if 0
   jobject to_jobject(oop obj) { return obj == NULL? NULL : _hblock->allocate_handle_fast(obj); }

@@ -1385,11 +1379,10 @@
       ets->set_single_stepping_posted();
     }
   }
 }
 
-
 void JvmtiExport::post_exception_throw(JavaThread *thread, Method* method, address location, oop exception) {
   HandleMark hm(thread);
   methodHandle mh(thread, method);
   Handle exception_handle(thread, exception);
 

@@ -2287,11 +2280,11 @@
 void JvmtiExport::clear_detected_exception(JavaThread* thread) {
   assert(JavaThread::current() == thread, "thread is not current");
 
   JvmtiThreadState* state = thread->jvmti_thread_state();
   if (state != NULL) {
-    state->clear_exception_detected();
+    state->clear_exception_state();
   }
 }
 
 void JvmtiExport::oops_do(OopClosure* f) {
   JvmtiCurrentBreakpoints::oops_do(f);
< prev index next >