< prev index next >

src/share/vm/prims/jvmtiExport.cpp

Print this page

        

*** 265,282 **** jobject _protection_domain; jclass _class_being_redefined; public: JvmtiClassFileLoadEventMark(JavaThread *thread, Symbol* name, ! Handle class_loader, Handle prot_domain, KlassHandle *class_being_redefined) : JvmtiThreadEventMark(thread) { _class_name = name != NULL? name->as_utf8() : NULL; _jloader = (jobject)to_jobject(class_loader()); _protection_domain = (jobject)to_jobject(prot_domain()); if (class_being_redefined == NULL) { _class_being_redefined = NULL; } else { ! _class_being_redefined = (jclass)to_jclass((*class_being_redefined)()); } }; const char *class_name() { return _class_name; } --- 265,282 ---- jobject _protection_domain; jclass _class_being_redefined; public: JvmtiClassFileLoadEventMark(JavaThread *thread, Symbol* name, ! Handle class_loader, Handle prot_domain, Klass* class_being_redefined) : JvmtiThreadEventMark(thread) { _class_name = name != NULL? name->as_utf8() : NULL; _jloader = (jobject)to_jobject(class_loader()); _protection_domain = (jobject)to_jobject(prot_domain()); if (class_being_redefined == NULL) { _class_being_redefined = NULL; } else { ! _class_being_redefined = (jclass)to_jclass(class_being_redefined); } }; const char *class_name() { return _class_name; }
*** 733,743 **** jint _curr_len; unsigned char * _curr_data; JvmtiEnv * _curr_env; JvmtiCachedClassFileData ** _cached_class_file_ptr; JvmtiThreadState * _state; ! KlassHandle * _h_class_being_redefined; JvmtiClassLoadKind _load_kind; bool _has_been_modified; public: inline JvmtiClassFileLoadHookPoster(Symbol* h_name, Handle class_loader, --- 733,743 ---- jint _curr_len; unsigned char * _curr_data; JvmtiEnv * _curr_env; JvmtiCachedClassFileData ** _cached_class_file_ptr; JvmtiThreadState * _state; ! Klass* _class_being_redefined; JvmtiClassLoadKind _load_kind; bool _has_been_modified; public: inline JvmtiClassFileLoadHookPoster(Symbol* h_name, Handle class_loader,
*** 756,768 **** _cached_class_file_ptr = cache_ptr; _has_been_modified = false; _state = _thread->jvmti_thread_state(); if (_state != NULL) { ! _h_class_being_redefined = _state->get_class_being_redefined(); _load_kind = _state->get_class_load_kind(); ! Klass* klass = (_h_class_being_redefined == NULL) ? NULL : (*_h_class_being_redefined)(); if (_load_kind != jvmti_class_load_kind_load && klass != NULL) { ModuleEntry* module_entry = InstanceKlass::cast(klass)->module(); assert(module_entry != NULL, "module_entry should always be set"); if (module_entry->is_named() && module_entry->module() != NULL && --- 756,768 ---- _cached_class_file_ptr = cache_ptr; _has_been_modified = false; _state = _thread->jvmti_thread_state(); if (_state != NULL) { ! _class_being_redefined = _state->get_class_being_redefined(); _load_kind = _state->get_class_load_kind(); ! Klass* klass = (_class_being_redefined == NULL) ? NULL : _class_being_redefined; if (_load_kind != jvmti_class_load_kind_load && klass != NULL) { ModuleEntry* module_entry = InstanceKlass::cast(klass)->module(); assert(module_entry != NULL, "module_entry should always be set"); if (module_entry->is_named() && module_entry->module() != NULL &&
*** 781,791 **** // from regular class file load could have this stale redefined // class handle info. _state->clear_class_being_redefined(); } else { // redefine and retransform will always set the thread state ! _h_class_being_redefined = (KlassHandle *) NULL; _load_kind = jvmti_class_load_kind_load; } } void post() { --- 781,791 ---- // from regular class file load could have this stale redefined // class handle info. _state->clear_class_being_redefined(); } else { // redefine and retransform will always set the thread state ! _class_being_redefined = NULL; _load_kind = jvmti_class_load_kind_load; } } void post() {
*** 826,836 **** } unsigned char *new_data = NULL; jint new_len = 0; JvmtiClassFileLoadEventMark jem(_thread, _h_name, _class_loader, _h_protection_domain, ! _h_class_being_redefined); JvmtiJavaThreadEventTransition jet(_thread); jvmtiEventClassFileLoadHook callback = env->callbacks()->ClassFileLoadHook; if (callback != NULL) { (*callback)(env->jvmti_external(), jem.jni_env(), jem.class_being_redefined(), --- 826,836 ---- } unsigned char *new_data = NULL; jint new_len = 0; JvmtiClassFileLoadEventMark jem(_thread, _h_name, _class_loader, _h_protection_domain, ! _class_being_redefined); JvmtiJavaThreadEventTransition jet(_thread); jvmtiEventClassFileLoadHook callback = env->callbacks()->ClassFileLoadHook; if (callback != NULL) { (*callback)(env->jvmti_external(), jem.jni_env(), jem.class_being_redefined(),
*** 1153,1163 **** void JvmtiExport::post_class_load(JavaThread *thread, Klass* klass) { if (JvmtiEnv::get_phase() < JVMTI_PHASE_PRIMORDIAL) { return; } HandleMark hm(thread); - KlassHandle kh(thread, klass); EVT_TRIG_TRACE(JVMTI_EVENT_CLASS_LOAD, ("[%s] Trg Class Load triggered", JvmtiTrace::safe_get_thread_name(thread))); JvmtiThreadState* state = thread->jvmti_thread_state(); if (state == NULL) { --- 1153,1162 ----
*** 1170,1181 **** if (env->phase() == JVMTI_PHASE_PRIMORDIAL) { continue; } EVT_TRACE(JVMTI_EVENT_CLASS_LOAD, ("[%s] Evt Class Load sent %s", JvmtiTrace::safe_get_thread_name(thread), ! kh()==NULL? "NULL" : kh()->external_name() )); ! JvmtiClassEventMark jem(thread, kh()); JvmtiJavaThreadEventTransition jet(thread); jvmtiEventClassLoad callback = env->callbacks()->ClassLoad; if (callback != NULL) { (*callback)(env->jvmti_external(), jem.jni_env(), jem.jni_thread(), jem.jni_class()); } --- 1169,1180 ---- if (env->phase() == JVMTI_PHASE_PRIMORDIAL) { continue; } EVT_TRACE(JVMTI_EVENT_CLASS_LOAD, ("[%s] Evt Class Load sent %s", JvmtiTrace::safe_get_thread_name(thread), ! klass==NULL? "NULL" : klass->external_name() )); ! JvmtiClassEventMark jem(thread, klass); JvmtiJavaThreadEventTransition jet(thread); jvmtiEventClassLoad callback = env->callbacks()->ClassLoad; if (callback != NULL) { (*callback)(env->jvmti_external(), jem.jni_env(), jem.jni_thread(), jem.jni_class()); }
*** 1187,1197 **** void JvmtiExport::post_class_prepare(JavaThread *thread, Klass* klass) { if (JvmtiEnv::get_phase() < JVMTI_PHASE_PRIMORDIAL) { return; } HandleMark hm(thread); - KlassHandle kh(thread, klass); EVT_TRIG_TRACE(JVMTI_EVENT_CLASS_PREPARE, ("[%s] Trg Class Prepare triggered", JvmtiTrace::safe_get_thread_name(thread))); JvmtiThreadState* state = thread->jvmti_thread_state(); if (state == NULL) { --- 1186,1195 ----
*** 1204,1215 **** if (env->phase() == JVMTI_PHASE_PRIMORDIAL) { continue; } EVT_TRACE(JVMTI_EVENT_CLASS_PREPARE, ("[%s] Evt Class Prepare sent %s", JvmtiTrace::safe_get_thread_name(thread), ! kh()==NULL? "NULL" : kh()->external_name() )); ! JvmtiClassEventMark jem(thread, kh()); JvmtiJavaThreadEventTransition jet(thread); jvmtiEventClassPrepare callback = env->callbacks()->ClassPrepare; if (callback != NULL) { (*callback)(env->jvmti_external(), jem.jni_env(), jem.jni_thread(), jem.jni_class()); } --- 1202,1213 ---- if (env->phase() == JVMTI_PHASE_PRIMORDIAL) { continue; } EVT_TRACE(JVMTI_EVENT_CLASS_PREPARE, ("[%s] Evt Class Prepare sent %s", JvmtiTrace::safe_get_thread_name(thread), ! klass==NULL? "NULL" : klass->external_name() )); ! JvmtiClassEventMark jem(thread, klass); JvmtiJavaThreadEventTransition jet(thread); jvmtiEventClassPrepare callback = env->callbacks()->ClassPrepare; if (callback != NULL) { (*callback)(env->jvmti_external(), jem.jni_env(), jem.jni_thread(), jem.jni_class()); }
*** 1221,1231 **** if (JvmtiEnv::get_phase() < JVMTI_PHASE_PRIMORDIAL) { return; } Thread *thread = Thread::current(); HandleMark hm(thread); - KlassHandle kh(thread, klass); EVT_TRIG_TRACE(EXT_EVENT_CLASS_UNLOAD, ("[?] Trg Class Unload triggered" )); if (JvmtiEventController::is_enabled((jvmtiEvent)EXT_EVENT_CLASS_UNLOAD)) { assert(thread->is_VM_thread(), "wrong thread"); --- 1219,1228 ----
*** 1242,1257 **** if (env->phase() == JVMTI_PHASE_PRIMORDIAL) { continue; } if (env->is_enabled((jvmtiEvent)EXT_EVENT_CLASS_UNLOAD)) { EVT_TRACE(EXT_EVENT_CLASS_UNLOAD, ("[?] Evt Class Unload sent %s", ! kh()==NULL? "NULL" : kh()->external_name() )); // do everything manually, since this is a proxy - needs special care JNIEnv* jni_env = real_thread->jni_environment(); jthread jt = (jthread)JNIHandles::make_local(real_thread, real_thread->threadObj()); ! jclass jk = (jclass)JNIHandles::make_local(real_thread, kh()->java_mirror()); // Before we call the JVMTI agent, we have to set the state in the // thread for which we are proxying. JavaThreadState prev_state = real_thread->thread_state(); assert(((Thread *)real_thread)->is_ConcurrentGC_thread() || --- 1239,1254 ---- if (env->phase() == JVMTI_PHASE_PRIMORDIAL) { continue; } if (env->is_enabled((jvmtiEvent)EXT_EVENT_CLASS_UNLOAD)) { EVT_TRACE(EXT_EVENT_CLASS_UNLOAD, ("[?] Evt Class Unload sent %s", ! klass==NULL? "NULL" : klass->external_name() )); // do everything manually, since this is a proxy - needs special care JNIEnv* jni_env = real_thread->jni_environment(); jthread jt = (jthread)JNIHandles::make_local(real_thread, real_thread->threadObj()); ! jclass jk = (jclass)JNIHandles::make_local(real_thread, klass->java_mirror()); // Before we call the JVMTI agent, we have to set the state in the // thread for which we are proxying. JavaThreadState prev_state = real_thread->thread_state(); assert(((Thread *)real_thread)->is_ConcurrentGC_thread() ||
*** 1593,1603 **** current_method = st.method(); current_mh = methodHandle(thread, current_method); current_bci = st.bci(); do { should_repeat = false; ! KlassHandle eh_klass(thread, exception_handle()->klass()); current_bci = Method::fast_exception_handler_bci_for( current_mh, eh_klass, current_bci, THREAD); if (HAS_PENDING_EXCEPTION) { exception_handle = Handle(thread, PENDING_EXCEPTION); CLEAR_PENDING_EXCEPTION; --- 1590,1600 ---- current_method = st.method(); current_mh = methodHandle(thread, current_method); current_bci = st.bci(); do { should_repeat = false; ! Klass* eh_klass = exception_handle()->klass(); current_bci = Method::fast_exception_handler_bci_for( current_mh, eh_klass, current_bci, THREAD); if (HAS_PENDING_EXCEPTION) { exception_handle = Handle(thread, PENDING_EXCEPTION); CLEAR_PENDING_EXCEPTION;
*** 1741,1765 **** if (!valid_fieldID) return; // field accesses are not watched so bail if (!fd.is_field_access_watched()) return; HandleMark hm(thread); - KlassHandle h_klass(thread, klass); Handle h_obj; if (!is_static) { // non-static field accessors have an object, but we need a handle assert(obj != NULL, "non-static needs an object"); h_obj = Handle(thread, obj); } post_field_access(thread, thread->last_frame().interpreter_frame_method(), thread->last_frame().interpreter_frame_bcp(), ! h_klass, h_obj, fieldID); } void JvmtiExport::post_field_access(JavaThread *thread, Method* method, ! address location, KlassHandle field_klass, Handle object, jfieldID field) { HandleMark hm(thread); methodHandle mh(thread, method); JvmtiThreadState *state = thread->jvmti_thread_state(); --- 1738,1761 ---- if (!valid_fieldID) return; // field accesses are not watched so bail if (!fd.is_field_access_watched()) return; HandleMark hm(thread); Handle h_obj; if (!is_static) { // non-static field accessors have an object, but we need a handle assert(obj != NULL, "non-static needs an object"); h_obj = Handle(thread, obj); } post_field_access(thread, thread->last_frame().interpreter_frame_method(), thread->last_frame().interpreter_frame_bcp(), ! klass, h_obj, fieldID); } void JvmtiExport::post_field_access(JavaThread *thread, Method* method, ! address location, Klass* field_klass, Handle object, jfieldID field) { HandleMark hm(thread); methodHandle mh(thread, method); JvmtiThreadState *state = thread->jvmti_thread_state();
*** 1777,1787 **** (mh() == NULL) ? "NULL" : mh()->name()->as_C_string(), location - mh()->code_base() )); JvmtiEnv *env = ets->get_env(); JvmtiLocationEventMark jem(thread, mh, location); ! jclass field_jclass = jem.to_jclass(field_klass()); jobject field_jobject = jem.to_jobject(object()); JvmtiJavaThreadEventTransition jet(thread); jvmtiEventFieldAccess callback = env->callbacks()->FieldAccess; if (callback != NULL) { (*callback)(env->jvmti_external(), jem.jni_env(), jem.jni_thread(), --- 1773,1783 ---- (mh() == NULL) ? "NULL" : mh()->name()->as_C_string(), location - mh()->code_base() )); JvmtiEnv *env = ets->get_env(); JvmtiLocationEventMark jem(thread, mh, location); ! jclass field_jclass = jem.to_jclass(field_klass); jobject field_jobject = jem.to_jobject(object()); JvmtiJavaThreadEventTransition jet(thread); jvmtiEventFieldAccess callback = env->callbacks()->FieldAccess; if (callback != NULL) { (*callback)(env->jvmti_external(), jem.jni_env(), jem.jni_thread(),
*** 1845,1870 **** if (!is_static) { // non-static field accessors have an object, but we need a handle assert(obj != NULL, "non-static needs an object"); h_obj = Handle(thread, obj); } - KlassHandle h_klass(thread, klass); post_field_modification(thread, thread->last_frame().interpreter_frame_method(), thread->last_frame().interpreter_frame_bcp(), ! h_klass, h_obj, fieldID, sig_type, value); } void JvmtiExport::post_raw_field_modification(JavaThread *thread, Method* method, ! address location, KlassHandle field_klass, Handle object, jfieldID field, char sig_type, jvalue *value) { if (sig_type == 'I' || sig_type == 'Z' || sig_type == 'B' || sig_type == 'C' || sig_type == 'S') { // 'I' instructions are used for byte, char, short and int. // determine which it really is, and convert fieldDescriptor fd; ! bool found = JvmtiEnv::get_field_descriptor(field_klass(), field, &fd); // should be found (if not, leave as is) if (found) { jint ival = value->i; // convert value from int to appropriate type switch (fd.field_type()) { --- 1841,1865 ---- if (!is_static) { // non-static field accessors have an object, but we need a handle assert(obj != NULL, "non-static needs an object"); h_obj = Handle(thread, obj); } post_field_modification(thread, thread->last_frame().interpreter_frame_method(), thread->last_frame().interpreter_frame_bcp(), ! klass, h_obj, fieldID, sig_type, value); } void JvmtiExport::post_raw_field_modification(JavaThread *thread, Method* method, ! address location, Klass* field_klass, Handle object, jfieldID field, char sig_type, jvalue *value) { if (sig_type == 'I' || sig_type == 'Z' || sig_type == 'B' || sig_type == 'C' || sig_type == 'S') { // 'I' instructions are used for byte, char, short and int. // determine which it really is, and convert fieldDescriptor fd; ! bool found = JvmtiEnv::get_field_descriptor(field_klass, field, &fd); // should be found (if not, leave as is) if (found) { jint ival = value->i; // convert value from int to appropriate type switch (fd.field_type()) {
*** 1915,1925 **** JNIHandles::destroy_local(value->l); } } void JvmtiExport::post_field_modification(JavaThread *thread, Method* method, ! address location, KlassHandle field_klass, Handle object, jfieldID field, char sig_type, jvalue *value_ptr) { HandleMark hm(thread); methodHandle mh(thread, method); --- 1910,1920 ---- JNIHandles::destroy_local(value->l); } } void JvmtiExport::post_field_modification(JavaThread *thread, Method* method, ! address location, Klass* field_klass, Handle object, jfieldID field, char sig_type, jvalue *value_ptr) { HandleMark hm(thread); methodHandle mh(thread, method);
*** 1941,1951 **** (mh() == NULL) ? "NULL" : mh()->name()->as_C_string(), location - mh()->code_base() )); JvmtiEnv *env = ets->get_env(); JvmtiLocationEventMark jem(thread, mh, location); ! jclass field_jclass = jem.to_jclass(field_klass()); jobject field_jobject = jem.to_jobject(object()); JvmtiJavaThreadEventTransition jet(thread); jvmtiEventFieldModification callback = env->callbacks()->FieldModification; if (callback != NULL) { (*callback)(env->jvmti_external(), jem.jni_env(), jem.jni_thread(), --- 1936,1946 ---- (mh() == NULL) ? "NULL" : mh()->name()->as_C_string(), location - mh()->code_base() )); JvmtiEnv *env = ets->get_env(); JvmtiLocationEventMark jem(thread, mh, location); ! jclass field_jclass = jem.to_jclass(field_klass); jobject field_jobject = jem.to_jobject(object()); JvmtiJavaThreadEventTransition jet(thread); jvmtiEventFieldModification callback = env->callbacks()->FieldModification; if (callback != NULL) { (*callback)(env->jvmti_external(), jem.jni_env(), jem.jni_thread(),
< prev index next >