Mercurial > hg > graal-compiler
comparison src/share/vm/runtime/arguments.cpp @ 6152:958bb4b7be49
Merge
author | asaha |
---|---|
date | Tue, 10 Apr 2012 10:42:34 -0700 |
parents | 1e76463170b3 ad412114302a |
children | 84e198dc2474 |
comparison
equal
deleted
inserted
replaced
6151:e778c29768e6 | 6152:958bb4b7be49 |
---|---|
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. |
99 SystemProperty *Arguments::_java_class_path = NULL; | 99 SystemProperty *Arguments::_java_class_path = NULL; |
100 SystemProperty *Arguments::_sun_boot_class_path = NULL; | 100 SystemProperty *Arguments::_sun_boot_class_path = NULL; |
101 | 101 |
102 char* Arguments::_meta_index_path = NULL; | 102 char* Arguments::_meta_index_path = NULL; |
103 char* Arguments::_meta_index_dir = NULL; | 103 char* Arguments::_meta_index_dir = NULL; |
104 | |
105 static bool force_client_mode = false; | |
106 | 104 |
107 // Check if head of 'option' matches 'name', and sets 'tail' remaining part of option string | 105 // Check if head of 'option' matches 'name', and sets 'tail' remaining part of option string |
108 | 106 |
109 static bool match_option(const JavaVMOption *option, const char* name, | 107 static bool match_option(const JavaVMOption *option, const char* name, |
110 const char** tail) { | 108 const char** tail) { |
816 since.to_string(version, sizeof(version)); | 814 since.to_string(version, sizeof(version)); |
817 warning("ignoring option %s; support was removed in %s", argname, version); | 815 warning("ignoring option %s; support was removed in %s", argname, version); |
818 return true; | 816 return true; |
819 } | 817 } |
820 | 818 |
821 jio_fprintf(defaultStream::error_stream(), | 819 // For locked flags, report a custom error message if available. |
822 "Unrecognized VM option '%s'\n", argname); | 820 // Otherwise, report the standard unrecognized VM option. |
821 | |
822 Flag* locked_flag = Flag::find_flag((char*)argname, strlen(argname), true); | |
823 if (locked_flag != NULL) { | |
824 char locked_message_buf[BUFLEN]; | |
825 locked_flag->get_locked_message(locked_message_buf, BUFLEN); | |
826 if (strlen(locked_message_buf) == 0) { | |
827 jio_fprintf(defaultStream::error_stream(), | |
828 "Unrecognized VM option '%s'\n", argname); | |
829 } else { | |
830 jio_fprintf(defaultStream::error_stream(), "%s", locked_message_buf); | |
831 } | |
832 } | |
833 | |
823 // allow for commandline "commenting out" options like -XX:#+Verbose | 834 // allow for commandline "commenting out" options like -XX:#+Verbose |
824 return arg[0] == '#'; | 835 return arg[0] == '#'; |
825 } | 836 } |
826 | 837 |
827 bool Arguments::process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized) { | 838 bool Arguments::process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized) { |
1038 FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 2); | 1049 FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 2); |
1039 } | 1050 } |
1040 } | 1051 } |
1041 | 1052 |
1042 #ifndef KERNEL | 1053 #ifndef KERNEL |
1054 static void disable_adaptive_size_policy(const char* collector_name) { | |
1055 if (UseAdaptiveSizePolicy) { | |
1056 if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) { | |
1057 warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.", | |
1058 collector_name); | |
1059 } | |
1060 FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false); | |
1061 } | |
1062 } | |
1063 | |
1043 // If the user has chosen ParallelGCThreads > 0, we set UseParNewGC | 1064 // If the user has chosen ParallelGCThreads > 0, we set UseParNewGC |
1044 // if it's not explictly set or unset. If the user has chosen | 1065 // if it's not explictly set or unset. If the user has chosen |
1045 // UseParNewGC and not explicitly set ParallelGCThreads we | 1066 // UseParNewGC and not explicitly set ParallelGCThreads we |
1046 // set it, unless this is a single cpu machine. | 1067 // set it, unless this is a single cpu machine. |
1047 void Arguments::set_parnew_gc_flags() { | 1068 void Arguments::set_parnew_gc_flags() { |
1048 assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC, | 1069 assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC, |
1049 "control point invariant"); | 1070 "control point invariant"); |
1050 assert(UseParNewGC, "Error"); | 1071 assert(UseParNewGC, "Error"); |
1051 | 1072 |
1052 // Turn off AdaptiveSizePolicy by default for parnew until it is | 1073 // Turn off AdaptiveSizePolicy for parnew until it is complete. |
1053 // complete. | 1074 disable_adaptive_size_policy("UseParNewGC"); |
1054 if (FLAG_IS_DEFAULT(UseAdaptiveSizePolicy)) { | |
1055 FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false); | |
1056 } | |
1057 | 1075 |
1058 if (ParallelGCThreads == 0) { | 1076 if (ParallelGCThreads == 0) { |
1059 FLAG_SET_DEFAULT(ParallelGCThreads, | 1077 FLAG_SET_DEFAULT(ParallelGCThreads, |
1060 Abstract_VM_Version::parallel_worker_threads()); | 1078 Abstract_VM_Version::parallel_worker_threads()); |
1061 if (ParallelGCThreads == 1) { | 1079 if (ParallelGCThreads == 1) { |
1108 // unless explicitly forbidden. | 1126 // unless explicitly forbidden. |
1109 if (FLAG_IS_DEFAULT(UseParNewGC)) { | 1127 if (FLAG_IS_DEFAULT(UseParNewGC)) { |
1110 FLAG_SET_ERGO(bool, UseParNewGC, true); | 1128 FLAG_SET_ERGO(bool, UseParNewGC, true); |
1111 } | 1129 } |
1112 | 1130 |
1113 // Turn off AdaptiveSizePolicy by default for cms until it is | 1131 // Turn off AdaptiveSizePolicy for CMS until it is complete. |
1114 // complete. | 1132 disable_adaptive_size_policy("UseConcMarkSweepGC"); |
1115 if (FLAG_IS_DEFAULT(UseAdaptiveSizePolicy)) { | |
1116 FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false); | |
1117 } | |
1118 | 1133 |
1119 // In either case, adjust ParallelGCThreads and/or UseParNewGC | 1134 // In either case, adjust ParallelGCThreads and/or UseParNewGC |
1120 // as needed. | 1135 // as needed. |
1121 if (UseParNewGC) { | 1136 if (UseParNewGC) { |
1122 set_parnew_gc_flags(); | 1137 set_parnew_gc_flags(); |
1339 // that they want sharing explicitly, do not set ergonomics flags. | 1354 // that they want sharing explicitly, do not set ergonomics flags. |
1340 if (DumpSharedSpaces || RequireSharedSpaces) { | 1355 if (DumpSharedSpaces || RequireSharedSpaces) { |
1341 return; | 1356 return; |
1342 } | 1357 } |
1343 | 1358 |
1344 if (os::is_server_class_machine() && !force_client_mode ) { | 1359 if (os::is_server_class_machine()) { |
1345 // If no other collector is requested explicitly, | 1360 // If no other collector is requested explicitly, |
1346 // let the VM select the collector based on | 1361 // let the VM select the collector based on |
1347 // machine class and automatic selection policy. | 1362 // machine class and automatic selection policy. |
1348 if (!UseSerialGC && | 1363 if (!UseSerialGC && |
1349 !UseConcMarkSweepGC && | 1364 !UseConcMarkSweepGC && |
1364 #ifdef _LP64 | 1379 #ifdef _LP64 |
1365 // Check that UseCompressedOops can be set with the max heap size allocated | 1380 // Check that UseCompressedOops can be set with the max heap size allocated |
1366 // by ergonomics. | 1381 // by ergonomics. |
1367 if (MaxHeapSize <= max_heap_for_compressed_oops()) { | 1382 if (MaxHeapSize <= max_heap_for_compressed_oops()) { |
1368 #if !defined(COMPILER1) || defined(TIERED) | 1383 #if !defined(COMPILER1) || defined(TIERED) |
1369 // disable UseCompressedOops by default on MacOS X until 7118647 is fixed | |
1370 #ifndef __APPLE__ | |
1371 if (FLAG_IS_DEFAULT(UseCompressedOops)) { | 1384 if (FLAG_IS_DEFAULT(UseCompressedOops)) { |
1372 FLAG_SET_ERGO(bool, UseCompressedOops, true); | 1385 FLAG_SET_ERGO(bool, UseCompressedOops, true); |
1373 } | 1386 } |
1374 #endif // !__APPLE__ | |
1375 #endif | 1387 #endif |
1376 #ifdef _WIN64 | 1388 #ifdef _WIN64 |
1377 if (UseLargePages && UseCompressedOops) { | 1389 if (UseLargePages && UseCompressedOops) { |
1378 // Cannot allocate guard pages for implicit checks in indexed addressing | 1390 // Cannot allocate guard pages for implicit checks in indexed addressing |
1379 // mode, when large pages are specified on windows. | 1391 // mode, when large pages are specified on windows. |
1394 #endif // !ZERO | 1406 #endif // !ZERO |
1395 } | 1407 } |
1396 | 1408 |
1397 void Arguments::set_parallel_gc_flags() { | 1409 void Arguments::set_parallel_gc_flags() { |
1398 assert(UseParallelGC || UseParallelOldGC, "Error"); | 1410 assert(UseParallelGC || UseParallelOldGC, "Error"); |
1399 // If parallel old was requested, automatically enable parallel scavenge. | 1411 // Enable ParallelOld unless it was explicitly disabled (cmd line or rc file). |
1400 if (UseParallelOldGC && !UseParallelGC && FLAG_IS_DEFAULT(UseParallelGC)) { | 1412 if (FLAG_IS_DEFAULT(UseParallelOldGC)) { |
1401 FLAG_SET_DEFAULT(UseParallelGC, true); | 1413 FLAG_SET_DEFAULT(UseParallelOldGC, true); |
1402 } | 1414 } |
1415 FLAG_SET_DEFAULT(UseParallelGC, true); | |
1403 | 1416 |
1404 // If no heap maximum was requested explicitly, use some reasonable fraction | 1417 // If no heap maximum was requested explicitly, use some reasonable fraction |
1405 // of the physical memory, up to a maximum of 1GB. | 1418 // of the physical memory, up to a maximum of 1GB. |
1406 if (UseParallelGC) { | 1419 if (UseParallelGC) { |
1407 FLAG_SET_DEFAULT(ParallelGCThreads, | 1420 FLAG_SET_DEFAULT(ParallelGCThreads, |
2046 strcpy(altclasses_path, get_meta_index_dir()); | 2059 strcpy(altclasses_path, get_meta_index_dir()); |
2047 strcat(altclasses_path, altclasses_jar); | 2060 strcat(altclasses_path, altclasses_jar); |
2048 scp.add_suffix_to_prefix(altclasses_path); | 2061 scp.add_suffix_to_prefix(altclasses_path); |
2049 scp_assembly_required = true; | 2062 scp_assembly_required = true; |
2050 FREE_C_HEAP_ARRAY(char, altclasses_path); | 2063 FREE_C_HEAP_ARRAY(char, altclasses_path); |
2064 } | |
2065 | |
2066 if (WhiteBoxAPI) { | |
2067 // Append wb.jar to bootclasspath if enabled | |
2068 const char* wb_jar = "wb.jar"; | |
2069 size_t wb_path_len = strlen(get_meta_index_dir()) + 1 + | |
2070 strlen(wb_jar); | |
2071 char* wb_path = NEW_C_HEAP_ARRAY(char, wb_path_len); | |
2072 strcpy(wb_path, get_meta_index_dir()); | |
2073 strcat(wb_path, wb_jar); | |
2074 scp.add_suffix(wb_path); | |
2075 scp_assembly_required = true; | |
2076 FREE_C_HEAP_ARRAY(char, wb_path); | |
2051 } | 2077 } |
2052 | 2078 |
2053 // Parse _JAVA_OPTIONS environment variable (if present) (mimics classic VM) | 2079 // Parse _JAVA_OPTIONS environment variable (if present) (mimics classic VM) |
2054 result = parse_java_options_environment_variable(&scp, &scp_assembly_required); | 2080 result = parse_java_options_environment_variable(&scp, &scp_assembly_required); |
2055 if (result != JNI_OK) { | 2081 if (result != JNI_OK) { |
2507 // original allocation order after promotion, which improves mutator | 2533 // original allocation order after promotion, which improves mutator |
2508 // locality. A minor effect may be that larger PLABs reduce the | 2534 // locality. A minor effect may be that larger PLABs reduce the |
2509 // number of PLAB allocation events during gc. The value of 8kw | 2535 // number of PLAB allocation events during gc. The value of 8kw |
2510 // was arrived at by experimenting with specjbb. | 2536 // was arrived at by experimenting with specjbb. |
2511 FLAG_SET_CMDLINE(uintx, OldPLABSize, 8*K); // Note: this is in words | 2537 FLAG_SET_CMDLINE(uintx, OldPLABSize, 8*K); // Note: this is in words |
2512 | |
2513 // CompilationPolicyChoice=0 causes the server compiler to adopt | |
2514 // a more conservative which-method-do-I-compile policy when one | |
2515 // of the counters maintained by the interpreter trips. The | |
2516 // result is reduced startup time and improved specjbb and | |
2517 // alacrity performance. Zero is the default, but we set it | |
2518 // explicitly here in case the default changes. | |
2519 // See runtime/compilationPolicy.*. | |
2520 FLAG_SET_CMDLINE(intx, CompilationPolicyChoice, 0); | |
2521 | 2538 |
2522 // Enable parallel GC and adaptive generation sizing | 2539 // Enable parallel GC and adaptive generation sizing |
2523 FLAG_SET_CMDLINE(bool, UseParallelGC, true); | 2540 FLAG_SET_CMDLINE(bool, UseParallelGC, true); |
2524 FLAG_SET_DEFAULT(ParallelGCThreads, | 2541 FLAG_SET_DEFAULT(ParallelGCThreads, |
2525 Abstract_VM_Version::parallel_worker_threads()); | 2542 Abstract_VM_Version::parallel_worker_threads()); |
2933 | 2950 |
2934 // Sharing support | 2951 // Sharing support |
2935 // Construct the path to the archive | 2952 // Construct the path to the archive |
2936 char jvm_path[JVM_MAXPATHLEN]; | 2953 char jvm_path[JVM_MAXPATHLEN]; |
2937 os::jvm_path(jvm_path, sizeof(jvm_path)); | 2954 os::jvm_path(jvm_path, sizeof(jvm_path)); |
2938 #ifdef TIERED | |
2939 if (strstr(jvm_path, "client") != NULL) { | |
2940 force_client_mode = true; | |
2941 } | |
2942 #endif // TIERED | |
2943 char *end = strrchr(jvm_path, *os::file_separator()); | 2955 char *end = strrchr(jvm_path, *os::file_separator()); |
2944 if (end != NULL) *end = '\0'; | 2956 if (end != NULL) *end = '\0'; |
2945 char *shared_archive_path = NEW_C_HEAP_ARRAY(char, strlen(jvm_path) + | 2957 char *shared_archive_path = NEW_C_HEAP_ARRAY(char, strlen(jvm_path) + |
2946 strlen(os::file_separator()) + 20); | 2958 strlen(os::file_separator()) + 20); |
2947 if (shared_archive_path == NULL) return JNI_ENOMEM; | 2959 if (shared_archive_path == NULL) return JNI_ENOMEM; |