< prev index next >

src/hotspot/share/prims/jvmtiEventController.hpp

Print this page

 27 
 28 #include "jvmtifiles/jvmti.h"
 29 #include "memory/allocation.hpp"
 30 #include "utilities/globalDefinitions.hpp"
 31 
 32 // forward declaration
 33 class JvmtiEventControllerPrivate;
 34 class JvmtiEventController;
 35 class JvmtiEnvThreadState;
 36 class JvmtiFramePop;
 37 class JvmtiEnvBase;
 38 
 39 
 40 // Extension event support
 41 //
 42 // jvmtiExtEvent is the extensions equivalent of jvmtiEvent
 43 // jvmtiExtCallbacks is the extensions equivalent of jvmtiEventCallbacks
 44 
 45 // Extension events start JVMTI_MIN_EVENT_TYPE_VAL-1 and work towards 0.
 46 typedef enum {


 47   EXT_EVENT_CLASS_UNLOAD = JVMTI_MIN_EVENT_TYPE_VAL-1,
 48   EXT_MIN_EVENT_TYPE_VAL = EXT_EVENT_CLASS_UNLOAD,
 49   EXT_MAX_EVENT_TYPE_VAL = EXT_EVENT_CLASS_UNLOAD
 50 } jvmtiExtEvent;
 51 
 52 typedef struct {
 53   jvmtiExtensionEvent ClassUnload;


 54 } jvmtiExtEventCallbacks;
 55 
 56 
 57 // The complete range of events is EXT_MIN_EVENT_TYPE_VAL to
 58 // JVMTI_MAX_EVENT_TYPE_VAL (inclusive and contiguous).
 59 const int TOTAL_MIN_EVENT_TYPE_VAL = EXT_MIN_EVENT_TYPE_VAL;
 60 const int TOTAL_MAX_EVENT_TYPE_VAL = JVMTI_MAX_EVENT_TYPE_VAL;
 61 
 62 
 63 ///////////////////////////////////////////////////////////////
 64 //
 65 // JvmtiEventEnabled
 66 //
 67 // Utility class
 68 //
 69 // A boolean array indexed by event_type, used as an internal
 70 // data structure to track what JVMTI event types are enabled.
 71 // Used for user set enabling and disabling (globally and on a
 72 // per thread basis), and for computed merges across environments,
 73 // threads and the VM as a whole.

192 
193   // for all environments, global array indexed by jvmtiEvent
194   static JvmtiEventEnabled _universal_global_event_enabled;
195 
196 public:
197   static bool is_enabled(jvmtiEvent event_type);
198 
199   // events that can ONLY be enabled/disabled globally (can't toggle on individual threads).
200   static bool is_global_event(jvmtiEvent event_type);
201 
202   // is the event_type valid?
203   // to do: check against valid event array
204   static bool is_valid_event_type(jvmtiEvent event_type) {
205     return ((int)event_type >= TOTAL_MIN_EVENT_TYPE_VAL)
206         && ((int)event_type <= TOTAL_MAX_EVENT_TYPE_VAL);
207   }
208 
209   // Use (thread == NULL) to enable/disable an event globally.
210   // Use (thread != NULL) to enable/disable an event for a particular thread.
211   // thread is ignored for events that can only be specified globally
212   static void set_user_enabled(JvmtiEnvBase *env, JavaThread *thread,
213                                jvmtiEvent event_type, bool enabled);
214 
215   // Setting callbacks changes computed enablement and must be done
216   // at a safepoint otherwise a NULL callback could be attempted
217   static void set_event_callbacks(JvmtiEnvBase *env,
218                                   const jvmtiEventCallbacks* callbacks,
219                                   jint size_of_callbacks);
220 
221   // Sets the callback function for a single extension event and enables
222   // (or disables it).
223   static void set_extension_event_callback(JvmtiEnvBase* env,
224                                            jint extension_event_index,
225                                            jvmtiExtensionEvent callback);
226 
227   static void set_frame_pop(JvmtiEnvThreadState *env_thread, JvmtiFramePop fpop);
228   static void clear_frame_pop(JvmtiEnvThreadState *env_thread, JvmtiFramePop fpop);
229 
230   static void change_field_watch(jvmtiEvent event_type, bool added);
231 
232   static void thread_started(JavaThread *thread);

 27 
 28 #include "jvmtifiles/jvmti.h"
 29 #include "memory/allocation.hpp"
 30 #include "utilities/globalDefinitions.hpp"
 31 
 32 // forward declaration
 33 class JvmtiEventControllerPrivate;
 34 class JvmtiEventController;
 35 class JvmtiEnvThreadState;
 36 class JvmtiFramePop;
 37 class JvmtiEnvBase;
 38 
 39 
 40 // Extension event support
 41 //
 42 // jvmtiExtEvent is the extensions equivalent of jvmtiEvent
 43 // jvmtiExtCallbacks is the extensions equivalent of jvmtiEventCallbacks
 44 
 45 // Extension events start JVMTI_MIN_EVENT_TYPE_VAL-1 and work towards 0.
 46 typedef enum {
 47   EXT_EVENT_VIRTUAL_THREAD_UNMOUNT = JVMTI_MIN_EVENT_TYPE_VAL-3,
 48   EXT_EVENT_VIRTUAL_THREAD_MOUNT = JVMTI_MIN_EVENT_TYPE_VAL-2,
 49   EXT_EVENT_CLASS_UNLOAD = JVMTI_MIN_EVENT_TYPE_VAL-1,
 50   EXT_MIN_EVENT_TYPE_VAL = EXT_EVENT_VIRTUAL_THREAD_UNMOUNT,
 51   EXT_MAX_EVENT_TYPE_VAL = EXT_EVENT_CLASS_UNLOAD
 52 } jvmtiExtEvent;
 53 
 54 typedef struct {
 55   jvmtiExtensionEvent ClassUnload;
 56   jvmtiExtensionEvent VirtualThreadMount;
 57   jvmtiExtensionEvent VirtualThreadUnmount;
 58 } jvmtiExtEventCallbacks;
 59 
 60 
 61 // The complete range of events is EXT_MIN_EVENT_TYPE_VAL to
 62 // JVMTI_MAX_EVENT_TYPE_VAL (inclusive and contiguous).
 63 const int TOTAL_MIN_EVENT_TYPE_VAL = EXT_MIN_EVENT_TYPE_VAL;
 64 const int TOTAL_MAX_EVENT_TYPE_VAL = JVMTI_MAX_EVENT_TYPE_VAL;
 65 
 66 
 67 ///////////////////////////////////////////////////////////////
 68 //
 69 // JvmtiEventEnabled
 70 //
 71 // Utility class
 72 //
 73 // A boolean array indexed by event_type, used as an internal
 74 // data structure to track what JVMTI event types are enabled.
 75 // Used for user set enabling and disabling (globally and on a
 76 // per thread basis), and for computed merges across environments,
 77 // threads and the VM as a whole.

196 
197   // for all environments, global array indexed by jvmtiEvent
198   static JvmtiEventEnabled _universal_global_event_enabled;
199 
200 public:
201   static bool is_enabled(jvmtiEvent event_type);
202 
203   // events that can ONLY be enabled/disabled globally (can't toggle on individual threads).
204   static bool is_global_event(jvmtiEvent event_type);
205 
206   // is the event_type valid?
207   // to do: check against valid event array
208   static bool is_valid_event_type(jvmtiEvent event_type) {
209     return ((int)event_type >= TOTAL_MIN_EVENT_TYPE_VAL)
210         && ((int)event_type <= TOTAL_MAX_EVENT_TYPE_VAL);
211   }
212 
213   // Use (thread == NULL) to enable/disable an event globally.
214   // Use (thread != NULL) to enable/disable an event for a particular thread.
215   // thread is ignored for events that can only be specified globally
216   static void set_user_enabled(JvmtiEnvBase *env, JavaThread *thread, oop thread_oop,
217                                jvmtiEvent event_type, bool enabled);
218 
219   // Setting callbacks changes computed enablement and must be done
220   // at a safepoint otherwise a NULL callback could be attempted
221   static void set_event_callbacks(JvmtiEnvBase *env,
222                                   const jvmtiEventCallbacks* callbacks,
223                                   jint size_of_callbacks);
224 
225   // Sets the callback function for a single extension event and enables
226   // (or disables it).
227   static void set_extension_event_callback(JvmtiEnvBase* env,
228                                            jint extension_event_index,
229                                            jvmtiExtensionEvent callback);
230 
231   static void set_frame_pop(JvmtiEnvThreadState *env_thread, JvmtiFramePop fpop);
232   static void clear_frame_pop(JvmtiEnvThreadState *env_thread, JvmtiFramePop fpop);
233 
234   static void change_field_watch(jvmtiEvent event_type, bool added);
235 
236   static void thread_started(JavaThread *thread);
< prev index next >