comparison src/share/vm/prims/jvmtiExport.cpp @ 6985:80e866b1d053

Merge
author coleenp
date Fri, 16 Nov 2012 09:19:12 -0500
parents 6cb0d32b828b 070d523b96a7
children 0c8717a92b2d
comparison
equal deleted inserted replaced
6974:6b6ddf8c4329 6985:80e866b1d053
194 // we want to use the code above - but that needs the JNIHandle changes - later... 194 // we want to use the code above - but that needs the JNIHandle changes - later...
195 // for now, use regular make_local 195 // for now, use regular make_local
196 jobject to_jobject(oop obj) { return JNIHandles::make_local(_thread,obj); } 196 jobject to_jobject(oop obj) { return JNIHandles::make_local(_thread,obj); }
197 #endif 197 #endif
198 198
199 jclass to_jclass(Klass* klass) { return (klass == NULL ? NULL : (jclass)to_jobject(Klass::cast(klass)->java_mirror())); } 199 jclass to_jclass(Klass* klass) { return (klass == NULL ? NULL : (jclass)to_jobject(klass->java_mirror())); }
200 200
201 jmethodID to_jmethodID(methodHandle method) { return method->jmethod_id(); } 201 jmethodID to_jmethodID(methodHandle method) { return method->jmethod_id(); }
202 202
203 JNIEnv* jni_env() { return _jni_env; } 203 JNIEnv* jni_env() { return _jni_env; }
204 }; 204 };
918 JvmtiEnvThreadStateIterator it(state); 918 JvmtiEnvThreadStateIterator it(state);
919 for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) { 919 for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) {
920 if (ets->is_enabled(JVMTI_EVENT_CLASS_LOAD)) { 920 if (ets->is_enabled(JVMTI_EVENT_CLASS_LOAD)) {
921 EVT_TRACE(JVMTI_EVENT_CLASS_LOAD, ("JVMTI [%s] Evt Class Load sent %s", 921 EVT_TRACE(JVMTI_EVENT_CLASS_LOAD, ("JVMTI [%s] Evt Class Load sent %s",
922 JvmtiTrace::safe_get_thread_name(thread), 922 JvmtiTrace::safe_get_thread_name(thread),
923 kh()==NULL? "NULL" : Klass::cast(kh())->external_name() )); 923 kh()==NULL? "NULL" : kh()->external_name() ));
924 924
925 JvmtiEnv *env = ets->get_env(); 925 JvmtiEnv *env = ets->get_env();
926 JvmtiClassEventMark jem(thread, kh()); 926 JvmtiClassEventMark jem(thread, kh());
927 JvmtiJavaThreadEventTransition jet(thread); 927 JvmtiJavaThreadEventTransition jet(thread);
928 jvmtiEventClassLoad callback = env->callbacks()->ClassLoad; 928 jvmtiEventClassLoad callback = env->callbacks()->ClassLoad;
947 JvmtiEnvThreadStateIterator it(state); 947 JvmtiEnvThreadStateIterator it(state);
948 for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) { 948 for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) {
949 if (ets->is_enabled(JVMTI_EVENT_CLASS_PREPARE)) { 949 if (ets->is_enabled(JVMTI_EVENT_CLASS_PREPARE)) {
950 EVT_TRACE(JVMTI_EVENT_CLASS_PREPARE, ("JVMTI [%s] Evt Class Prepare sent %s", 950 EVT_TRACE(JVMTI_EVENT_CLASS_PREPARE, ("JVMTI [%s] Evt Class Prepare sent %s",
951 JvmtiTrace::safe_get_thread_name(thread), 951 JvmtiTrace::safe_get_thread_name(thread),
952 kh()==NULL? "NULL" : Klass::cast(kh())->external_name() )); 952 kh()==NULL? "NULL" : kh()->external_name() ));
953 953
954 JvmtiEnv *env = ets->get_env(); 954 JvmtiEnv *env = ets->get_env();
955 JvmtiClassEventMark jem(thread, kh()); 955 JvmtiClassEventMark jem(thread, kh());
956 JvmtiJavaThreadEventTransition jet(thread); 956 JvmtiJavaThreadEventTransition jet(thread);
957 jvmtiEventClassPrepare callback = env->callbacks()->ClassPrepare; 957 jvmtiEventClassPrepare callback = env->callbacks()->ClassPrepare;
977 977
978 JvmtiEnvIterator it; 978 JvmtiEnvIterator it;
979 for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { 979 for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) {
980 if (env->is_enabled((jvmtiEvent)EXT_EVENT_CLASS_UNLOAD)) { 980 if (env->is_enabled((jvmtiEvent)EXT_EVENT_CLASS_UNLOAD)) {
981 EVT_TRACE(EXT_EVENT_CLASS_UNLOAD, ("JVMTI [?] Evt Class Unload sent %s", 981 EVT_TRACE(EXT_EVENT_CLASS_UNLOAD, ("JVMTI [?] Evt Class Unload sent %s",
982 kh()==NULL? "NULL" : Klass::cast(kh())->external_name() )); 982 kh()==NULL? "NULL" : kh()->external_name() ));
983 983
984 // do everything manually, since this is a proxy - needs special care 984 // do everything manually, since this is a proxy - needs special care
985 JNIEnv* jni_env = real_thread->jni_environment(); 985 JNIEnv* jni_env = real_thread->jni_environment();
986 jthread jt = (jthread)JNIHandles::make_local(real_thread, real_thread->threadObj()); 986 jthread jt = (jthread)JNIHandles::make_local(real_thread, real_thread->threadObj());
987 jclass jk = (jclass)JNIHandles::make_local(real_thread, Klass::cast(kh())->java_mirror()); 987 jclass jk = (jclass)JNIHandles::make_local(real_thread, kh()->java_mirror());
988 988
989 // Before we call the JVMTI agent, we have to set the state in the 989 // Before we call the JVMTI agent, we have to set the state in the
990 // thread for which we are proxying. 990 // thread for which we are proxying.
991 JavaThreadState prev_state = real_thread->thread_state(); 991 JavaThreadState prev_state = real_thread->thread_state();
992 assert(prev_state == _thread_blocked, "JavaThread should be at safepoint"); 992 assert(prev_state == _thread_blocked, "JavaThread should be at safepoint");
2119 JvmtiEnvIterator it; 2119 JvmtiEnvIterator it;
2120 for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { 2120 for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) {
2121 if (env->is_enabled(JVMTI_EVENT_VM_OBJECT_ALLOC)) { 2121 if (env->is_enabled(JVMTI_EVENT_VM_OBJECT_ALLOC)) {
2122 EVT_TRACE(JVMTI_EVENT_VM_OBJECT_ALLOC, ("JVMTI [%s] Evt vmobject alloc sent %s", 2122 EVT_TRACE(JVMTI_EVENT_VM_OBJECT_ALLOC, ("JVMTI [%s] Evt vmobject alloc sent %s",
2123 JvmtiTrace::safe_get_thread_name(thread), 2123 JvmtiTrace::safe_get_thread_name(thread),
2124 object==NULL? "NULL" : Klass::cast(java_lang_Class::as_Klass(object))->external_name())); 2124 object==NULL? "NULL" : java_lang_Class::as_Klass(object)->external_name()));
2125 2125
2126 JvmtiVMObjectAllocEventMark jem(thread, h()); 2126 JvmtiVMObjectAllocEventMark jem(thread, h());
2127 JvmtiJavaThreadEventTransition jet(thread); 2127 JvmtiJavaThreadEventTransition jet(thread);
2128 jvmtiEventVMObjectAlloc callback = env->callbacks()->VMObjectAlloc; 2128 jvmtiEventVMObjectAlloc callback = env->callbacks()->VMObjectAlloc;
2129 if (callback != NULL) { 2129 if (callback != NULL) {