comparison src/share/vm/prims/jni.cpp @ 4970:33df1aeaebbf

Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 27 Feb 2012 13:10:13 +0100
parents 723df37192d6 94ec88ca68e2
children 120820e30baa
comparison
equal deleted inserted replaced
4703:2cfb7fb2dce7 4970:33df1aeaebbf
49 #include "oops/symbol.hpp" 49 #include "oops/symbol.hpp"
50 #include "oops/typeArrayKlass.hpp" 50 #include "oops/typeArrayKlass.hpp"
51 #include "oops/typeArrayOop.hpp" 51 #include "oops/typeArrayOop.hpp"
52 #include "prims/jni.h" 52 #include "prims/jni.h"
53 #include "prims/jniCheck.hpp" 53 #include "prims/jniCheck.hpp"
54 #include "prims/jniExport.hpp"
54 #include "prims/jniFastGetField.hpp" 55 #include "prims/jniFastGetField.hpp"
55 #include "prims/jvm.h" 56 #include "prims/jvm.h"
56 #include "prims/jvm_misc.hpp" 57 #include "prims/jvm_misc.hpp"
57 #include "prims/jvmtiExport.hpp" 58 #include "prims/jvmtiExport.hpp"
58 #include "prims/jvmtiThreadState.hpp" 59 #include "prims/jvmtiThreadState.hpp"
67 #include "runtime/reflection.hpp" 68 #include "runtime/reflection.hpp"
68 #include "runtime/sharedRuntime.hpp" 69 #include "runtime/sharedRuntime.hpp"
69 #include "runtime/signature.hpp" 70 #include "runtime/signature.hpp"
70 #include "runtime/vm_operations.hpp" 71 #include "runtime/vm_operations.hpp"
71 #include "services/runtimeService.hpp" 72 #include "services/runtimeService.hpp"
73 #include "trace/tracing.hpp"
74 #include "trace/traceEventTypes.hpp"
72 #include "utilities/defaultStream.hpp" 75 #include "utilities/defaultStream.hpp"
73 #include "utilities/dtrace.hpp" 76 #include "utilities/dtrace.hpp"
74 #include "utilities/events.hpp" 77 #include "utilities/events.hpp"
75 #include "utilities/histogram.hpp" 78 #include "utilities/histogram.hpp"
76 #ifdef TARGET_OS_FAMILY_linux 79 #ifdef TARGET_OS_FAMILY_linux
5038 return ret; 5041 return ret;
5039 } 5042 }
5040 5043
5041 #ifndef PRODUCT 5044 #ifndef PRODUCT
5042 5045
5046 #include "gc_interface/collectedHeap.hpp"
5043 #include "utilities/quickSort.hpp" 5047 #include "utilities/quickSort.hpp"
5048
5049 #define run_unit_test(unit_test_function_call) \
5050 tty->print_cr("Running test: " #unit_test_function_call); \
5051 unit_test_function_call
5044 5052
5045 void execute_internal_vm_tests() { 5053 void execute_internal_vm_tests() {
5046 if (ExecuteInternalVMTests) { 5054 if (ExecuteInternalVMTests) {
5047 assert(QuickSort::test_quick_sort(), "test_quick_sort failed"); 5055 tty->print_cr("Running internal VM tests");
5048 assert(arrayOopDesc::test_max_array_length(), "test_max_array_length failed"); 5056 run_unit_test(arrayOopDesc::test_max_array_length());
5057 run_unit_test(CollectedHeap::test_is_in());
5058 run_unit_test(QuickSort::test_quick_sort());
5049 tty->print_cr("All internal VM tests passed"); 5059 tty->print_cr("All internal VM tests passed");
5050 } 5060 }
5051 } 5061 }
5062
5063 #undef run_unit_test
5052 5064
5053 #endif 5065 #endif
5054 5066
5055 #ifndef USDT2 5067 #ifndef USDT2
5056 HS_DTRACE_PROBE_DECL3(hotspot_jni, CreateJavaVM__entry, vm, penv, args); 5068 HS_DTRACE_PROBE_DECL3(hotspot_jni, CreateJavaVM__entry, vm, penv, args);
5138 // Notify JVMTI 5150 // Notify JVMTI
5139 if (JvmtiExport::should_post_thread_life()) { 5151 if (JvmtiExport::should_post_thread_life()) {
5140 JvmtiExport::post_thread_start(thread); 5152 JvmtiExport::post_thread_start(thread);
5141 } 5153 }
5142 5154
5155 EVENT_BEGIN(TraceEventThreadStart, event);
5156 EVENT_COMMIT(event,
5157 EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(thread->threadObj())));
5158
5143 // Check if we should compile all classes on bootclasspath 5159 // Check if we should compile all classes on bootclasspath
5144 NOT_PRODUCT(if (CompileTheWorld) ClassLoader::compile_the_world();) 5160 NOT_PRODUCT(if (CompileTheWorld) ClassLoader::compile_the_world();)
5145 // Since this is not a JVM_ENTRY we have to set the thread state manually before leaving. 5161 // Since this is not a JVM_ENTRY we have to set the thread state manually before leaving.
5146 ThreadStateTransition::transition_and_fence(thread, _thread_in_vm, _thread_in_native); 5162 ThreadStateTransition::transition_and_fence(thread, _thread_in_vm, _thread_in_native);
5147 } else { 5163 } else {
5336 // Notify the debugger 5352 // Notify the debugger
5337 if (JvmtiExport::should_post_thread_life()) { 5353 if (JvmtiExport::should_post_thread_life()) {
5338 JvmtiExport::post_thread_start(thread); 5354 JvmtiExport::post_thread_start(thread);
5339 } 5355 }
5340 5356
5357 EVENT_BEGIN(TraceEventThreadStart, event);
5358 EVENT_COMMIT(event,
5359 EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(thread->threadObj())));
5360
5341 *(JNIEnv**)penv = thread->jni_environment(); 5361 *(JNIEnv**)penv = thread->jni_environment();
5342 5362
5343 // Now leaving the VM, so change thread_state. This is normally automatically taken care 5363 // Now leaving the VM, so change thread_state. This is normally automatically taken care
5344 // of in the JVM_ENTRY. But in this situation we have to do it manually. Notice, that by 5364 // of in the JVM_ENTRY. But in this situation we have to do it manually. Notice, that by
5345 // using ThreadStateTransition::transition, we do a callback to the safepoint code if 5365 // using ThreadStateTransition::transition, we do a callback to the safepoint code if
5463 *penv = NULL; 5483 *penv = NULL;
5464 ret = JNI_EDETACHED; 5484 ret = JNI_EDETACHED;
5465 return ret; 5485 return ret;
5466 } 5486 }
5467 5487
5468 if (JvmtiExport::is_jvmti_version(version)) { 5488 if (JniExportedInterface::GetExportedInterface(vm, penv, version, &ret)) {
5469 ret = JvmtiExport::get_jvmti_interface(vm, penv, version);
5470 return ret; 5489 return ret;
5471 } 5490 }
5472 5491
5473 #ifndef JVMPI_VERSION_1 5492 #ifndef JVMPI_VERSION_1
5474 // need these in order to be polite about older agents 5493 // need these in order to be polite about older agents