< prev index next >

src/hotspot/share/prims/jvmtiExport.hpp

Print this page

 74 
 75 #if INCLUDE_JVMTI
 76   static int         _field_access_count;
 77   static int         _field_modification_count;
 78 
 79   static bool        _can_access_local_variables;
 80   static bool        _can_hotswap_or_post_breakpoint;
 81   static bool        _can_modify_any_class;
 82   static bool        _can_walk_any_space;
 83 #endif // INCLUDE_JVMTI
 84 
 85   JVMTI_SUPPORT_FLAG(can_get_source_debug_extension)
 86   JVMTI_SUPPORT_FLAG(can_maintain_original_method_order)
 87   JVMTI_SUPPORT_FLAG(can_post_interpreter_events)
 88   JVMTI_SUPPORT_FLAG(can_post_on_exceptions)
 89   JVMTI_SUPPORT_FLAG(can_post_breakpoint)
 90   JVMTI_SUPPORT_FLAG(can_post_field_access)
 91   JVMTI_SUPPORT_FLAG(can_post_field_modification)
 92   JVMTI_SUPPORT_FLAG(can_post_method_entry)
 93   JVMTI_SUPPORT_FLAG(can_post_method_exit)

 94   JVMTI_SUPPORT_FLAG(can_pop_frame)
 95   JVMTI_SUPPORT_FLAG(can_force_early_return)

 96 
 97   JVMTI_SUPPORT_FLAG(early_vmstart_recorded)
 98   JVMTI_SUPPORT_FLAG(can_get_owned_monitor_info) // includes can_get_owned_monitor_stack_depth_info
 99 
100   friend class JvmtiEventControllerPrivate;  // should only modify these flags
101   JVMTI_SUPPORT_FLAG(should_post_single_step)
102   JVMTI_SUPPORT_FLAG(should_post_field_access)
103   JVMTI_SUPPORT_FLAG(should_post_field_modification)
104   JVMTI_SUPPORT_FLAG(should_post_class_load)
105   JVMTI_SUPPORT_FLAG(should_post_class_prepare)
106   JVMTI_SUPPORT_FLAG(should_post_class_unload)
107   JVMTI_SUPPORT_FLAG(should_post_native_method_bind)
108   JVMTI_SUPPORT_FLAG(should_post_compiled_method_load)
109   JVMTI_SUPPORT_FLAG(should_post_compiled_method_unload)
110   JVMTI_SUPPORT_FLAG(should_post_dynamic_code_generated)
111   JVMTI_SUPPORT_FLAG(should_post_monitor_contended_enter)
112   JVMTI_SUPPORT_FLAG(should_post_monitor_contended_entered)
113   JVMTI_SUPPORT_FLAG(should_post_monitor_wait)
114   JVMTI_SUPPORT_FLAG(should_post_monitor_waited)
115   JVMTI_SUPPORT_FLAG(should_post_data_dump)
116   JVMTI_SUPPORT_FLAG(should_post_garbage_collection_start)
117   JVMTI_SUPPORT_FLAG(should_post_garbage_collection_finish)
118   JVMTI_SUPPORT_FLAG(should_post_on_exceptions)
119 
120   // ------ the below maybe don't have to be (but are for now)
121   // fixed conditions here ------------
122   // any events can be enabled
123   JVMTI_SUPPORT_FLAG(should_post_thread_life)
124   JVMTI_SUPPORT_FLAG(should_post_object_free)
125   JVMTI_SUPPORT_FLAG(should_post_resource_exhausted)
126 
127   // we are holding objects on the heap - need to talk to GC - e.g.
128   // breakpoint info
129   JVMTI_SUPPORT_FLAG(should_clean_up_heap_objects)
130   JVMTI_SUPPORT_FLAG(should_post_vm_object_alloc)
131   JVMTI_SUPPORT_FLAG(should_post_sampled_object_alloc)
132 





133   // If flag cannot be implemented, give an error if on=true
134   static void report_unsupported(bool on);
135 
136   // these should only be called by the friend class
137   friend class JvmtiManageCapabilities;
138   inline static void set_can_modify_any_class(bool on) {
139     JVMTI_ONLY(_can_modify_any_class = (on != 0);)
140   }
141   inline static void set_can_access_local_variables(bool on) {
142     JVMTI_ONLY(_can_access_local_variables = (on != 0);)
143   }
144   inline static void set_can_hotswap_or_post_breakpoint(bool on) {
145     JVMTI_ONLY(_can_hotswap_or_post_breakpoint = (on != 0);)
146   }
147   inline static void set_can_walk_any_space(bool on) {
148     JVMTI_ONLY(_can_walk_any_space = (on != 0);)
149   }
150 
151   enum {
152     JVMTI_VERSION_MASK   = 0x70000000,

274   // field access management
275   static address  get_field_access_count_addr() NOT_JVMTI_RETURN_(0);
276 
277   // field modification management
278   static address  get_field_modification_count_addr() NOT_JVMTI_RETURN_(0);
279 
280   // -----------------
281 
282   static bool is_jvmti_version(jint version)                      {
283     JVMTI_ONLY(return (version & JVMTI_VERSION_MASK) == JVMTI_VERSION_VALUE);
284     NOT_JVMTI(return false);
285   }
286   static bool is_jvmdi_version(jint version)                      {
287     JVMTI_ONLY(return (version & JVMTI_VERSION_MASK) == JVMDI_VERSION_VALUE);
288     NOT_JVMTI(return false);
289   }
290   static jint get_jvmti_interface(JavaVM *jvm, void **penv, jint version) NOT_JVMTI_RETURN_(0);
291   static void decode_version_values(jint version, int * major, int * minor,
292                                     int * micro) NOT_JVMTI_RETURN;
293 


294   // single stepping management methods
295   static void at_single_stepping_point(JavaThread *thread, Method* method, address location) NOT_JVMTI_RETURN;
296   static void expose_single_stepping(JavaThread *thread) NOT_JVMTI_RETURN;
297   static bool hide_single_stepping(JavaThread *thread) NOT_JVMTI_RETURN_(false);
298 
299   // Methods that notify the debugger that something interesting has happened in the VM.
300   static void post_early_vm_start        () NOT_JVMTI_RETURN;
301   static void post_vm_start              () NOT_JVMTI_RETURN;
302   static void post_vm_initialized        () NOT_JVMTI_RETURN;
303   static void post_vm_death              () NOT_JVMTI_RETURN;
304 
305   static void post_single_step           (JavaThread *thread, Method* method, address location) NOT_JVMTI_RETURN;
306   static void post_raw_breakpoint        (JavaThread *thread, Method* method, address location) NOT_JVMTI_RETURN;
307 
308   static void post_exception_throw       (JavaThread *thread, Method* method, address location, oop exception) NOT_JVMTI_RETURN;
309   static void notice_unwind_due_to_exception (JavaThread *thread, Method* method, address location, oop exception, bool in_handler_frame) NOT_JVMTI_RETURN;
310 
311   static oop jni_GetField_probe          (JavaThread *thread, jobject jobj,
312     oop obj, Klass* klass, jfieldID fieldID, bool is_static)
313     NOT_JVMTI_RETURN_(NULL);

318   static oop jni_SetField_probe          (JavaThread *thread, jobject jobj,
319     oop obj, Klass* klass, jfieldID fieldID, bool is_static, char sig_type,
320     jvalue *value) NOT_JVMTI_RETURN_(NULL);
321   static void post_field_modification_by_jni(JavaThread *thread, oop obj,
322     Klass* klass, jfieldID fieldID, bool is_static, char sig_type,
323     jvalue *value);
324   static void post_raw_field_modification(JavaThread *thread, Method* method,
325     address location, Klass* field_klass, Handle object, jfieldID field,
326     char sig_type, jvalue *value) NOT_JVMTI_RETURN;
327 
328   static void post_method_entry          (JavaThread *thread, Method* method, frame current_frame) NOT_JVMTI_RETURN;
329   static void post_method_exit           (JavaThread *thread, Method* method, frame current_frame) NOT_JVMTI_RETURN;
330 
331   static void post_class_load            (JavaThread *thread, Klass* klass) NOT_JVMTI_RETURN;
332   static void post_class_unload          (Klass* klass) NOT_JVMTI_RETURN;
333   static void post_class_prepare         (JavaThread *thread, Klass* klass) NOT_JVMTI_RETURN;
334 
335   static void post_thread_start          (JavaThread *thread) NOT_JVMTI_RETURN;
336   static void post_thread_end            (JavaThread *thread) NOT_JVMTI_RETURN;
337 







338   // Support for java.lang.instrument agent loading.
339   static bool _should_post_class_file_load_hook;
340   inline static void set_should_post_class_file_load_hook(bool on)     { _should_post_class_file_load_hook = on;  }
341   inline static bool should_post_class_file_load_hook()           {
342     JVMTI_ONLY(return _should_post_class_file_load_hook);
343     NOT_JVMTI(return false;)
344   }
345   static bool is_early_phase() NOT_JVMTI_RETURN_(false);
346   static bool has_early_class_hook_env() NOT_JVMTI_RETURN_(false);
347   // Return true if the class was modified by the hook.
348   static bool post_class_file_load_hook(Symbol* h_name, Handle class_loader,
349                                         Handle h_protection_domain,
350                                         unsigned char **data_ptr, unsigned char **end_ptr,
351                                         JvmtiCachedClassFileData **cache_ptr) NOT_JVMTI_RETURN_(false);
352   static void post_native_method_bind(Method* method, address* function_ptr) NOT_JVMTI_RETURN;
353   static void post_compiled_method_load(JvmtiEnv* env, nmethod *nm) NOT_JVMTI_RETURN;
354   static void post_compiled_method_load(nmethod *nm) NOT_JVMTI_RETURN;
355   static void post_dynamic_code_generated(const char *name, const void *code_begin, const void *code_end) NOT_JVMTI_RETURN;
356 
357   // used to post a CompiledMethodUnload event

 74 
 75 #if INCLUDE_JVMTI
 76   static int         _field_access_count;
 77   static int         _field_modification_count;
 78 
 79   static bool        _can_access_local_variables;
 80   static bool        _can_hotswap_or_post_breakpoint;
 81   static bool        _can_modify_any_class;
 82   static bool        _can_walk_any_space;
 83 #endif // INCLUDE_JVMTI
 84 
 85   JVMTI_SUPPORT_FLAG(can_get_source_debug_extension)
 86   JVMTI_SUPPORT_FLAG(can_maintain_original_method_order)
 87   JVMTI_SUPPORT_FLAG(can_post_interpreter_events)
 88   JVMTI_SUPPORT_FLAG(can_post_on_exceptions)
 89   JVMTI_SUPPORT_FLAG(can_post_breakpoint)
 90   JVMTI_SUPPORT_FLAG(can_post_field_access)
 91   JVMTI_SUPPORT_FLAG(can_post_field_modification)
 92   JVMTI_SUPPORT_FLAG(can_post_method_entry)
 93   JVMTI_SUPPORT_FLAG(can_post_method_exit)
 94   JVMTI_SUPPORT_FLAG(can_post_frame_pop)
 95   JVMTI_SUPPORT_FLAG(can_pop_frame)
 96   JVMTI_SUPPORT_FLAG(can_force_early_return)
 97   JVMTI_SUPPORT_FLAG(can_support_virtual_threads)
 98 
 99   JVMTI_SUPPORT_FLAG(early_vmstart_recorded)
100   JVMTI_SUPPORT_FLAG(can_get_owned_monitor_info) // includes can_get_owned_monitor_stack_depth_info
101 
102   friend class JvmtiEventControllerPrivate;  // should only modify these flags
103   JVMTI_SUPPORT_FLAG(should_post_single_step)
104   JVMTI_SUPPORT_FLAG(should_post_field_access)
105   JVMTI_SUPPORT_FLAG(should_post_field_modification)
106   JVMTI_SUPPORT_FLAG(should_post_class_load)
107   JVMTI_SUPPORT_FLAG(should_post_class_prepare)
108   JVMTI_SUPPORT_FLAG(should_post_class_unload)
109   JVMTI_SUPPORT_FLAG(should_post_native_method_bind)
110   JVMTI_SUPPORT_FLAG(should_post_compiled_method_load)
111   JVMTI_SUPPORT_FLAG(should_post_compiled_method_unload)
112   JVMTI_SUPPORT_FLAG(should_post_dynamic_code_generated)
113   JVMTI_SUPPORT_FLAG(should_post_monitor_contended_enter)
114   JVMTI_SUPPORT_FLAG(should_post_monitor_contended_entered)
115   JVMTI_SUPPORT_FLAG(should_post_monitor_wait)
116   JVMTI_SUPPORT_FLAG(should_post_monitor_waited)
117   JVMTI_SUPPORT_FLAG(should_post_data_dump)
118   JVMTI_SUPPORT_FLAG(should_post_garbage_collection_start)
119   JVMTI_SUPPORT_FLAG(should_post_garbage_collection_finish)
120   JVMTI_SUPPORT_FLAG(should_post_on_exceptions)
121 
122   // ------ the below maybe don't have to be (but are for now)
123   // fixed conditions here ------------
124   // any events can be enabled
125   JVMTI_SUPPORT_FLAG(should_post_thread_life)
126   JVMTI_SUPPORT_FLAG(should_post_object_free)
127   JVMTI_SUPPORT_FLAG(should_post_resource_exhausted)
128 
129   // we are holding objects on the heap - need to talk to GC - e.g.
130   // breakpoint info
131   JVMTI_SUPPORT_FLAG(should_clean_up_heap_objects)
132   JVMTI_SUPPORT_FLAG(should_post_vm_object_alloc)
133   JVMTI_SUPPORT_FLAG(should_post_sampled_object_alloc)
134 
135   JVMTI_SUPPORT_FLAG(should_post_vthread_start)
136   JVMTI_SUPPORT_FLAG(should_post_vthread_end)
137   JVMTI_SUPPORT_FLAG(should_post_vthread_mount)
138   JVMTI_SUPPORT_FLAG(should_post_vthread_unmount)
139 
140   // If flag cannot be implemented, give an error if on=true
141   static void report_unsupported(bool on);
142 
143   // these should only be called by the friend class
144   friend class JvmtiManageCapabilities;
145   inline static void set_can_modify_any_class(bool on) {
146     JVMTI_ONLY(_can_modify_any_class = (on != 0);)
147   }
148   inline static void set_can_access_local_variables(bool on) {
149     JVMTI_ONLY(_can_access_local_variables = (on != 0);)
150   }
151   inline static void set_can_hotswap_or_post_breakpoint(bool on) {
152     JVMTI_ONLY(_can_hotswap_or_post_breakpoint = (on != 0);)
153   }
154   inline static void set_can_walk_any_space(bool on) {
155     JVMTI_ONLY(_can_walk_any_space = (on != 0);)
156   }
157 
158   enum {
159     JVMTI_VERSION_MASK   = 0x70000000,

281   // field access management
282   static address  get_field_access_count_addr() NOT_JVMTI_RETURN_(0);
283 
284   // field modification management
285   static address  get_field_modification_count_addr() NOT_JVMTI_RETURN_(0);
286 
287   // -----------------
288 
289   static bool is_jvmti_version(jint version)                      {
290     JVMTI_ONLY(return (version & JVMTI_VERSION_MASK) == JVMTI_VERSION_VALUE);
291     NOT_JVMTI(return false);
292   }
293   static bool is_jvmdi_version(jint version)                      {
294     JVMTI_ONLY(return (version & JVMTI_VERSION_MASK) == JVMDI_VERSION_VALUE);
295     NOT_JVMTI(return false);
296   }
297   static jint get_jvmti_interface(JavaVM *jvm, void **penv, jint version) NOT_JVMTI_RETURN_(0);
298   static void decode_version_values(jint version, int * major, int * minor,
299                                     int * micro) NOT_JVMTI_RETURN;
300 
301   static void check_suspend_at_safepoint(JavaThread *thread) NOT_JVMTI_RETURN;
302 
303   // single stepping management methods
304   static void at_single_stepping_point(JavaThread *thread, Method* method, address location) NOT_JVMTI_RETURN;
305   static void expose_single_stepping(JavaThread *thread) NOT_JVMTI_RETURN;
306   static bool hide_single_stepping(JavaThread *thread) NOT_JVMTI_RETURN_(false);
307 
308   // Methods that notify the debugger that something interesting has happened in the VM.
309   static void post_early_vm_start        () NOT_JVMTI_RETURN;
310   static void post_vm_start              () NOT_JVMTI_RETURN;
311   static void post_vm_initialized        () NOT_JVMTI_RETURN;
312   static void post_vm_death              () NOT_JVMTI_RETURN;
313 
314   static void post_single_step           (JavaThread *thread, Method* method, address location) NOT_JVMTI_RETURN;
315   static void post_raw_breakpoint        (JavaThread *thread, Method* method, address location) NOT_JVMTI_RETURN;
316 
317   static void post_exception_throw       (JavaThread *thread, Method* method, address location, oop exception) NOT_JVMTI_RETURN;
318   static void notice_unwind_due_to_exception (JavaThread *thread, Method* method, address location, oop exception, bool in_handler_frame) NOT_JVMTI_RETURN;
319 
320   static oop jni_GetField_probe          (JavaThread *thread, jobject jobj,
321     oop obj, Klass* klass, jfieldID fieldID, bool is_static)
322     NOT_JVMTI_RETURN_(NULL);

327   static oop jni_SetField_probe          (JavaThread *thread, jobject jobj,
328     oop obj, Klass* klass, jfieldID fieldID, bool is_static, char sig_type,
329     jvalue *value) NOT_JVMTI_RETURN_(NULL);
330   static void post_field_modification_by_jni(JavaThread *thread, oop obj,
331     Klass* klass, jfieldID fieldID, bool is_static, char sig_type,
332     jvalue *value);
333   static void post_raw_field_modification(JavaThread *thread, Method* method,
334     address location, Klass* field_klass, Handle object, jfieldID field,
335     char sig_type, jvalue *value) NOT_JVMTI_RETURN;
336 
337   static void post_method_entry          (JavaThread *thread, Method* method, frame current_frame) NOT_JVMTI_RETURN;
338   static void post_method_exit           (JavaThread *thread, Method* method, frame current_frame) NOT_JVMTI_RETURN;
339 
340   static void post_class_load            (JavaThread *thread, Klass* klass) NOT_JVMTI_RETURN;
341   static void post_class_unload          (Klass* klass) NOT_JVMTI_RETURN;
342   static void post_class_prepare         (JavaThread *thread, Klass* klass) NOT_JVMTI_RETURN;
343 
344   static void post_thread_start          (JavaThread *thread) NOT_JVMTI_RETURN;
345   static void post_thread_end            (JavaThread *thread) NOT_JVMTI_RETURN;
346 
347   static void post_vthread_start         (jthread vthread) NOT_JVMTI_RETURN;
348   static void post_vthread_end           (jthread vthread) NOT_JVMTI_RETURN;
349   static void post_vthread_mount         (jthread vthread) NOT_JVMTI_RETURN;
350   static void post_vthread_unmount       (jthread vthread) NOT_JVMTI_RETURN;
351 
352   static void continuation_yield_cleanup (JavaThread* thread, jint continuation_frame_count) NOT_JVMTI_RETURN;
353 
354   // Support for java.lang.instrument agent loading.
355   static bool _should_post_class_file_load_hook;
356   inline static void set_should_post_class_file_load_hook(bool on)     { _should_post_class_file_load_hook = on;  }
357   inline static bool should_post_class_file_load_hook()           {
358     JVMTI_ONLY(return _should_post_class_file_load_hook);
359     NOT_JVMTI(return false;)
360   }
361   static bool is_early_phase() NOT_JVMTI_RETURN_(false);
362   static bool has_early_class_hook_env() NOT_JVMTI_RETURN_(false);
363   // Return true if the class was modified by the hook.
364   static bool post_class_file_load_hook(Symbol* h_name, Handle class_loader,
365                                         Handle h_protection_domain,
366                                         unsigned char **data_ptr, unsigned char **end_ptr,
367                                         JvmtiCachedClassFileData **cache_ptr) NOT_JVMTI_RETURN_(false);
368   static void post_native_method_bind(Method* method, address* function_ptr) NOT_JVMTI_RETURN;
369   static void post_compiled_method_load(JvmtiEnv* env, nmethod *nm) NOT_JVMTI_RETURN;
370   static void post_compiled_method_load(nmethod *nm) NOT_JVMTI_RETURN;
371   static void post_dynamic_code_generated(const char *name, const void *code_begin, const void *code_end) NOT_JVMTI_RETURN;
372 
373   // used to post a CompiledMethodUnload event
< prev index next >