46 #include "oops/symbol.hpp" |
46 #include "oops/symbol.hpp" |
47 #include "oops/typeArrayKlass.hpp" |
47 #include "oops/typeArrayKlass.hpp" |
48 #include "oops/typeArrayOop.hpp" |
48 #include "oops/typeArrayOop.hpp" |
49 #include "prims/jni.h" |
49 #include "prims/jni.h" |
50 #include "prims/jniCheck.hpp" |
50 #include "prims/jniCheck.hpp" |
|
51 #include "prims/jniExport.hpp" |
51 #include "prims/jniFastGetField.hpp" |
52 #include "prims/jniFastGetField.hpp" |
52 #include "prims/jvm.h" |
53 #include "prims/jvm.h" |
53 #include "prims/jvm_misc.hpp" |
54 #include "prims/jvm_misc.hpp" |
54 #include "prims/jvmtiExport.hpp" |
55 #include "prims/jvmtiExport.hpp" |
55 #include "prims/jvmtiThreadState.hpp" |
56 #include "prims/jvmtiThreadState.hpp" |
64 #include "runtime/reflection.hpp" |
65 #include "runtime/reflection.hpp" |
65 #include "runtime/sharedRuntime.hpp" |
66 #include "runtime/sharedRuntime.hpp" |
66 #include "runtime/signature.hpp" |
67 #include "runtime/signature.hpp" |
67 #include "runtime/vm_operations.hpp" |
68 #include "runtime/vm_operations.hpp" |
68 #include "services/runtimeService.hpp" |
69 #include "services/runtimeService.hpp" |
|
70 #include "trace/tracing.hpp" |
|
71 #include "trace/traceEventTypes.hpp" |
69 #include "utilities/defaultStream.hpp" |
72 #include "utilities/defaultStream.hpp" |
70 #include "utilities/dtrace.hpp" |
73 #include "utilities/dtrace.hpp" |
71 #include "utilities/events.hpp" |
74 #include "utilities/events.hpp" |
72 #include "utilities/histogram.hpp" |
75 #include "utilities/histogram.hpp" |
73 #ifdef TARGET_OS_FAMILY_linux |
76 #ifdef TARGET_OS_FAMILY_linux |
5137 |
5140 |
5138 // Notify JVMTI |
5141 // Notify JVMTI |
5139 if (JvmtiExport::should_post_thread_life()) { |
5142 if (JvmtiExport::should_post_thread_life()) { |
5140 JvmtiExport::post_thread_start(thread); |
5143 JvmtiExport::post_thread_start(thread); |
5141 } |
5144 } |
|
5145 |
|
5146 EVENT_BEGIN(TraceEventThreadStart, event); |
|
5147 EVENT_COMMIT(event, |
|
5148 EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(thread->threadObj()))); |
|
5149 |
5142 // Check if we should compile all classes on bootclasspath |
5150 // Check if we should compile all classes on bootclasspath |
5143 NOT_PRODUCT(if (CompileTheWorld) ClassLoader::compile_the_world();) |
5151 NOT_PRODUCT(if (CompileTheWorld) ClassLoader::compile_the_world();) |
5144 // Since this is not a JVM_ENTRY we have to set the thread state manually before leaving. |
5152 // Since this is not a JVM_ENTRY we have to set the thread state manually before leaving. |
5145 ThreadStateTransition::transition_and_fence(thread, _thread_in_vm, _thread_in_native); |
5153 ThreadStateTransition::transition_and_fence(thread, _thread_in_vm, _thread_in_native); |
5146 } else { |
5154 } else { |
5335 // Notify the debugger |
5343 // Notify the debugger |
5336 if (JvmtiExport::should_post_thread_life()) { |
5344 if (JvmtiExport::should_post_thread_life()) { |
5337 JvmtiExport::post_thread_start(thread); |
5345 JvmtiExport::post_thread_start(thread); |
5338 } |
5346 } |
5339 |
5347 |
|
5348 EVENT_BEGIN(TraceEventThreadStart, event); |
|
5349 EVENT_COMMIT(event, |
|
5350 EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(thread->threadObj()))); |
|
5351 |
5340 *(JNIEnv**)penv = thread->jni_environment(); |
5352 *(JNIEnv**)penv = thread->jni_environment(); |
5341 |
5353 |
5342 // Now leaving the VM, so change thread_state. This is normally automatically taken care |
5354 // Now leaving the VM, so change thread_state. This is normally automatically taken care |
5343 // of in the JVM_ENTRY. But in this situation we have to do it manually. Notice, that by |
5355 // of in the JVM_ENTRY. But in this situation we have to do it manually. Notice, that by |
5344 // using ThreadStateTransition::transition, we do a callback to the safepoint code if |
5356 // using ThreadStateTransition::transition, we do a callback to the safepoint code if |
5462 *penv = NULL; |
5474 *penv = NULL; |
5463 ret = JNI_EDETACHED; |
5475 ret = JNI_EDETACHED; |
5464 return ret; |
5476 return ret; |
5465 } |
5477 } |
5466 |
5478 |
5467 if (JvmtiExport::is_jvmti_version(version)) { |
5479 if (JniExportedInterface::GetExportedInterface(vm, penv, version, &ret)) { |
5468 ret = JvmtiExport::get_jvmti_interface(vm, penv, version); |
|
5469 return ret; |
5480 return ret; |
5470 } |
5481 } |
5471 |
5482 |
5472 #ifndef JVMPI_VERSION_1 |
5483 #ifndef JVMPI_VERSION_1 |
5473 // need these in order to be polite about older agents |
5484 // need these in order to be polite about older agents |