Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/arguments.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 | 5b04b33dac74 15085a6eb50c |
children | 227aa994f058 |
comparison
equal
deleted
inserted
replaced
4703:2cfb7fb2dce7 | 4970:33df1aeaebbf |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
106 SystemProperty *Arguments::_compiler_class_path = NULL; | 106 SystemProperty *Arguments::_compiler_class_path = NULL; |
107 #endif | 107 #endif |
108 | 108 |
109 char* Arguments::_meta_index_path = NULL; | 109 char* Arguments::_meta_index_path = NULL; |
110 char* Arguments::_meta_index_dir = NULL; | 110 char* Arguments::_meta_index_dir = NULL; |
111 | |
112 static bool force_client_mode = false; | |
113 | 111 |
114 // Check if head of 'option' matches 'name', and sets 'tail' remaining part of option string | 112 // Check if head of 'option' matches 'name', and sets 'tail' remaining part of option string |
115 | 113 |
116 static bool match_option(const JavaVMOption *option, const char* name, | 114 static bool match_option(const JavaVMOption *option, const char* name, |
117 const char** tail) { | 115 const char** tail) { |
1016 break; | 1014 break; |
1017 case _comp: | 1015 case _comp: |
1018 UseInterpreter = false; | 1016 UseInterpreter = false; |
1019 BackgroundCompilation = false; | 1017 BackgroundCompilation = false; |
1020 ClipInlining = false; | 1018 ClipInlining = false; |
1019 // Be much more aggressive in tiered mode with -Xcomp and exercise C2 more. | |
1020 // We will first compile a level 3 version (C1 with full profiling), then do one invocation of it and | |
1021 // compile a level 4 (C2) and then continue executing it. | |
1022 if (TieredCompilation) { | |
1023 Tier3InvokeNotifyFreqLog = 0; | |
1024 Tier4InvocationThreshold = 0; | |
1025 } | |
1021 break; | 1026 break; |
1022 } | 1027 } |
1023 } | 1028 } |
1024 | 1029 |
1025 // Conflict: required to use shared spaces (-Xshare:on), but | 1030 // Conflict: required to use shared spaces (-Xshare:on), but |
1049 FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 2); | 1054 FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 2); |
1050 } | 1055 } |
1051 } | 1056 } |
1052 | 1057 |
1053 #ifndef KERNEL | 1058 #ifndef KERNEL |
1059 static void disable_adaptive_size_policy(const char* collector_name) { | |
1060 if (UseAdaptiveSizePolicy) { | |
1061 if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) { | |
1062 warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.", | |
1063 collector_name); | |
1064 } | |
1065 FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false); | |
1066 } | |
1067 } | |
1068 | |
1054 // If the user has chosen ParallelGCThreads > 0, we set UseParNewGC | 1069 // If the user has chosen ParallelGCThreads > 0, we set UseParNewGC |
1055 // if it's not explictly set or unset. If the user has chosen | 1070 // if it's not explictly set or unset. If the user has chosen |
1056 // UseParNewGC and not explicitly set ParallelGCThreads we | 1071 // UseParNewGC and not explicitly set ParallelGCThreads we |
1057 // set it, unless this is a single cpu machine. | 1072 // set it, unless this is a single cpu machine. |
1058 void Arguments::set_parnew_gc_flags() { | 1073 void Arguments::set_parnew_gc_flags() { |
1059 assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC, | 1074 assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC, |
1060 "control point invariant"); | 1075 "control point invariant"); |
1061 assert(UseParNewGC, "Error"); | 1076 assert(UseParNewGC, "Error"); |
1062 | 1077 |
1063 // Turn off AdaptiveSizePolicy by default for parnew until it is | 1078 // Turn off AdaptiveSizePolicy for parnew until it is complete. |
1064 // complete. | 1079 disable_adaptive_size_policy("UseParNewGC"); |
1065 if (FLAG_IS_DEFAULT(UseAdaptiveSizePolicy)) { | |
1066 FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false); | |
1067 } | |
1068 | 1080 |
1069 if (ParallelGCThreads == 0) { | 1081 if (ParallelGCThreads == 0) { |
1070 FLAG_SET_DEFAULT(ParallelGCThreads, | 1082 FLAG_SET_DEFAULT(ParallelGCThreads, |
1071 Abstract_VM_Version::parallel_worker_threads()); | 1083 Abstract_VM_Version::parallel_worker_threads()); |
1072 if (ParallelGCThreads == 1) { | 1084 if (ParallelGCThreads == 1) { |
1119 // unless explicitly forbidden. | 1131 // unless explicitly forbidden. |
1120 if (FLAG_IS_DEFAULT(UseParNewGC)) { | 1132 if (FLAG_IS_DEFAULT(UseParNewGC)) { |
1121 FLAG_SET_ERGO(bool, UseParNewGC, true); | 1133 FLAG_SET_ERGO(bool, UseParNewGC, true); |
1122 } | 1134 } |
1123 | 1135 |
1124 // Turn off AdaptiveSizePolicy by default for cms until it is | 1136 // Turn off AdaptiveSizePolicy for CMS until it is complete. |
1125 // complete. | 1137 disable_adaptive_size_policy("UseConcMarkSweepGC"); |
1126 if (FLAG_IS_DEFAULT(UseAdaptiveSizePolicy)) { | |
1127 FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false); | |
1128 } | |
1129 | 1138 |
1130 // In either case, adjust ParallelGCThreads and/or UseParNewGC | 1139 // In either case, adjust ParallelGCThreads and/or UseParNewGC |
1131 // as needed. | 1140 // as needed. |
1132 if (UseParNewGC) { | 1141 if (UseParNewGC) { |
1133 set_parnew_gc_flags(); | 1142 set_parnew_gc_flags(); |
1350 // that they want sharing explicitly, do not set ergonomics flags. | 1359 // that they want sharing explicitly, do not set ergonomics flags. |
1351 if (DumpSharedSpaces || RequireSharedSpaces) { | 1360 if (DumpSharedSpaces || RequireSharedSpaces) { |
1352 return; | 1361 return; |
1353 } | 1362 } |
1354 | 1363 |
1355 if (os::is_server_class_machine() && !force_client_mode ) { | 1364 if (os::is_server_class_machine()) { |
1356 // If no other collector is requested explicitly, | 1365 // If no other collector is requested explicitly, |
1357 // let the VM select the collector based on | 1366 // let the VM select the collector based on |
1358 // machine class and automatic selection policy. | 1367 // machine class and automatic selection policy. |
1359 if (!UseSerialGC && | 1368 if (!UseSerialGC && |
1360 !UseConcMarkSweepGC && | 1369 !UseConcMarkSweepGC && |
1375 #ifdef _LP64 | 1384 #ifdef _LP64 |
1376 // Check that UseCompressedOops can be set with the max heap size allocated | 1385 // Check that UseCompressedOops can be set with the max heap size allocated |
1377 // by ergonomics. | 1386 // by ergonomics. |
1378 if (MaxHeapSize <= max_heap_for_compressed_oops()) { | 1387 if (MaxHeapSize <= max_heap_for_compressed_oops()) { |
1379 #if !defined(COMPILER1) || defined(TIERED) | 1388 #if !defined(COMPILER1) || defined(TIERED) |
1380 // disable UseCompressedOops by default on MacOS X until 7118647 is fixed | |
1381 #ifndef __APPLE__ | |
1382 if (FLAG_IS_DEFAULT(UseCompressedOops)) { | 1389 if (FLAG_IS_DEFAULT(UseCompressedOops)) { |
1383 FLAG_SET_ERGO(bool, UseCompressedOops, true); | 1390 FLAG_SET_ERGO(bool, UseCompressedOops, true); |
1384 } | 1391 } |
1385 #endif // !__APPLE__ | |
1386 #endif | 1392 #endif |
1387 #ifdef _WIN64 | 1393 #ifdef _WIN64 |
1388 if (UseLargePages && UseCompressedOops) { | 1394 if (UseLargePages && UseCompressedOops) { |
1389 // Cannot allocate guard pages for implicit checks in indexed addressing | 1395 // Cannot allocate guard pages for implicit checks in indexed addressing |
1390 // mode, when large pages are specified on windows. | 1396 // mode, when large pages are specified on windows. |
1405 #endif // !ZERO | 1411 #endif // !ZERO |
1406 } | 1412 } |
1407 | 1413 |
1408 void Arguments::set_parallel_gc_flags() { | 1414 void Arguments::set_parallel_gc_flags() { |
1409 assert(UseParallelGC || UseParallelOldGC, "Error"); | 1415 assert(UseParallelGC || UseParallelOldGC, "Error"); |
1410 // If parallel old was requested, automatically enable parallel scavenge. | 1416 // Enable ParallelOld unless it was explicitly disabled (cmd line or rc file). |
1411 if (UseParallelOldGC && !UseParallelGC && FLAG_IS_DEFAULT(UseParallelGC)) { | 1417 if (FLAG_IS_DEFAULT(UseParallelOldGC)) { |
1412 FLAG_SET_DEFAULT(UseParallelGC, true); | 1418 FLAG_SET_DEFAULT(UseParallelOldGC, true); |
1413 } | 1419 } |
1420 FLAG_SET_DEFAULT(UseParallelGC, true); | |
1414 | 1421 |
1415 // If no heap maximum was requested explicitly, use some reasonable fraction | 1422 // If no heap maximum was requested explicitly, use some reasonable fraction |
1416 // of the physical memory, up to a maximum of 1GB. | 1423 // of the physical memory, up to a maximum of 1GB. |
1417 if (UseParallelGC) { | 1424 if (UseParallelGC) { |
1418 FLAG_SET_DEFAULT(ParallelGCThreads, | 1425 FLAG_SET_DEFAULT(ParallelGCThreads, |
2433 VM_Version::internal_vm_info_string()); | 2440 VM_Version::internal_vm_info_string()); |
2434 vm_exit(0); | 2441 vm_exit(0); |
2435 #ifndef PRODUCT | 2442 #ifndef PRODUCT |
2436 // -Xprintflags | 2443 // -Xprintflags |
2437 } else if (match_option(option, "-Xprintflags", &tail)) { | 2444 } else if (match_option(option, "-Xprintflags", &tail)) { |
2438 CommandLineFlags::printFlags(); | 2445 CommandLineFlags::printFlags(tty, false); |
2439 vm_exit(0); | 2446 vm_exit(0); |
2440 #endif | 2447 #endif |
2441 // -D | 2448 // -D |
2442 } else if (match_option(option, "-D", &tail)) { | 2449 } else if (match_option(option, "-D", &tail)) { |
2443 if (!add_property(tail)) { | 2450 if (!add_property(tail)) { |
3049 | 3056 |
3050 // Sharing support | 3057 // Sharing support |
3051 // Construct the path to the archive | 3058 // Construct the path to the archive |
3052 char jvm_path[JVM_MAXPATHLEN]; | 3059 char jvm_path[JVM_MAXPATHLEN]; |
3053 os::jvm_path(jvm_path, sizeof(jvm_path)); | 3060 os::jvm_path(jvm_path, sizeof(jvm_path)); |
3054 #ifdef TIERED | |
3055 if (strstr(jvm_path, "client") != NULL) { | |
3056 force_client_mode = true; | |
3057 } | |
3058 #endif // TIERED | |
3059 char *end = strrchr(jvm_path, *os::file_separator()); | 3061 char *end = strrchr(jvm_path, *os::file_separator()); |
3060 if (end != NULL) *end = '\0'; | 3062 if (end != NULL) *end = '\0'; |
3061 char *shared_archive_path = NEW_C_HEAP_ARRAY(char, strlen(jvm_path) + | 3063 char *shared_archive_path = NEW_C_HEAP_ARRAY(char, strlen(jvm_path) + |
3062 strlen(os::file_separator()) + 20); | 3064 strlen(os::file_separator()) + 20); |
3063 if (shared_archive_path == NULL) return JNI_ENOMEM; | 3065 if (shared_archive_path == NULL) return JNI_ENOMEM; |
3092 } | 3094 } |
3093 if (match_option(option, "-XX:-IgnoreUnrecognizedVMOptions", &tail)) { | 3095 if (match_option(option, "-XX:-IgnoreUnrecognizedVMOptions", &tail)) { |
3094 IgnoreUnrecognizedVMOptions = false; | 3096 IgnoreUnrecognizedVMOptions = false; |
3095 } | 3097 } |
3096 if (match_option(option, "-XX:+PrintFlagsInitial", &tail)) { | 3098 if (match_option(option, "-XX:+PrintFlagsInitial", &tail)) { |
3097 CommandLineFlags::printFlags(); | 3099 CommandLineFlags::printFlags(tty, false); |
3098 vm_exit(0); | 3100 vm_exit(0); |
3099 } | 3101 } |
3100 | 3102 |
3101 #ifndef PRODUCT | 3103 #ifndef PRODUCT |
3102 if (match_option(option, "-XX:+PrintFlagsWithComments", &tail)) { | 3104 if (match_option(option, "-XX:+PrintFlagsWithComments", &tail)) { |
3103 CommandLineFlags::printFlags(true); | 3105 CommandLineFlags::printFlags(tty, true); |
3104 vm_exit(0); | 3106 vm_exit(0); |
3105 } | 3107 } |
3106 #endif | 3108 #endif |
3107 } | 3109 } |
3108 | 3110 |
3274 | 3276 |
3275 #ifdef COMPILER2 | 3277 #ifdef COMPILER2 |
3276 if (!UseBiasedLocking || EmitSync != 0) { | 3278 if (!UseBiasedLocking || EmitSync != 0) { |
3277 UseOptoBiasInlining = false; | 3279 UseOptoBiasInlining = false; |
3278 } | 3280 } |
3281 if (!EliminateLocks) { | |
3282 EliminateNestedLocks = false; | |
3283 } | |
3279 #endif | 3284 #endif |
3280 | 3285 |
3281 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) { | 3286 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) { |
3282 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output"); | 3287 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output"); |
3283 DebugNonSafepoints = true; | 3288 DebugNonSafepoints = true; |
3291 } | 3296 } |
3292 } | 3297 } |
3293 #endif | 3298 #endif |
3294 | 3299 |
3295 if (PrintCommandLineFlags) { | 3300 if (PrintCommandLineFlags) { |
3296 CommandLineFlags::printSetFlags(); | 3301 CommandLineFlags::printSetFlags(tty); |
3297 } | 3302 } |
3298 | 3303 |
3299 // Apply CPU specific policy for the BiasedLocking | 3304 // Apply CPU specific policy for the BiasedLocking |
3300 if (UseBiasedLocking) { | 3305 if (UseBiasedLocking) { |
3301 if (!VM_Version::use_biased_locking() && | 3306 if (!VM_Version::use_biased_locking() && |