src/share/vm/prims/jvmtiEventController.cpp

Print this page
rev 1130 : cleanup the calculation of JavaThread-specific should_post_on_exceptions flag in jvmtiEventController

@@ -80,11 +80,11 @@
 static const jlong  EARLY_EVENT_BITS = CLASS_FILE_LOAD_HOOK_BIT |
                                VM_START_BIT | VM_INIT_BIT | VM_DEATH_BIT | NATIVE_METHOD_BIND_BIT |
                                THREAD_START_BIT | THREAD_END_BIT |
                                DYNAMIC_CODE_GENERATED_BIT;
 static const jlong  GLOBAL_EVENT_BITS = ~THREAD_FILTERED_EVENT_BITS;
-
+static const jlong  SHOULD_POST_ON_EXCEPTIONS_BITS = EXCEPTION_BITS | METHOD_EXIT_BIT | FRAME_POP_BIT;
 
 ///////////////////////////////////////////////////////////////
 //
 // JvmtiEventEnabled
 //

@@ -509,11 +509,16 @@
         enter_interp_only_mode(state);
       } else {
         leave_interp_only_mode(state);
       }
     }
+    
+    // update the JavaThread cached value for thread-specific should_post_on_exceptions value
+    JavaThread *jthread = state->get_thread();
+    jthread->set_should_post_on_exceptions_flag((any_env_enabled & SHOULD_POST_ON_EXCEPTIONS_BITS) ? JNI_TRUE : JNI_FALSE);
   }
+
   return any_env_enabled;
 }
 
 
 // Compute truly enabled events - meaning if the event can and could be

@@ -613,10 +618,14 @@
       }
     }
 
     // set global truly enabled, that is, any thread in any environment
     JvmtiEventController::_universal_global_event_enabled.set_bits(any_env_thread_enabled);
+
+    // set global should_post_on_exceptions
+    JvmtiExport::set_should_post_on_exceptions((any_env_thread_enabled & SHOULD_POST_ON_EXCEPTIONS_BITS) != 0);
+
   }
 
   EC_TRACE(("JVMTI [-] # recompute enabled - after %llx", any_env_thread_enabled));
 }