src/share/vm/prims/jni.cpp

Print this page
rev 2779 : 7102044: G1: VM crashes with assert(old_end != new_end) failed: don't call this otherwise
Summary: arrayOopDesc::max_array_length() should return a value that does not overflow a size_t if it is converted to bytes.
Reviewed-by: duke


5025   // 1.1 style no longer supported in hotspot.
5026   // According the JNI spec, we should update args->version on return.
5027   // We also use the structure to communicate with launcher about default
5028   // stack size.
5029   if (args->version == JNI_VERSION_1_1) {
5030     args->version = JNI_VERSION_1_2;
5031     // javaStackSize is int in arguments structure
5032     assert(jlong(ThreadStackSize) * K < INT_MAX, "integer overflow");
5033     args->javaStackSize = (jint)(ThreadStackSize * K);
5034   }
5035   return ret;
5036 }
5037 
5038 #ifndef PRODUCT
5039 
5040 #include "utilities/quickSort.hpp"
5041 
5042 void execute_internal_vm_tests() {
5043   if (ExecuteInternalVMTests) {
5044     assert(QuickSort::test_quick_sort(), "test_quick_sort failed");
5045     tty->print_cr("All tests passed");

5046   }
5047 }
5048 
5049 #endif
5050 
5051 #ifndef USDT2
5052 HS_DTRACE_PROBE_DECL3(hotspot_jni, CreateJavaVM__entry, vm, penv, args);
5053 DT_RETURN_MARK_DECL(CreateJavaVM, jint);
5054 #else /* USDT2 */
5055 DT_RETURN_MARK_DECL(CreateJavaVM, jint
5056                     , HOTSPOT_JNI_CREATEJAVAVM_RETURN(_ret_ref));
5057 #endif /* USDT2 */
5058 
5059 _JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_CreateJavaVM(JavaVM **vm, void **penv, void *args) {
5060 #ifndef USDT2
5061   HS_DTRACE_PROBE3(hotspot_jni, CreateJavaVM__entry, vm, penv, args);
5062 #else /* USDT2 */
5063   HOTSPOT_JNI_CREATEJAVAVM_ENTRY(
5064                                  (void **) vm, penv, args);
5065 #endif /* USDT2 */




5025   // 1.1 style no longer supported in hotspot.
5026   // According the JNI spec, we should update args->version on return.
5027   // We also use the structure to communicate with launcher about default
5028   // stack size.
5029   if (args->version == JNI_VERSION_1_1) {
5030     args->version = JNI_VERSION_1_2;
5031     // javaStackSize is int in arguments structure
5032     assert(jlong(ThreadStackSize) * K < INT_MAX, "integer overflow");
5033     args->javaStackSize = (jint)(ThreadStackSize * K);
5034   }
5035   return ret;
5036 }
5037 
5038 #ifndef PRODUCT
5039 
5040 #include "utilities/quickSort.hpp"
5041 
5042 void execute_internal_vm_tests() {
5043   if (ExecuteInternalVMTests) {
5044     assert(QuickSort::test_quick_sort(), "test_quick_sort failed");
5045     assert(arrayOopDesc::test_max_array_length(), "test_max_array_length failed");
5046     tty->print_cr("All internal VM tests passed");
5047   }
5048 }
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);
5063 #else /* USDT2 */
5064   HOTSPOT_JNI_CREATEJAVAVM_ENTRY(
5065                                  (void **) vm, penv, args);
5066 #endif /* USDT2 */