3337 return JNI_EINVAL; 3338 } 3339 // JNI hooks 3340 } else if (match_option(option, "-Xcheck", &tail)) { 3341 if (!strcmp(tail, ":jni")) { 3342 #if !INCLUDE_JNI_CHECK 3343 warning("JNI CHECKING is not supported in this VM"); 3344 #else 3345 CheckJNICalls = true; 3346 #endif // INCLUDE_JNI_CHECK 3347 } else if (is_bad_option(option, args->ignoreUnrecognized, 3348 "check")) { 3349 return JNI_EINVAL; 3350 } 3351 } else if (match_option(option, "vfprintf")) { 3352 _vfprintf_hook = CAST_TO_FN_PTR(vfprintf_hook_t, option->extraInfo); 3353 } else if (match_option(option, "exit")) { 3354 _exit_hook = CAST_TO_FN_PTR(exit_hook_t, option->extraInfo); 3355 } else if (match_option(option, "abort")) { 3356 _abort_hook = CAST_TO_FN_PTR(abort_hook_t, option->extraInfo); 3357 // -XX:+AggressiveHeap 3358 } else if (match_option(option, "-XX:+AggressiveHeap")) { 3359 jint result = set_aggressive_heap_flags(); 3360 if (result != JNI_OK) { 3361 return result; 3362 } 3363 // Need to keep consistency of MaxTenuringThreshold and AlwaysTenure/NeverTenure; 3364 // and the last option wins. 3365 } else if (match_option(option, "-XX:+NeverTenure")) { 3366 if (FLAG_SET_CMDLINE(bool, NeverTenure, true) != Flag::SUCCESS) { 3367 return JNI_EINVAL; 3368 } 3369 if (FLAG_SET_CMDLINE(bool, AlwaysTenure, false) != Flag::SUCCESS) { 3370 return JNI_EINVAL; 3371 } 3372 if (FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, markOopDesc::max_age + 1) != Flag::SUCCESS) { 3373 return JNI_EINVAL; 3374 } 3375 } else if (match_option(option, "-XX:+AlwaysTenure")) { 3376 if (FLAG_SET_CMDLINE(bool, NeverTenure, false) != Flag::SUCCESS) { 3377 return JNI_EINVAL; 3378 } 3379 if (FLAG_SET_CMDLINE(bool, AlwaysTenure, true) != Flag::SUCCESS) { 3380 return JNI_EINVAL; 3381 } 3382 if (FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0) != Flag::SUCCESS) { 3622 } 3623 } 3624 3625 DIR* dir = os::opendir(path); 3626 if (dir != NULL) { 3627 jio_fprintf(defaultStream::output_stream(), 3628 "<JAVA_HOME>/lib/endorsed is not supported. Endorsed standards and standalone APIs\n" 3629 "in modular form will be supported via the concept of upgradeable modules.\n"); 3630 os::closedir(dir); 3631 return JNI_ERR; 3632 } 3633 3634 jio_snprintf(path, JVM_MAXPATHLEN, "%s%slib%sext", Arguments::get_java_home(), fileSep, fileSep); 3635 dir = os::opendir(path); 3636 if (dir != NULL) { 3637 jio_fprintf(defaultStream::output_stream(), 3638 "<JAVA_HOME>/lib/ext exists, extensions mechanism no longer supported; " 3639 "Use -classpath instead.\n."); 3640 os::closedir(dir); 3641 return JNI_ERR; 3642 } 3643 3644 // This must be done after all arguments have been processed. 3645 // java_compiler() true means set to "NONE" or empty. 3646 if (java_compiler() && !xdebug_mode()) { 3647 // For backwards compatibility, we switch to interpreted mode if 3648 // -Djava.compiler="NONE" or "" is specified AND "-Xdebug" was 3649 // not specified. 3650 set_mode_flags(_int); 3651 } 3652 3653 // CompileThresholdScaling == 0.0 is same as -Xint: Disable compilation (enable interpreter-only mode), 3654 // but like -Xint, leave compilation thresholds unaffected. 3655 // With tiered compilation disabled, setting CompileThreshold to 0 disables compilation as well. 3656 if ((CompileThresholdScaling == 0.0) || (!TieredCompilation && CompileThreshold == 0)) { 3657 set_mode_flags(_int); 3658 } 3659 3660 // eventually fix up InitialTenuringThreshold if only MaxTenuringThreshold is set 3661 if (FLAG_IS_DEFAULT(InitialTenuringThreshold) && (InitialTenuringThreshold > MaxTenuringThreshold)) { | 3337 return JNI_EINVAL; 3338 } 3339 // JNI hooks 3340 } else if (match_option(option, "-Xcheck", &tail)) { 3341 if (!strcmp(tail, ":jni")) { 3342 #if !INCLUDE_JNI_CHECK 3343 warning("JNI CHECKING is not supported in this VM"); 3344 #else 3345 CheckJNICalls = true; 3346 #endif // INCLUDE_JNI_CHECK 3347 } else if (is_bad_option(option, args->ignoreUnrecognized, 3348 "check")) { 3349 return JNI_EINVAL; 3350 } 3351 } else if (match_option(option, "vfprintf")) { 3352 _vfprintf_hook = CAST_TO_FN_PTR(vfprintf_hook_t, option->extraInfo); 3353 } else if (match_option(option, "exit")) { 3354 _exit_hook = CAST_TO_FN_PTR(exit_hook_t, option->extraInfo); 3355 } else if (match_option(option, "abort")) { 3356 _abort_hook = CAST_TO_FN_PTR(abort_hook_t, option->extraInfo); 3357 // Need to keep consistency of MaxTenuringThreshold and AlwaysTenure/NeverTenure; 3358 // and the last option wins. 3359 } else if (match_option(option, "-XX:+NeverTenure")) { 3360 if (FLAG_SET_CMDLINE(bool, NeverTenure, true) != Flag::SUCCESS) { 3361 return JNI_EINVAL; 3362 } 3363 if (FLAG_SET_CMDLINE(bool, AlwaysTenure, false) != Flag::SUCCESS) { 3364 return JNI_EINVAL; 3365 } 3366 if (FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, markOopDesc::max_age + 1) != Flag::SUCCESS) { 3367 return JNI_EINVAL; 3368 } 3369 } else if (match_option(option, "-XX:+AlwaysTenure")) { 3370 if (FLAG_SET_CMDLINE(bool, NeverTenure, false) != Flag::SUCCESS) { 3371 return JNI_EINVAL; 3372 } 3373 if (FLAG_SET_CMDLINE(bool, AlwaysTenure, true) != Flag::SUCCESS) { 3374 return JNI_EINVAL; 3375 } 3376 if (FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0) != Flag::SUCCESS) { 3616 } 3617 } 3618 3619 DIR* dir = os::opendir(path); 3620 if (dir != NULL) { 3621 jio_fprintf(defaultStream::output_stream(), 3622 "<JAVA_HOME>/lib/endorsed is not supported. Endorsed standards and standalone APIs\n" 3623 "in modular form will be supported via the concept of upgradeable modules.\n"); 3624 os::closedir(dir); 3625 return JNI_ERR; 3626 } 3627 3628 jio_snprintf(path, JVM_MAXPATHLEN, "%s%slib%sext", Arguments::get_java_home(), fileSep, fileSep); 3629 dir = os::opendir(path); 3630 if (dir != NULL) { 3631 jio_fprintf(defaultStream::output_stream(), 3632 "<JAVA_HOME>/lib/ext exists, extensions mechanism no longer supported; " 3633 "Use -classpath instead.\n."); 3634 os::closedir(dir); 3635 return JNI_ERR; 3636 } 3637 3638 // We need to know if we are running in a container 3639 // to determine the active processor count and available 3640 // memory. 3641 os::initialize_container_support(); 3642 3643 if (AggressiveHeap) { 3644 jint result = set_aggressive_heap_flags(); 3645 if (result != JNI_OK) { 3646 return result; 3647 } 3648 } 3649 3650 // This must be done after all arguments have been processed. 3651 // java_compiler() true means set to "NONE" or empty. 3652 if (java_compiler() && !xdebug_mode()) { 3653 // For backwards compatibility, we switch to interpreted mode if 3654 // -Djava.compiler="NONE" or "" is specified AND "-Xdebug" was 3655 // not specified. 3656 set_mode_flags(_int); 3657 } 3658 3659 // CompileThresholdScaling == 0.0 is same as -Xint: Disable compilation (enable interpreter-only mode), 3660 // but like -Xint, leave compilation thresholds unaffected. 3661 // With tiered compilation disabled, setting CompileThreshold to 0 disables compilation as well. 3662 if ((CompileThresholdScaling == 0.0) || (!TieredCompilation && CompileThreshold == 0)) { 3663 set_mode_flags(_int); 3664 } 3665 3666 // eventually fix up InitialTenuringThreshold if only MaxTenuringThreshold is set 3667 if (FLAG_IS_DEFAULT(InitialTenuringThreshold) && (InitialTenuringThreshold > MaxTenuringThreshold)) { |