src/share/vm/prims/jni.cpp

Print this page




4998 
4999   if (Threads::is_supported_jni_version(args->version)) {
5000     ret = JNI_OK;
5001   }
5002   // 1.1 style no longer supported in hotspot.
5003   // According the JNI spec, we should update args->version on return.
5004   // We also use the structure to communicate with launcher about default
5005   // stack size.
5006   if (args->version == JNI_VERSION_1_1) {
5007     args->version = JNI_VERSION_1_2;
5008     // javaStackSize is int in arguments structure
5009     assert(jlong(ThreadStackSize) * K < INT_MAX, "integer overflow");
5010     args->javaStackSize = (jint)(ThreadStackSize * K);
5011   }
5012   return ret;
5013 }
5014 
5015 #ifndef PRODUCT
5016 
5017 #include "gc_interface/collectedHeap.hpp"



5018 #include "utilities/quickSort.hpp"
5019 #if INCLUDE_VM_STRUCTS
5020 #include "runtime/vmStructs.hpp"
5021 #endif
5022 
5023 #define run_unit_test(unit_test_function_call)              \
5024   tty->print_cr("Running test: " #unit_test_function_call); \
5025   unit_test_function_call
5026 
5027 void execute_internal_vm_tests() {
5028   if (ExecuteInternalVMTests) {
5029     tty->print_cr("Running internal VM tests");
5030     run_unit_test(GlobalDefinitions::test_globals());
5031     run_unit_test(arrayOopDesc::test_max_array_length());
5032     run_unit_test(CollectedHeap::test_is_in());
5033     run_unit_test(QuickSort::test_quick_sort());
5034     run_unit_test(AltHashing::test_alt_hash());
5035 #if INCLUDE_VM_STRUCTS
5036     run_unit_test(VMStructs::test());



5037 #endif
5038     tty->print_cr("All internal VM tests passed");
5039   }
5040 }
5041 
5042 #undef run_unit_test
5043 
5044 #endif
5045 
5046 #ifndef USDT2
5047 HS_DTRACE_PROBE_DECL3(hotspot_jni, CreateJavaVM__entry, vm, penv, args);
5048 DT_RETURN_MARK_DECL(CreateJavaVM, jint);
5049 #else /* USDT2 */
5050 DT_RETURN_MARK_DECL(CreateJavaVM, jint
5051                     , HOTSPOT_JNI_CREATEJAVAVM_RETURN(_ret_ref));
5052 #endif /* USDT2 */
5053 
5054 _JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_CreateJavaVM(JavaVM **vm, void **penv, void *args) {
5055 #ifndef USDT2
5056   HS_DTRACE_PROBE3(hotspot_jni, CreateJavaVM__entry, vm, penv, args);




4998 
4999   if (Threads::is_supported_jni_version(args->version)) {
5000     ret = JNI_OK;
5001   }
5002   // 1.1 style no longer supported in hotspot.
5003   // According the JNI spec, we should update args->version on return.
5004   // We also use the structure to communicate with launcher about default
5005   // stack size.
5006   if (args->version == JNI_VERSION_1_1) {
5007     args->version = JNI_VERSION_1_2;
5008     // javaStackSize is int in arguments structure
5009     assert(jlong(ThreadStackSize) * K < INT_MAX, "integer overflow");
5010     args->javaStackSize = (jint)(ThreadStackSize * K);
5011   }
5012   return ret;
5013 }
5014 
5015 #ifndef PRODUCT
5016 
5017 #include "gc_interface/collectedHeap.hpp"
5018 #if INCLUDE_ALL_GCS
5019 #include "gc_implementation/g1/heapRegionRemSet.hpp"
5020 #endif
5021 #include "utilities/quickSort.hpp"
5022 #if INCLUDE_VM_STRUCTS
5023 #include "runtime/vmStructs.hpp"
5024 #endif
5025 
5026 #define run_unit_test(unit_test_function_call)              \
5027   tty->print_cr("Running test: " #unit_test_function_call); \
5028   unit_test_function_call
5029 
5030 void execute_internal_vm_tests() {
5031   if (ExecuteInternalVMTests) {
5032     tty->print_cr("Running internal VM tests");
5033     run_unit_test(GlobalDefinitions::test_globals());
5034     run_unit_test(arrayOopDesc::test_max_array_length());
5035     run_unit_test(CollectedHeap::test_is_in());
5036     run_unit_test(QuickSort::test_quick_sort());
5037     run_unit_test(AltHashing::test_alt_hash());
5038 #if INCLUDE_VM_STRUCTS
5039     run_unit_test(VMStructs::test());
5040 #endif
5041 #if INCLUDE_ALL_GCS
5042     run_unit_test(HeapRegionRemSet::test_prt());
5043 #endif
5044     tty->print_cr("All internal VM tests passed");
5045   }
5046 }
5047 
5048 #undef run_unit_test
5049 
5050 #endif
5051 
5052 #ifndef USDT2
5053 HS_DTRACE_PROBE_DECL3(hotspot_jni, CreateJavaVM__entry, vm, penv, args);
5054 DT_RETURN_MARK_DECL(CreateJavaVM, jint);
5055 #else /* USDT2 */
5056 DT_RETURN_MARK_DECL(CreateJavaVM, jint
5057                     , HOTSPOT_JNI_CREATEJAVAVM_RETURN(_ret_ref));
5058 #endif /* USDT2 */
5059 
5060 _JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_CreateJavaVM(JavaVM **vm, void **penv, void *args) {
5061 #ifndef USDT2
5062   HS_DTRACE_PROBE3(hotspot_jni, CreateJavaVM__entry, vm, penv, args);