2216 MarkSweepAlwaysCompactCount = 1; // Move objects every gc.
2217 }
2218
2219 if (UseParallelOldGC && ParallelOldGCSplitALot) {
2220 // Settings to encourage splitting.
2221 if (!FLAG_IS_CMDLINE(NewRatio)) {
2222 FLAG_SET_CMDLINE(uintx, NewRatio, 2);
2223 }
2224 if (!FLAG_IS_CMDLINE(ScavengeBeforeFullGC)) {
2225 FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false);
2226 }
2227 }
2228
2229 status = status && verify_percentage(GCHeapFreeLimit, "GCHeapFreeLimit");
2230 status = status && verify_percentage(GCTimeLimit, "GCTimeLimit");
2231 if (GCTimeLimit == 100) {
2232 // Turn off gc-overhead-limit-exceeded checks
2233 FLAG_SET_DEFAULT(UseGCOverheadLimit, false);
2234 }
2235
2236 status = status && ArgumentsExt::check_gc_consistency_user();
2237 status = status && check_stack_pages();
2238
2239 if (CMSIncrementalMode) {
2240 if (!UseConcMarkSweepGC) {
2241 jio_fprintf(defaultStream::error_stream(),
2242 "error: invalid argument combination.\n"
2243 "The CMS collector (-XX:+UseConcMarkSweepGC) must be "
2244 "selected in order\nto use CMSIncrementalMode.\n");
2245 status = false;
2246 } else {
2247 status = status && verify_percentage(CMSIncrementalDutyCycle,
2248 "CMSIncrementalDutyCycle");
2249 status = status && verify_percentage(CMSIncrementalDutyCycleMin,
2250 "CMSIncrementalDutyCycleMin");
2251 status = status && verify_percentage(CMSIncrementalSafetyFactor,
2252 "CMSIncrementalSafetyFactor");
2253 status = status && verify_percentage(CMSIncrementalOffset,
2254 "CMSIncrementalOffset");
2255 status = status && verify_percentage(CMSExpAvgFactor,
2256 "CMSExpAvgFactor");
2945 } else if (match_option(option, "-Xconcurrentio", &tail)) {
2946 FLAG_SET_CMDLINE(bool, UseLWPSynchronization, true);
2947 FLAG_SET_CMDLINE(bool, BackgroundCompilation, false);
2948 FLAG_SET_CMDLINE(intx, DeferThrSuspendLoopCount, 1);
2949 FLAG_SET_CMDLINE(bool, UseTLAB, false);
2950 FLAG_SET_CMDLINE(uintx, NewSizeThreadIncrease, 16 * K); // 20Kb per thread added to new generation
2951
2952 // -Xinternalversion
2953 } else if (match_option(option, "-Xinternalversion", &tail)) {
2954 jio_fprintf(defaultStream::output_stream(), "%s\n",
2955 VM_Version::internal_vm_info_string());
2956 vm_exit(0);
2957 #ifndef PRODUCT
2958 // -Xprintflags
2959 } else if (match_option(option, "-Xprintflags", &tail)) {
2960 CommandLineFlags::printFlags(tty, false);
2961 vm_exit(0);
2962 #endif
2963 // -D
2964 } else if (match_option(option, "-D", &tail)) {
2965 if (!add_property(tail)) {
2966 return JNI_ENOMEM;
2967 }
2968 // Out of the box management support
2969 if (match_option(option, "-Dcom.sun.management", &tail)) {
2970 #if INCLUDE_MANAGEMENT
2971 FLAG_SET_CMDLINE(bool, ManagementServer, true);
2972 #else
2973 jio_fprintf(defaultStream::output_stream(),
2974 "-Dcom.sun.management is not supported in this VM.\n");
2975 return JNI_ERR;
2976 #endif
2977 }
2978 // -Xint
2979 } else if (match_option(option, "-Xint", &tail)) {
2980 set_mode_flags(_int);
2981 // -Xmixed
2982 } else if (match_option(option, "-Xmixed", &tail)) {
2983 set_mode_flags(_mixed);
2984 // -Xcomp
3378 for (char* tail = copy + strlen(copy) - 1; tail >= copy && *tail == separator; tail--) {
3379 *tail = '\0';
3380 }
3381
3382 char from[3] = {separator, separator, '\0'};
3383 char to [2] = {separator, '\0'};
3384 while (StringUtils::replace_no_expand(copy, from, to) > 0) {
3385 // Keep replacing "::" -> ":" until we have no more "::" (non-windows)
3386 // Keep replacing ";;" -> ";" until we have no more ";;" (windows)
3387 }
3388
3389 _java_class_path->set_value(copy);
3390 FreeHeap(copy); // a copy was made by set_value, so don't need this anymore
3391 }
3392
3393 if (!PrintSharedArchiveAndExit) {
3394 ClassLoader::trace_class_path("[classpath: ", _java_class_path->value());
3395 }
3396 }
3397
3398 jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required) {
3399 // This must be done after all -D arguments have been processed.
3400 scp_p->expand_endorsed();
3401
3402 if (scp_assembly_required || scp_p->get_endorsed() != NULL) {
3403 // Assemble the bootclasspath elements into the final path.
3404 Arguments::set_sysclasspath(scp_p->combined_path());
3405 }
3406
3407 // This must be done after all arguments have been processed.
3408 // java_compiler() true means set to "NONE" or empty.
3409 if (java_compiler() && !xdebug_mode()) {
3410 // For backwards compatibility, we switch to interpreted mode if
3411 // -Djava.compiler="NONE" or "" is specified AND "-Xdebug" was
3412 // not specified.
3413 set_mode_flags(_int);
3414 }
3415 if (CompileThreshold == 0) {
3416 set_mode_flags(_int);
3417 }
3418
3419 // eventually fix up InitialTenuringThreshold if only MaxTenuringThreshold is set
3420 if (FLAG_IS_DEFAULT(InitialTenuringThreshold) && (InitialTenuringThreshold > MaxTenuringThreshold)) {
3421 FLAG_SET_ERGO(uintx, InitialTenuringThreshold, MaxTenuringThreshold);
3422 }
3423
3424 #ifndef COMPILER2
3425 // Don't degrade server performance for footprint
3426 if (FLAG_IS_DEFAULT(UseLargePages) &&
3447 // Also allow the OS environment variable JAVA_AWT_HEADLESS to set headless state.
3448 if (os::is_headless_jre()) {
3449 const char* headless = Arguments::get_property("java.awt.headless");
3450 if (headless == NULL) {
3451 char envbuffer[128];
3452 if (!os::getenv("JAVA_AWT_HEADLESS", envbuffer, sizeof(envbuffer))) {
3453 if (!add_property("java.awt.headless=true")) {
3454 return JNI_ENOMEM;
3455 }
3456 } else {
3457 char buffer[256];
3458 strcpy(buffer, "java.awt.headless=");
3459 strcat(buffer, envbuffer);
3460 if (!add_property(buffer)) {
3461 return JNI_ENOMEM;
3462 }
3463 }
3464 }
3465 }
3466
3467 if (!ArgumentsExt::check_vm_args_consistency()) {
3468 return JNI_ERR;
3469 }
3470
3471 return JNI_OK;
3472 }
3473
3474 jint Arguments::parse_java_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p) {
3475 return parse_options_environment_variable("_JAVA_OPTIONS", scp_p,
3476 scp_assembly_required_p);
3477 }
3478
3479 jint Arguments::parse_java_tool_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p) {
3480 return parse_options_environment_variable("JAVA_TOOL_OPTIONS", scp_p,
3481 scp_assembly_required_p);
3482 }
3483
3484 jint Arguments::parse_options_environment_variable(const char* name, SysClassPath* scp_p, bool* scp_assembly_required_p) {
3485 const int N_MAX_OPTIONS = 64;
3486 const int OPTION_BUFFER_SIZE = 1024;
3487 char buffer[OPTION_BUFFER_SIZE];
3850 }
3851
3852 if (TieredCompilation) {
3853 set_tiered_flags();
3854 } else {
3855 // Check if the policy is valid. Policies 0 and 1 are valid for non-tiered setup.
3856 if (CompilationPolicyChoice >= 2) {
3857 vm_exit_during_initialization(
3858 "Incompatible compilation policy selected", NULL);
3859 }
3860 }
3861 // Set NmethodSweepFraction after the size of the code cache is adapted (in case of tiered)
3862 if (FLAG_IS_DEFAULT(NmethodSweepFraction)) {
3863 FLAG_SET_DEFAULT(NmethodSweepFraction, 1 + ReservedCodeCacheSize / (16 * M));
3864 }
3865
3866
3867 // Set heap size based on available physical memory
3868 set_heap_size();
3869
3870 set_gc_specific_flags();
3871
3872 // Initialize Metaspace flags and alignments.
3873 Metaspace::ergo_initialize();
3874
3875 // Set bytecode rewriting flags
3876 set_bytecode_flags();
3877
3878 // Set flags if Aggressive optimization flags (-XX:+AggressiveOpts) enabled.
3879 set_aggressive_opts_flags();
3880
3881 // Turn off biased locking for locking debug mode flags,
3882 // which are subtlely different from each other but neither works with
3883 // biased locking.
3884 if (UseHeavyMonitors
3885 #ifdef COMPILER1
3886 || !UseFastLocking
3887 #endif // COMPILER1
3888 ) {
3889 if (!FLAG_IS_DEFAULT(UseBiasedLocking) && UseBiasedLocking) {
3890 // flag set to true on command line; warn the user that they
|
2216 MarkSweepAlwaysCompactCount = 1; // Move objects every gc.
2217 }
2218
2219 if (UseParallelOldGC && ParallelOldGCSplitALot) {
2220 // Settings to encourage splitting.
2221 if (!FLAG_IS_CMDLINE(NewRatio)) {
2222 FLAG_SET_CMDLINE(uintx, NewRatio, 2);
2223 }
2224 if (!FLAG_IS_CMDLINE(ScavengeBeforeFullGC)) {
2225 FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false);
2226 }
2227 }
2228
2229 status = status && verify_percentage(GCHeapFreeLimit, "GCHeapFreeLimit");
2230 status = status && verify_percentage(GCTimeLimit, "GCTimeLimit");
2231 if (GCTimeLimit == 100) {
2232 // Turn off gc-overhead-limit-exceeded checks
2233 FLAG_SET_DEFAULT(UseGCOverheadLimit, false);
2234 }
2235
2236 status = status && check_gc_consistency_user();
2237 status = status && check_stack_pages();
2238
2239 if (CMSIncrementalMode) {
2240 if (!UseConcMarkSweepGC) {
2241 jio_fprintf(defaultStream::error_stream(),
2242 "error: invalid argument combination.\n"
2243 "The CMS collector (-XX:+UseConcMarkSweepGC) must be "
2244 "selected in order\nto use CMSIncrementalMode.\n");
2245 status = false;
2246 } else {
2247 status = status && verify_percentage(CMSIncrementalDutyCycle,
2248 "CMSIncrementalDutyCycle");
2249 status = status && verify_percentage(CMSIncrementalDutyCycleMin,
2250 "CMSIncrementalDutyCycleMin");
2251 status = status && verify_percentage(CMSIncrementalSafetyFactor,
2252 "CMSIncrementalSafetyFactor");
2253 status = status && verify_percentage(CMSIncrementalOffset,
2254 "CMSIncrementalOffset");
2255 status = status && verify_percentage(CMSExpAvgFactor,
2256 "CMSExpAvgFactor");
2945 } else if (match_option(option, "-Xconcurrentio", &tail)) {
2946 FLAG_SET_CMDLINE(bool, UseLWPSynchronization, true);
2947 FLAG_SET_CMDLINE(bool, BackgroundCompilation, false);
2948 FLAG_SET_CMDLINE(intx, DeferThrSuspendLoopCount, 1);
2949 FLAG_SET_CMDLINE(bool, UseTLAB, false);
2950 FLAG_SET_CMDLINE(uintx, NewSizeThreadIncrease, 16 * K); // 20Kb per thread added to new generation
2951
2952 // -Xinternalversion
2953 } else if (match_option(option, "-Xinternalversion", &tail)) {
2954 jio_fprintf(defaultStream::output_stream(), "%s\n",
2955 VM_Version::internal_vm_info_string());
2956 vm_exit(0);
2957 #ifndef PRODUCT
2958 // -Xprintflags
2959 } else if (match_option(option, "-Xprintflags", &tail)) {
2960 CommandLineFlags::printFlags(tty, false);
2961 vm_exit(0);
2962 #endif
2963 // -D
2964 } else if (match_option(option, "-D", &tail)) {
2965 if (CheckEndorsedAndExtDirs) {
2966 if (match_option(option, "-Djava.endorsed.dirs=", &tail)) {
2967 // abort if -Djava.endorsed.dirs is set
2968 jio_fprintf(defaultStream::output_stream(),
2969 "-Djava.endorsed.dirs will not be supported in a future release.\n"
2970 "Refer to JEP 220 for details (http://openjdk.java.net/jeps/220).\n");
2971 return JNI_EINVAL;
2972 }
2973 if (match_option(option, "-Djava.ext.dirs=", &tail)) {
2974 // abort if -Djava.ext.dirs is set
2975 jio_fprintf(defaultStream::output_stream(),
2976 "-Djava.ext.dirs will not be supported in a future release.\n"
2977 "Refer to JEP 220 for details (http://openjdk.java.net/jeps/220).\n");
2978 return JNI_EINVAL;
2979 }
2980 }
2981
2982 if (!add_property(tail)) {
2983 return JNI_ENOMEM;
2984 }
2985 // Out of the box management support
2986 if (match_option(option, "-Dcom.sun.management", &tail)) {
2987 #if INCLUDE_MANAGEMENT
2988 FLAG_SET_CMDLINE(bool, ManagementServer, true);
2989 #else
2990 jio_fprintf(defaultStream::output_stream(),
2991 "-Dcom.sun.management is not supported in this VM.\n");
2992 return JNI_ERR;
2993 #endif
2994 }
2995 // -Xint
2996 } else if (match_option(option, "-Xint", &tail)) {
2997 set_mode_flags(_int);
2998 // -Xmixed
2999 } else if (match_option(option, "-Xmixed", &tail)) {
3000 set_mode_flags(_mixed);
3001 // -Xcomp
3395 for (char* tail = copy + strlen(copy) - 1; tail >= copy && *tail == separator; tail--) {
3396 *tail = '\0';
3397 }
3398
3399 char from[3] = {separator, separator, '\0'};
3400 char to [2] = {separator, '\0'};
3401 while (StringUtils::replace_no_expand(copy, from, to) > 0) {
3402 // Keep replacing "::" -> ":" until we have no more "::" (non-windows)
3403 // Keep replacing ";;" -> ";" until we have no more ";;" (windows)
3404 }
3405
3406 _java_class_path->set_value(copy);
3407 FreeHeap(copy); // a copy was made by set_value, so don't need this anymore
3408 }
3409
3410 if (!PrintSharedArchiveAndExit) {
3411 ClassLoader::trace_class_path("[classpath: ", _java_class_path->value());
3412 }
3413 }
3414
3415 static bool has_jar_files(const char* directory) {
3416 DIR* dir = os::opendir(directory);
3417 if (dir == NULL) return false;
3418
3419 struct dirent *entry;
3420 char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(directory), mtInternal);
3421 bool hasJarFile = false;
3422 while (!hasJarFile && (entry = os::readdir(dir, (dirent *) dbuf)) != NULL) {
3423 const char* name = entry->d_name;
3424 const char* ext = name + strlen(name) - 4;
3425 hasJarFile = ext > name && (os::file_name_strcmp(ext, ".jar") == 0);
3426 }
3427 FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
3428 os::closedir(dir);
3429 return hasJarFile ;
3430 }
3431
3432 // returns the number of directories in the given path containing JAR files
3433 // If the skip argument is not NULL, it will skip that directory
3434 static int check_non_empty_dirs(const char* path, const char* type, const char* skip) {
3435 const char separator = *os::path_separator();
3436 const char* const end = path + strlen(path);
3437 int nonEmptyDirs = 0;
3438 while (path < end) {
3439 const char* tmp_end = strchr(path, separator);
3440 if (tmp_end == NULL) {
3441 if ((skip == NULL || strcmp(path, skip) != 0) && has_jar_files(path)) {
3442 nonEmptyDirs++;
3443 jio_fprintf(defaultStream::output_stream(),
3444 "Non-empty %s directory: %s\n", type, path);
3445 }
3446 path = end;
3447 } else {
3448 char* dirpath = NEW_C_HEAP_ARRAY(char, tmp_end - path + 1, mtInternal);
3449 memcpy(dirpath, path, tmp_end - path);
3450 dirpath[tmp_end - path] = '\0';
3451 if ((skip == NULL || strcmp(dirpath, skip) != 0) && has_jar_files(dirpath)) {
3452 nonEmptyDirs++;
3453 jio_fprintf(defaultStream::output_stream(),
3454 "Non-empty %s directory: %s\n", type, dirpath);
3455 }
3456 FREE_C_HEAP_ARRAY(char, dirpath, mtInternal);
3457 path = tmp_end + 1;
3458 }
3459 }
3460 return nonEmptyDirs;
3461 }
3462
3463 // Returns true if endorsed standards override mechanism and extension mechanism
3464 // are not used.
3465 static bool check_endorsed_and_ext_dirs() {
3466 if (!CheckEndorsedAndExtDirs)
3467 return true;
3468
3469 char endorsedDir[JVM_MAXPATHLEN];
3470 char extDir[JVM_MAXPATHLEN];
3471 const char* fileSep = os::file_separator();
3472 jio_snprintf(endorsedDir, sizeof(endorsedDir), "%s%slib%sendorsed",
3473 Arguments::get_java_home(), fileSep, fileSep);
3474 jio_snprintf(extDir, sizeof(extDir), "%s%slib%sext",
3475 Arguments::get_java_home(), fileSep, fileSep);
3476
3477 // check endorsed directory
3478 int nonEmptyDirs = check_non_empty_dirs(Arguments::get_endorsed_dir(), "endorsed", NULL);
3479
3480 // check the extension directories but skip the default lib/ext directory
3481 nonEmptyDirs += check_non_empty_dirs(Arguments::get_ext_dirs(), "extension", extDir);
3482
3483 // List of JAR files installed in the default lib/ext directory.
3484 // -XX:+CheckEndorsedAndExtDirs checks if any non-JDK file installed
3485 static const char* jdk_ext_jars[] = {
3486 "access-bridge-32.jar",
3487 "access-bridge-64.jar",
3488 "access-bridge.jar",
3489 "cldrdata.jar",
3490 "dnsns.jar",
3491 "jaccess.jar",
3492 "jfxrt.jar",
3493 "localedata.jar",
3494 "nashorn.jar",
3495 "sunec.jar",
3496 "sunjce_provider.jar",
3497 "sunmscapi.jar",
3498 "sunpkcs11.jar",
3499 "ucrypto.jar",
3500 "zipfs.jar",
3501 NULL
3502 };
3503
3504 // check if the default lib/ext directory has any non-JDK jar files; if so, error
3505 DIR* dir = os::opendir(extDir);
3506 if (dir != NULL) {
3507 int num_ext_jars = 0;
3508 struct dirent *entry;
3509 char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(extDir), mtInternal);
3510 while ((entry = os::readdir(dir, (dirent *) dbuf)) != NULL) {
3511 const char* name = entry->d_name;
3512 const char* ext = name + strlen(name) - 4;
3513 if (ext > name && (os::file_name_strcmp(ext, ".jar") == 0)) {
3514 bool is_jdk_jar = false;
3515 const char* jarfile = NULL;
3516 for (int i=0; (jarfile = jdk_ext_jars[i]) != NULL; i++) {
3517 if (os::file_name_strcmp(name, jarfile) == 0) {
3518 is_jdk_jar = true;
3519 break;
3520 }
3521 }
3522 if (!is_jdk_jar) {
3523 jio_fprintf(defaultStream::output_stream(),
3524 "%s installed in <JAVA_HOME>/lib/ext\n", name);
3525 num_ext_jars++;
3526 }
3527 }
3528 }
3529 FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
3530 os::closedir(dir);
3531 if (num_ext_jars > 0) {
3532 nonEmptyDirs += 1;
3533 }
3534 }
3535
3536 // check if the default lib/endorsed directory exists; if so, error
3537 dir = os::opendir(endorsedDir);
3538 if (dir != NULL) {
3539 jio_fprintf(defaultStream::output_stream(), "<JAVA_HOME>/lib/endorsed exists\n");
3540 os::closedir(dir);
3541 nonEmptyDirs += 1;
3542 }
3543
3544 if (nonEmptyDirs > 0) {
3545 jio_fprintf(defaultStream::output_stream(),
3546 "Endorsed standards override mechanism and extension mechanism"
3547 "will not be supported in a future release.\n"
3548 "Refer to JEP 220 for details (http://openjdk.java.net/jeps/220).\n");
3549 return false;
3550 }
3551
3552 return true;
3553 }
3554
3555 jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required) {
3556 // This must be done after all -D arguments have been processed.
3557 scp_p->expand_endorsed();
3558
3559 if (scp_assembly_required || scp_p->get_endorsed() != NULL) {
3560 // Assemble the bootclasspath elements into the final path.
3561 Arguments::set_sysclasspath(scp_p->combined_path());
3562 }
3563
3564 if (!check_endorsed_and_ext_dirs()) {
3565 return JNI_ERR;
3566 }
3567
3568 // This must be done after all arguments have been processed.
3569 // java_compiler() true means set to "NONE" or empty.
3570 if (java_compiler() && !xdebug_mode()) {
3571 // For backwards compatibility, we switch to interpreted mode if
3572 // -Djava.compiler="NONE" or "" is specified AND "-Xdebug" was
3573 // not specified.
3574 set_mode_flags(_int);
3575 }
3576 if (CompileThreshold == 0) {
3577 set_mode_flags(_int);
3578 }
3579
3580 // eventually fix up InitialTenuringThreshold if only MaxTenuringThreshold is set
3581 if (FLAG_IS_DEFAULT(InitialTenuringThreshold) && (InitialTenuringThreshold > MaxTenuringThreshold)) {
3582 FLAG_SET_ERGO(uintx, InitialTenuringThreshold, MaxTenuringThreshold);
3583 }
3584
3585 #ifndef COMPILER2
3586 // Don't degrade server performance for footprint
3587 if (FLAG_IS_DEFAULT(UseLargePages) &&
3608 // Also allow the OS environment variable JAVA_AWT_HEADLESS to set headless state.
3609 if (os::is_headless_jre()) {
3610 const char* headless = Arguments::get_property("java.awt.headless");
3611 if (headless == NULL) {
3612 char envbuffer[128];
3613 if (!os::getenv("JAVA_AWT_HEADLESS", envbuffer, sizeof(envbuffer))) {
3614 if (!add_property("java.awt.headless=true")) {
3615 return JNI_ENOMEM;
3616 }
3617 } else {
3618 char buffer[256];
3619 strcpy(buffer, "java.awt.headless=");
3620 strcat(buffer, envbuffer);
3621 if (!add_property(buffer)) {
3622 return JNI_ENOMEM;
3623 }
3624 }
3625 }
3626 }
3627
3628 if (!check_vm_args_consistency()) {
3629 return JNI_ERR;
3630 }
3631
3632 return JNI_OK;
3633 }
3634
3635 jint Arguments::parse_java_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p) {
3636 return parse_options_environment_variable("_JAVA_OPTIONS", scp_p,
3637 scp_assembly_required_p);
3638 }
3639
3640 jint Arguments::parse_java_tool_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p) {
3641 return parse_options_environment_variable("JAVA_TOOL_OPTIONS", scp_p,
3642 scp_assembly_required_p);
3643 }
3644
3645 jint Arguments::parse_options_environment_variable(const char* name, SysClassPath* scp_p, bool* scp_assembly_required_p) {
3646 const int N_MAX_OPTIONS = 64;
3647 const int OPTION_BUFFER_SIZE = 1024;
3648 char buffer[OPTION_BUFFER_SIZE];
4011 }
4012
4013 if (TieredCompilation) {
4014 set_tiered_flags();
4015 } else {
4016 // Check if the policy is valid. Policies 0 and 1 are valid for non-tiered setup.
4017 if (CompilationPolicyChoice >= 2) {
4018 vm_exit_during_initialization(
4019 "Incompatible compilation policy selected", NULL);
4020 }
4021 }
4022 // Set NmethodSweepFraction after the size of the code cache is adapted (in case of tiered)
4023 if (FLAG_IS_DEFAULT(NmethodSweepFraction)) {
4024 FLAG_SET_DEFAULT(NmethodSweepFraction, 1 + ReservedCodeCacheSize / (16 * M));
4025 }
4026
4027
4028 // Set heap size based on available physical memory
4029 set_heap_size();
4030
4031 ArgumentsExt::set_gc_specific_flags();
4032
4033 // Initialize Metaspace flags and alignments.
4034 Metaspace::ergo_initialize();
4035
4036 // Set bytecode rewriting flags
4037 set_bytecode_flags();
4038
4039 // Set flags if Aggressive optimization flags (-XX:+AggressiveOpts) enabled.
4040 set_aggressive_opts_flags();
4041
4042 // Turn off biased locking for locking debug mode flags,
4043 // which are subtlely different from each other but neither works with
4044 // biased locking.
4045 if (UseHeavyMonitors
4046 #ifdef COMPILER1
4047 || !UseFastLocking
4048 #endif // COMPILER1
4049 ) {
4050 if (!FLAG_IS_DEFAULT(UseBiasedLocking) && UseBiasedLocking) {
4051 // flag set to true on command line; warn the user that they
|