133 inline static void set_can_modify_any_class(bool on) {
134 JVMTI_ONLY(_can_modify_any_class = (on != 0);)
135 }
136 inline static void set_can_access_local_variables(bool on) {
137 JVMTI_ONLY(_can_access_local_variables = (on != 0);)
138 }
139 inline static void set_can_hotswap_or_post_breakpoint(bool on) {
140 JVMTI_ONLY(_can_hotswap_or_post_breakpoint = (on != 0);)
141 }
142 inline static void set_can_walk_any_space(bool on) {
143 JVMTI_ONLY(_can_walk_any_space = (on != 0);)
144 }
145
146 enum {
147 JVMTI_VERSION_MASK = 0x70000000,
148 JVMTI_VERSION_VALUE = 0x30000000,
149 JVMDI_VERSION_VALUE = 0x20000000
150 };
151
152 static void post_field_modification(JavaThread *thread, Method* method, address location,
153 KlassHandle field_klass, Handle object, jfieldID field,
154 char sig_type, jvalue *value);
155
156
157 // posts a DynamicCodeGenerated event (internal/private implementation).
158 // The public post_dynamic_code_generated* functions make use of the
159 // internal implementation. Also called from JvmtiDeferredEvent::post()
160 static void post_dynamic_code_generated_internal(const char *name, const void *code_begin, const void *code_end) NOT_JVMTI_RETURN;
161
162 private:
163
164 // GenerateEvents support to allow posting of CompiledMethodLoad and
165 // DynamicCodeGenerated events for a given environment.
166 friend class JvmtiCodeBlobEvents;
167
168 static void post_compiled_method_load(JvmtiEnv* env, const jmethodID method, const jint length,
169 const void *code_begin, const jint map_length,
170 const jvmtiAddrLocationMap* map) NOT_JVMTI_RETURN;
171 static void post_dynamic_code_generated(JvmtiEnv* env, const char *name, const void *code_begin,
172 const void *code_end) NOT_JVMTI_RETURN;
173
293 static void post_early_vm_start () NOT_JVMTI_RETURN;
294 static void post_vm_start () NOT_JVMTI_RETURN;
295 static void post_vm_initialized () NOT_JVMTI_RETURN;
296 static void post_vm_death () NOT_JVMTI_RETURN;
297
298 static void post_single_step (JavaThread *thread, Method* method, address location) NOT_JVMTI_RETURN;
299 static void post_raw_breakpoint (JavaThread *thread, Method* method, address location) NOT_JVMTI_RETURN;
300
301 static void post_exception_throw (JavaThread *thread, Method* method, address location, oop exception) NOT_JVMTI_RETURN;
302 static void notice_unwind_due_to_exception (JavaThread *thread, Method* method, address location, oop exception, bool in_handler_frame) NOT_JVMTI_RETURN;
303
304 static oop jni_GetField_probe (JavaThread *thread, jobject jobj,
305 oop obj, Klass* klass, jfieldID fieldID, bool is_static)
306 NOT_JVMTI_RETURN_(NULL);
307 static oop jni_GetField_probe_nh (JavaThread *thread, jobject jobj,
308 oop obj, Klass* klass, jfieldID fieldID, bool is_static)
309 NOT_JVMTI_RETURN_(NULL);
310 static void post_field_access_by_jni (JavaThread *thread, oop obj,
311 Klass* klass, jfieldID fieldID, bool is_static) NOT_JVMTI_RETURN;
312 static void post_field_access (JavaThread *thread, Method* method,
313 address location, KlassHandle field_klass, Handle object, jfieldID field) NOT_JVMTI_RETURN;
314 static oop jni_SetField_probe (JavaThread *thread, jobject jobj,
315 oop obj, Klass* klass, jfieldID fieldID, bool is_static, char sig_type,
316 jvalue *value) NOT_JVMTI_RETURN_(NULL);
317 static oop jni_SetField_probe_nh (JavaThread *thread, jobject jobj,
318 oop obj, Klass* klass, jfieldID fieldID, bool is_static, char sig_type,
319 jvalue *value) NOT_JVMTI_RETURN_(NULL);
320 static void post_field_modification_by_jni(JavaThread *thread, oop obj,
321 Klass* klass, jfieldID fieldID, bool is_static, char sig_type,
322 jvalue *value);
323 static void post_raw_field_modification(JavaThread *thread, Method* method,
324 address location, KlassHandle field_klass, Handle object, jfieldID field,
325 char sig_type, jvalue *value) NOT_JVMTI_RETURN;
326
327 static void post_method_entry (JavaThread *thread, Method* method, frame current_frame) NOT_JVMTI_RETURN;
328 static void post_method_exit (JavaThread *thread, Method* method, frame current_frame) NOT_JVMTI_RETURN;
329
330 static void post_class_load (JavaThread *thread, Klass* klass) NOT_JVMTI_RETURN;
331 static void post_class_unload (Klass* klass) NOT_JVMTI_RETURN;
332 static void post_class_prepare (JavaThread *thread, Klass* klass) NOT_JVMTI_RETURN;
333
334 static void post_thread_start (JavaThread *thread) NOT_JVMTI_RETURN;
335 static void post_thread_end (JavaThread *thread) NOT_JVMTI_RETURN;
336
337 // Support for java.lang.instrument agent loading.
338 static bool _should_post_class_file_load_hook;
339 inline static void set_should_post_class_file_load_hook(bool on) { _should_post_class_file_load_hook = on; }
340 inline static bool should_post_class_file_load_hook() {
341 JVMTI_ONLY(return _should_post_class_file_load_hook);
342 NOT_JVMTI(return false;)
343 }
344 // Return true if the class was modified by the hook.
|
133 inline static void set_can_modify_any_class(bool on) {
134 JVMTI_ONLY(_can_modify_any_class = (on != 0);)
135 }
136 inline static void set_can_access_local_variables(bool on) {
137 JVMTI_ONLY(_can_access_local_variables = (on != 0);)
138 }
139 inline static void set_can_hotswap_or_post_breakpoint(bool on) {
140 JVMTI_ONLY(_can_hotswap_or_post_breakpoint = (on != 0);)
141 }
142 inline static void set_can_walk_any_space(bool on) {
143 JVMTI_ONLY(_can_walk_any_space = (on != 0);)
144 }
145
146 enum {
147 JVMTI_VERSION_MASK = 0x70000000,
148 JVMTI_VERSION_VALUE = 0x30000000,
149 JVMDI_VERSION_VALUE = 0x20000000
150 };
151
152 static void post_field_modification(JavaThread *thread, Method* method, address location,
153 Klass* field_klass, Handle object, jfieldID field,
154 char sig_type, jvalue *value);
155
156
157 // posts a DynamicCodeGenerated event (internal/private implementation).
158 // The public post_dynamic_code_generated* functions make use of the
159 // internal implementation. Also called from JvmtiDeferredEvent::post()
160 static void post_dynamic_code_generated_internal(const char *name, const void *code_begin, const void *code_end) NOT_JVMTI_RETURN;
161
162 private:
163
164 // GenerateEvents support to allow posting of CompiledMethodLoad and
165 // DynamicCodeGenerated events for a given environment.
166 friend class JvmtiCodeBlobEvents;
167
168 static void post_compiled_method_load(JvmtiEnv* env, const jmethodID method, const jint length,
169 const void *code_begin, const jint map_length,
170 const jvmtiAddrLocationMap* map) NOT_JVMTI_RETURN;
171 static void post_dynamic_code_generated(JvmtiEnv* env, const char *name, const void *code_begin,
172 const void *code_end) NOT_JVMTI_RETURN;
173
293 static void post_early_vm_start () NOT_JVMTI_RETURN;
294 static void post_vm_start () NOT_JVMTI_RETURN;
295 static void post_vm_initialized () NOT_JVMTI_RETURN;
296 static void post_vm_death () NOT_JVMTI_RETURN;
297
298 static void post_single_step (JavaThread *thread, Method* method, address location) NOT_JVMTI_RETURN;
299 static void post_raw_breakpoint (JavaThread *thread, Method* method, address location) NOT_JVMTI_RETURN;
300
301 static void post_exception_throw (JavaThread *thread, Method* method, address location, oop exception) NOT_JVMTI_RETURN;
302 static void notice_unwind_due_to_exception (JavaThread *thread, Method* method, address location, oop exception, bool in_handler_frame) NOT_JVMTI_RETURN;
303
304 static oop jni_GetField_probe (JavaThread *thread, jobject jobj,
305 oop obj, Klass* klass, jfieldID fieldID, bool is_static)
306 NOT_JVMTI_RETURN_(NULL);
307 static oop jni_GetField_probe_nh (JavaThread *thread, jobject jobj,
308 oop obj, Klass* klass, jfieldID fieldID, bool is_static)
309 NOT_JVMTI_RETURN_(NULL);
310 static void post_field_access_by_jni (JavaThread *thread, oop obj,
311 Klass* klass, jfieldID fieldID, bool is_static) NOT_JVMTI_RETURN;
312 static void post_field_access (JavaThread *thread, Method* method,
313 address location, Klass* field_klass, Handle object, jfieldID field) NOT_JVMTI_RETURN;
314 static oop jni_SetField_probe (JavaThread *thread, jobject jobj,
315 oop obj, Klass* klass, jfieldID fieldID, bool is_static, char sig_type,
316 jvalue *value) NOT_JVMTI_RETURN_(NULL);
317 static oop jni_SetField_probe_nh (JavaThread *thread, jobject jobj,
318 oop obj, Klass* klass, jfieldID fieldID, bool is_static, char sig_type,
319 jvalue *value) NOT_JVMTI_RETURN_(NULL);
320 static void post_field_modification_by_jni(JavaThread *thread, oop obj,
321 Klass* klass, jfieldID fieldID, bool is_static, char sig_type,
322 jvalue *value);
323 static void post_raw_field_modification(JavaThread *thread, Method* method,
324 address location, Klass* field_klass, Handle object, jfieldID field,
325 char sig_type, jvalue *value) NOT_JVMTI_RETURN;
326
327 static void post_method_entry (JavaThread *thread, Method* method, frame current_frame) NOT_JVMTI_RETURN;
328 static void post_method_exit (JavaThread *thread, Method* method, frame current_frame) NOT_JVMTI_RETURN;
329
330 static void post_class_load (JavaThread *thread, Klass* klass) NOT_JVMTI_RETURN;
331 static void post_class_unload (Klass* klass) NOT_JVMTI_RETURN;
332 static void post_class_prepare (JavaThread *thread, Klass* klass) NOT_JVMTI_RETURN;
333
334 static void post_thread_start (JavaThread *thread) NOT_JVMTI_RETURN;
335 static void post_thread_end (JavaThread *thread) NOT_JVMTI_RETURN;
336
337 // Support for java.lang.instrument agent loading.
338 static bool _should_post_class_file_load_hook;
339 inline static void set_should_post_class_file_load_hook(bool on) { _should_post_class_file_load_hook = on; }
340 inline static bool should_post_class_file_load_hook() {
341 JVMTI_ONLY(return _should_post_class_file_load_hook);
342 NOT_JVMTI(return false;)
343 }
344 // Return true if the class was modified by the hook.
|