diff options
author | 2017-09-12 08:57:31 -0700 | |
---|---|---|
committer | 2017-09-18 14:18:07 -0700 | |
commit | 9df79b72d1f5fb7fd731761c744eb119d02b45ee (patch) | |
tree | b70c735d5ca26b1135c18770442e9840b3cdf19e /openjdkjvmti/events.h | |
parent | 41006c6e8c0c5132a22bb7e100b6cd545dbb55a6 (diff) |
Cleanup and consolidate JVMTI event code.
Various cleanups around JVMTI event code.
Ensure that we always store and restore exceptions.
Ensure we always give agents a local frame.
Ensure that we have static_asserts to verify that we are calling
events with appropriate types.
Various other improvements.
Test: ./test.py --host -j50
Change-Id: I71937d1575efca5096c9d5218203dc8201e3bb79
Diffstat (limited to 'openjdkjvmti/events.h')
-rw-r--r-- | openjdkjvmti/events.h | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/openjdkjvmti/events.h b/openjdkjvmti/events.h index 0d36c46fa1..a062e1589e 100644 --- a/openjdkjvmti/events.h +++ b/openjdkjvmti/events.h @@ -161,20 +161,21 @@ class EventHandler { ArtJvmtiEvent event, jvmtiEventMode mode); - // Dispatch event to all registered environments. + // Dispatch event to all registered environments. Since this one doesn't have a JNIEnv* it doesn't + // matter if it has the mutator_lock. template <ArtJvmtiEvent kEvent, typename ...Args> ALWAYS_INLINE inline void DispatchEvent(art::Thread* thread, Args... args) const; + // Dispatch event to all registered environments stashing exceptions as needed. This works since // JNIEnv* is always the second argument if it is passed to an event. Needed since C++ does not // allow partial template function specialization. + // + // We need both of these since we want to make sure to push a stack frame when it is possible for + // the event to allocate local references. template <ArtJvmtiEvent kEvent, typename ...Args> ALWAYS_INLINE - void DispatchEvent(art::Thread* thread, JNIEnv* jnienv, Args... args) const; - // Dispatch event to the given environment, only. - template <ArtJvmtiEvent kEvent, typename ...Args> - ALWAYS_INLINE - inline void DispatchEvent(ArtJvmTiEnv* env, art::Thread* thread, Args... args) const; + inline void DispatchEvent(art::Thread* thread, JNIEnv* jnienv, Args... args) const; // Tell the event handler capabilities were added/lost so it can adjust the sent events.If // caps_added is true then caps is all the newly set capabilities of the jvmtiEnv. If it is false @@ -184,10 +185,29 @@ class EventHandler { const jvmtiCapabilities& caps, bool added); + // Dispatch event to the given environment, only. + template <ArtJvmtiEvent kEvent, typename ...Args> + ALWAYS_INLINE + inline void DispatchEventOnEnv( + ArtJvmTiEnv* env, art::Thread* thread, JNIEnv* jnienv, Args... args) const; + + // Dispatch event to the given environment, only. + template <ArtJvmtiEvent kEvent, typename ...Args> + ALWAYS_INLINE + inline void DispatchEventOnEnv(ArtJvmTiEnv* env, art::Thread* thread, Args... args) const; + private: template <ArtJvmtiEvent kEvent> ALWAYS_INLINE - static inline bool ShouldDispatch(ArtJvmTiEnv* env, art::Thread* thread); + static inline bool ShouldDispatchOnThread(ArtJvmTiEnv* env, art::Thread* thread); + + template <ArtJvmtiEvent kEvent, typename ...Args> + ALWAYS_INLINE + static inline void ExecuteCallback(ArtJvmTiEnv* env, Args... args); + + template <ArtJvmtiEvent kEvent, typename ...Args> + ALWAYS_INLINE + inline bool ShouldDispatch(ArtJvmTiEnv* env, art::Thread* thread, Args... args) const; ALWAYS_INLINE inline bool NeedsEventUpdate(ArtJvmTiEnv* env, |