comparison src/share/vm/runtime/arguments.cpp @ 8124:5fc51c1ecdeb

Merge.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 05 Mar 2013 23:44:54 +0100
parents afa802ff433c 94478a033036
children 8d10fc6b4f6c
comparison
equal deleted inserted replaced
7943:a413bcd552a4 8124:5fc51c1ecdeb
36 #include "runtime/globals_extension.hpp" 36 #include "runtime/globals_extension.hpp"
37 #include "runtime/java.hpp" 37 #include "runtime/java.hpp"
38 #include "services/management.hpp" 38 #include "services/management.hpp"
39 #include "services/memTracker.hpp" 39 #include "services/memTracker.hpp"
40 #include "utilities/defaultStream.hpp" 40 #include "utilities/defaultStream.hpp"
41 #include "utilities/macros.hpp"
41 #include "utilities/taskqueue.hpp" 42 #include "utilities/taskqueue.hpp"
42 #ifdef TARGET_OS_FAMILY_linux 43 #ifdef TARGET_OS_FAMILY_linux
43 # include "os_linux.inline.hpp" 44 # include "os_linux.inline.hpp"
44 #endif 45 #endif
45 #ifdef TARGET_OS_FAMILY_solaris 46 #ifdef TARGET_OS_FAMILY_solaris
49 # include "os_windows.inline.hpp" 50 # include "os_windows.inline.hpp"
50 #endif 51 #endif
51 #ifdef TARGET_OS_FAMILY_bsd 52 #ifdef TARGET_OS_FAMILY_bsd
52 # include "os_bsd.inline.hpp" 53 # include "os_bsd.inline.hpp"
53 #endif 54 #endif
54 #ifndef SERIALGC 55 #if INCLUDE_ALL_GCS
55 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp" 56 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
56 #endif 57 #endif // INCLUDE_ALL_GCS
57 58
58 // Note: This is a special bug reporting site for the JVM 59 // Note: This is a special bug reporting site for the JVM
59 #define DEFAULT_VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/crash.jsp" 60 #define DEFAULT_VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/crash.jsp"
60 #define DEFAULT_JAVA_LAUNCHER "generic" 61 #define DEFAULT_JAVA_LAUNCHER "generic"
61 62
843 844
844 if (parse_argument(arg, origin) || ignore_unrecognized) { 845 if (parse_argument(arg, origin) || ignore_unrecognized) {
845 return true; 846 return true;
846 } 847 }
847 848
848 const char * const argname = *arg == '+' || *arg == '-' ? arg + 1 : arg; 849 bool has_plus_minus = (*arg == '+' || *arg == '-');
850 const char* const argname = has_plus_minus ? arg + 1 : arg;
849 if (is_newly_obsolete(arg, &since)) { 851 if (is_newly_obsolete(arg, &since)) {
850 char version[256]; 852 char version[256];
851 since.to_string(version, sizeof(version)); 853 since.to_string(version, sizeof(version));
852 warning("ignoring option %s; support was removed in %s", argname, version); 854 warning("ignoring option %s; support was removed in %s", argname, version);
853 return true; 855 return true;
854 } 856 }
855 857
856 // For locked flags, report a custom error message if available. 858 // For locked flags, report a custom error message if available.
857 // Otherwise, report the standard unrecognized VM option. 859 // Otherwise, report the standard unrecognized VM option.
858 860
859 Flag* locked_flag = Flag::find_flag((char*)argname, strlen(argname), true); 861 size_t arg_len;
860 if (locked_flag != NULL) { 862 const char* equal_sign = strchr(argname, '=');
863 if (equal_sign == NULL) {
864 arg_len = strlen(argname);
865 } else {
866 arg_len = equal_sign - argname;
867 }
868
869 Flag* found_flag = Flag::find_flag((char*)argname, arg_len, true);
870 if (found_flag != NULL) {
861 char locked_message_buf[BUFLEN]; 871 char locked_message_buf[BUFLEN];
862 locked_flag->get_locked_message(locked_message_buf, BUFLEN); 872 found_flag->get_locked_message(locked_message_buf, BUFLEN);
863 if (strlen(locked_message_buf) == 0) { 873 if (strlen(locked_message_buf) == 0) {
864 jio_fprintf(defaultStream::error_stream(), 874 if (found_flag->is_bool() && !has_plus_minus) {
865 "Unrecognized VM option '%s'\n", argname); 875 jio_fprintf(defaultStream::error_stream(),
876 "Missing +/- setting for VM option '%s'\n", argname);
877 } else if (!found_flag->is_bool() && has_plus_minus) {
878 jio_fprintf(defaultStream::error_stream(),
879 "Unexpected +/- setting in VM option '%s'\n", argname);
880 } else {
881 jio_fprintf(defaultStream::error_stream(),
882 "Improperly specified VM option '%s'\n", argname);
883 }
866 } else { 884 } else {
867 jio_fprintf(defaultStream::error_stream(), "%s", locked_message_buf); 885 jio_fprintf(defaultStream::error_stream(), "%s", locked_message_buf);
868 } 886 }
869 } else { 887 } else {
870 jio_fprintf(defaultStream::error_stream(), 888 jio_fprintf(defaultStream::error_stream(),
1084 vm_exit_during_initialization( 1102 vm_exit_during_initialization(
1085 "Incompatible compilation policy selected", NULL); 1103 "Incompatible compilation policy selected", NULL);
1086 } 1104 }
1087 // Increase the code cache size - tiered compiles a lot more. 1105 // Increase the code cache size - tiered compiles a lot more.
1088 if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) { 1106 if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
1089 FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 2); 1107 FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 5);
1090 } 1108 }
1091 } 1109 }
1092 1110
1093 #if INCLUDE_ALTERNATE_GCS 1111 #if INCLUDE_ALL_GCS
1094 static void disable_adaptive_size_policy(const char* collector_name) { 1112 static void disable_adaptive_size_policy(const char* collector_name) {
1095 if (UseAdaptiveSizePolicy) { 1113 if (UseAdaptiveSizePolicy) {
1096 if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) { 1114 if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) {
1097 warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.", 1115 warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.",
1098 collector_name); 1116 collector_name);
1255 // If we decided above (or user explicitly requested) 1273 // If we decided above (or user explicitly requested)
1256 // `promote all' (via MaxTenuringThreshold := 0), 1274 // `promote all' (via MaxTenuringThreshold := 0),
1257 // prefer minuscule survivor spaces so as not to waste 1275 // prefer minuscule survivor spaces so as not to waste
1258 // space for (non-existent) survivors 1276 // space for (non-existent) survivors
1259 if (FLAG_IS_DEFAULT(SurvivorRatio) && MaxTenuringThreshold == 0) { 1277 if (FLAG_IS_DEFAULT(SurvivorRatio) && MaxTenuringThreshold == 0) {
1260 FLAG_SET_ERGO(intx, SurvivorRatio, MAX2((intx)1024, SurvivorRatio)); 1278 FLAG_SET_ERGO(uintx, SurvivorRatio, MAX2((uintx)1024, SurvivorRatio));
1261 } 1279 }
1262 // If OldPLABSize is set and CMSParPromoteBlocksToClaim is not, 1280 // If OldPLABSize is set and CMSParPromoteBlocksToClaim is not,
1263 // set CMSParPromoteBlocksToClaim equal to OldPLABSize. 1281 // set CMSParPromoteBlocksToClaim equal to OldPLABSize.
1264 // This is done in order to make ParNew+CMS configuration to work 1282 // This is done in order to make ParNew+CMS configuration to work
1265 // with YoungPLABSize and OldPLABSize options. 1283 // with YoungPLABSize and OldPLABSize options.
1300 tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk", 1318 tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk",
1301 MarkStackSize / K, MarkStackSizeMax / K); 1319 MarkStackSize / K, MarkStackSizeMax / K);
1302 tty->print_cr("ConcGCThreads: %u", ConcGCThreads); 1320 tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
1303 } 1321 }
1304 } 1322 }
1305 #endif // INCLUDE_ALTERNATE_GCS 1323 #endif // INCLUDE_ALL_GCS
1306 1324
1307 void set_object_alignment() { 1325 void set_object_alignment() {
1308 // Object alignment. 1326 // Object alignment.
1309 assert(is_power_of_2(ObjectAlignmentInBytes), "ObjectAlignmentInBytes must be power of 2"); 1327 assert(is_power_of_2(ObjectAlignmentInBytes), "ObjectAlignmentInBytes must be power of 2");
1310 MinObjAlignmentInBytes = ObjectAlignmentInBytes; 1328 MinObjAlignmentInBytes = ObjectAlignmentInBytes;
1317 LogMinObjAlignment = LogMinObjAlignmentInBytes - LogHeapWordSize; 1335 LogMinObjAlignment = LogMinObjAlignmentInBytes - LogHeapWordSize;
1318 1336
1319 // Oop encoding heap max 1337 // Oop encoding heap max
1320 OopEncodingHeapMax = (uint64_t(max_juint) + 1) << LogMinObjAlignmentInBytes; 1338 OopEncodingHeapMax = (uint64_t(max_juint) + 1) << LogMinObjAlignmentInBytes;
1321 1339
1322 #if INCLUDE_ALTERNATE_GCS 1340 #if INCLUDE_ALL_GCS
1323 // Set CMS global values 1341 // Set CMS global values
1324 CompactibleFreeListSpace::set_cms_values(); 1342 CompactibleFreeListSpace::set_cms_values();
1325 #endif // INCLUDE_ALTERNATE_GCS 1343 #endif // INCLUDE_ALL_GCS
1326 } 1344 }
1327 1345
1328 bool verify_object_alignment() { 1346 bool verify_object_alignment() {
1329 // Object alignment. 1347 // Object alignment.
1330 if (!is_power_of_2(ObjectAlignmentInBytes)) { 1348 if (!is_power_of_2(ObjectAlignmentInBytes)) {
1445 if (FLAG_IS_DEFAULT(UseCompressedKlassPointers)) { 1463 if (FLAG_IS_DEFAULT(UseCompressedKlassPointers)) {
1446 FLAG_SET_ERGO(bool, UseCompressedKlassPointers, true); 1464 FLAG_SET_ERGO(bool, UseCompressedKlassPointers, true);
1447 } 1465 }
1448 // Set the ClassMetaspaceSize to something that will not need to be 1466 // Set the ClassMetaspaceSize to something that will not need to be
1449 // expanded, since it cannot be expanded. 1467 // expanded, since it cannot be expanded.
1450 if (UseCompressedKlassPointers && FLAG_IS_DEFAULT(ClassMetaspaceSize)) { 1468 if (UseCompressedKlassPointers) {
1451 // 100,000 classes seems like a good size, so 100M assumes around 1K 1469 if (ClassMetaspaceSize > KlassEncodingMetaspaceMax) {
1452 // per klass. The vtable and oopMap is embedded so we don't have a fixed 1470 warning("Class metaspace size is too large for UseCompressedKlassPointers");
1453 // size per klass. Eventually, this will be parameterized because it 1471 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
1454 // would also be useful to determine the optimal size of the 1472 } else if (FLAG_IS_DEFAULT(ClassMetaspaceSize)) {
1455 // systemDictionary. 1473 // 100,000 classes seems like a good size, so 100M assumes around 1K
1456 FLAG_SET_ERGO(uintx, ClassMetaspaceSize, 100*M); 1474 // per klass. The vtable and oopMap is embedded so we don't have a fixed
1475 // size per klass. Eventually, this will be parameterized because it
1476 // would also be useful to determine the optimal size of the
1477 // systemDictionary.
1478 FLAG_SET_ERGO(uintx, ClassMetaspaceSize, 100*M);
1479 }
1457 } 1480 }
1458 } 1481 }
1459 // Also checks that certain machines are slower with compressed oops 1482 // Also checks that certain machines are slower with compressed oops
1460 // in vm_version initialization code. 1483 // in vm_version initialization code.
1461 #endif // _LP64 1484 #endif // _LP64
1729 } 1752 }
1730 jio_fprintf(defaultStream::error_stream(), 1753 jio_fprintf(defaultStream::error_stream(),
1731 "%s of " UINTX_FORMAT " is invalid; must be between 0 and 100\n", 1754 "%s of " UINTX_FORMAT " is invalid; must be between 0 and 100\n",
1732 name, value); 1755 name, value);
1733 return false; 1756 return false;
1734 }
1735
1736 static void force_serial_gc() {
1737 FLAG_SET_DEFAULT(UseSerialGC, true);
1738 FLAG_SET_DEFAULT(UseParNewGC, false);
1739 FLAG_SET_DEFAULT(UseConcMarkSweepGC, false);
1740 FLAG_SET_DEFAULT(CMSIncrementalMode, false); // special CMS suboption
1741 FLAG_SET_DEFAULT(UseParallelGC, false);
1742 FLAG_SET_DEFAULT(UseParallelOldGC, false);
1743 FLAG_SET_DEFAULT(UseG1GC, false);
1744 } 1757 }
1745 1758
1746 static bool verify_serial_gc_flags() { 1759 static bool verify_serial_gc_flags() {
1747 return (UseSerialGC && 1760 return (UseSerialGC &&
1748 !(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC || 1761 !(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC ||
1890 status = false; 1903 status = false;
1891 } 1904 }
1892 // Keeping the heap 100% free is hard ;-) so limit it to 99%. 1905 // Keeping the heap 100% free is hard ;-) so limit it to 99%.
1893 MinHeapFreeRatio = MIN2(MinHeapFreeRatio, (uintx) 99); 1906 MinHeapFreeRatio = MIN2(MinHeapFreeRatio, (uintx) 99);
1894 1907
1908 // Min/MaxMetaspaceFreeRatio
1909 status = status && verify_percentage(MinMetaspaceFreeRatio, "MinMetaspaceFreeRatio");
1910 status = status && verify_percentage(MaxMetaspaceFreeRatio, "MaxMetaspaceFreeRatio");
1911
1912 if (MinMetaspaceFreeRatio > MaxMetaspaceFreeRatio) {
1913 jio_fprintf(defaultStream::error_stream(),
1914 "MinMetaspaceFreeRatio (%s" UINTX_FORMAT ") must be less than or "
1915 "equal to MaxMetaspaceFreeRatio (%s" UINTX_FORMAT ")\n",
1916 FLAG_IS_DEFAULT(MinMetaspaceFreeRatio) ? "Default: " : "",
1917 MinMetaspaceFreeRatio,
1918 FLAG_IS_DEFAULT(MaxMetaspaceFreeRatio) ? "Default: " : "",
1919 MaxMetaspaceFreeRatio);
1920 status = false;
1921 }
1922
1923 // Trying to keep 100% free is not practical
1924 MinMetaspaceFreeRatio = MIN2(MinMetaspaceFreeRatio, (uintx) 99);
1925
1895 if (FullGCALot && FLAG_IS_DEFAULT(MarkSweepAlwaysCompactCount)) { 1926 if (FullGCALot && FLAG_IS_DEFAULT(MarkSweepAlwaysCompactCount)) {
1896 MarkSweepAlwaysCompactCount = 1; // Move objects every gc. 1927 MarkSweepAlwaysCompactCount = 1; // Move objects every gc.
1897 } 1928 }
1898 1929
1899 if (UseParallelOldGC && ParallelOldGCSplitALot) { 1930 if (UseParallelOldGC && ParallelOldGCSplitALot) {
1900 // Settings to encourage splitting. 1931 // Settings to encourage splitting.
1901 if (!FLAG_IS_CMDLINE(NewRatio)) { 1932 if (!FLAG_IS_CMDLINE(NewRatio)) {
1902 FLAG_SET_CMDLINE(intx, NewRatio, 2); 1933 FLAG_SET_CMDLINE(uintx, NewRatio, 2);
1903 } 1934 }
1904 if (!FLAG_IS_CMDLINE(ScavengeBeforeFullGC)) { 1935 if (!FLAG_IS_CMDLINE(ScavengeBeforeFullGC)) {
1905 FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false); 1936 FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false);
1906 } 1937 }
1907 } 1938 }
1992 status = false; 2023 status = false;
1993 } 2024 }
1994 2025
1995 status = status && verify_min_value(ParGCArrayScanChunk, 1, "ParGCArrayScanChunk"); 2026 status = status && verify_min_value(ParGCArrayScanChunk, 1, "ParGCArrayScanChunk");
1996 2027
1997 #ifndef SERIALGC 2028 #if INCLUDE_ALL_GCS
1998 if (UseG1GC) { 2029 if (UseG1GC) {
1999 status = status && verify_percentage(InitiatingHeapOccupancyPercent, 2030 status = status && verify_percentage(InitiatingHeapOccupancyPercent,
2000 "InitiatingHeapOccupancyPercent"); 2031 "InitiatingHeapOccupancyPercent");
2001 status = status && verify_min_value(G1RefProcDrainInterval, 1, 2032 status = status && verify_min_value(G1RefProcDrainInterval, 1,
2002 "G1RefProcDrainInterval"); 2033 "G1RefProcDrainInterval");
2003 status = status && verify_min_value((intx)G1ConcMarkStepDurationMillis, 1, 2034 status = status && verify_min_value((intx)G1ConcMarkStepDurationMillis, 1,
2004 "G1ConcMarkStepDurationMillis"); 2035 "G1ConcMarkStepDurationMillis");
2005 } 2036 }
2006 #endif 2037 #endif // INCLUDE_ALL_GCS
2007 2038
2008 status = status && verify_interval(RefDiscoveryPolicy, 2039 status = status && verify_interval(RefDiscoveryPolicy,
2009 ReferenceProcessor::DiscoveryPolicyMin, 2040 ReferenceProcessor::DiscoveryPolicyMin,
2010 ReferenceProcessor::DiscoveryPolicyMax, 2041 ReferenceProcessor::DiscoveryPolicyMax,
2011 "RefDiscoveryPolicy"); 2042 "RefDiscoveryPolicy");
2316 scp.add_suffix_to_prefix(altclasses_path); 2347 scp.add_suffix_to_prefix(altclasses_path);
2317 scp_assembly_required = true; 2348 scp_assembly_required = true;
2318 FREE_C_HEAP_ARRAY(char, altclasses_path, mtInternal); 2349 FREE_C_HEAP_ARRAY(char, altclasses_path, mtInternal);
2319 } 2350 }
2320 2351
2321 if (WhiteBoxAPI) {
2322 // Append wb.jar to bootclasspath if enabled
2323 const char* wb_jar = "wb.jar";
2324 size_t wb_path_len = strlen(get_meta_index_dir()) + 1 +
2325 strlen(wb_jar);
2326 char* wb_path = NEW_C_HEAP_ARRAY(char, wb_path_len, mtInternal);
2327 strcpy(wb_path, get_meta_index_dir());
2328 strcat(wb_path, wb_jar);
2329 scp.add_suffix(wb_path);
2330 scp_assembly_required = true;
2331 FREE_C_HEAP_ARRAY(char, wb_path, mtInternal);
2332 }
2333
2334 // Parse _JAVA_OPTIONS environment variable (if present) (mimics classic VM) 2352 // Parse _JAVA_OPTIONS environment variable (if present) (mimics classic VM)
2335 result = parse_java_options_environment_variable(&scp, &scp_assembly_required); 2353 result = parse_java_options_environment_variable(&scp, &scp_assembly_required);
2336 if (result != JNI_OK) { 2354 if (result != JNI_OK) {
2337 return result; 2355 return result;
2338 } 2356 }
2623 if (!add_property(tail)) { 2641 if (!add_property(tail)) {
2624 return JNI_ENOMEM; 2642 return JNI_ENOMEM;
2625 } 2643 }
2626 // Out of the box management support 2644 // Out of the box management support
2627 if (match_option(option, "-Dcom.sun.management", &tail)) { 2645 if (match_option(option, "-Dcom.sun.management", &tail)) {
2646 #if INCLUDE_MANAGEMENT
2628 FLAG_SET_CMDLINE(bool, ManagementServer, true); 2647 FLAG_SET_CMDLINE(bool, ManagementServer, true);
2648 #else
2649 vm_exit_during_initialization(
2650 "-Dcom.sun.management is not supported in this VM.", NULL);
2651 #endif
2629 } 2652 }
2630 // -Xint 2653 // -Xint
2631 } else if (match_option(option, "-Xint", &tail)) { 2654 } else if (match_option(option, "-Xint", &tail)) {
2632 set_mode_flags(_int); 2655 set_mode_flags(_int);
2633 // -Xmixed 2656 // -Xmixed
2638 // for testing the compiler; turn off all flags that inhibit compilation 2661 // for testing the compiler; turn off all flags that inhibit compilation
2639 set_mode_flags(_comp); 2662 set_mode_flags(_comp);
2640 2663
2641 // -Xshare:dump 2664 // -Xshare:dump
2642 } else if (match_option(option, "-Xshare:dump", &tail)) { 2665 } else if (match_option(option, "-Xshare:dump", &tail)) {
2643 #if defined(KERNEL) 2666 #if !INCLUDE_CDS
2644 vm_exit_during_initialization(
2645 "Dumping a shared archive is not supported on the Kernel JVM.", NULL);
2646 #elif !INCLUDE_CDS
2647 vm_exit_during_initialization( 2667 vm_exit_during_initialization(
2648 "Dumping a shared archive is not supported in this VM.", NULL); 2668 "Dumping a shared archive is not supported in this VM.", NULL);
2649 #else 2669 #else
2650 FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true); 2670 FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true);
2651 set_mode_flags(_int); // Prevent compilation, which creates objects 2671 set_mode_flags(_int); // Prevent compilation, which creates objects
2972 } else if (match_option(option, "-XX:+UseVMInterruptibleIO", &tail)) { 2992 } else if (match_option(option, "-XX:+UseVMInterruptibleIO", &tail)) {
2973 // NOTE! In JDK 9, the UseVMInterruptibleIO flag will completely go 2993 // NOTE! In JDK 9, the UseVMInterruptibleIO flag will completely go
2974 // away and will cause VM initialization failures! 2994 // away and will cause VM initialization failures!
2975 warning("-XX:+UseVMInterruptibleIO is obsolete and will be removed in a future release."); 2995 warning("-XX:+UseVMInterruptibleIO is obsolete and will be removed in a future release.");
2976 FLAG_SET_CMDLINE(bool, UseVMInterruptibleIO, true); 2996 FLAG_SET_CMDLINE(bool, UseVMInterruptibleIO, true);
2997 #if !INCLUDE_MANAGEMENT
2998 } else if (match_option(option, "-XX:+ManagementServer", &tail)) {
2999 vm_exit_during_initialization(
3000 "ManagementServer is not supported in this VM.", NULL);
3001 #endif // INCLUDE_MANAGEMENT
2977 } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx 3002 } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
2978 // Skip -XX:Flags= since that case has already been handled 3003 // Skip -XX:Flags= since that case has already been handled
2979 if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) { 3004 if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) {
2980 if (!process_argument(tail, args->ignoreUnrecognized, origin)) { 3005 if (!process_argument(tail, args->ignoreUnrecognized, origin)) {
2981 return JNI_EINVAL; 3006 return JNI_EINVAL;
3211 } \ 3236 } \
3212 FLAG_SET_DEFAULT(opt, false); \ 3237 FLAG_SET_DEFAULT(opt, false); \
3213 } \ 3238 } \
3214 } while(0) 3239 } while(0)
3215 3240
3241
3242 #define UNSUPPORTED_GC_OPTION(gc) \
3243 do { \
3244 if (gc) { \
3245 if (FLAG_IS_CMDLINE(gc)) { \
3246 warning(#gc " is not supported in this VM. Using Serial GC."); \
3247 } \
3248 FLAG_SET_DEFAULT(gc, false); \
3249 } \
3250 } while(0)
3251
3252 static void force_serial_gc() {
3253 FLAG_SET_DEFAULT(UseSerialGC, true);
3254 FLAG_SET_DEFAULT(CMSIncrementalMode, false); // special CMS suboption
3255 UNSUPPORTED_GC_OPTION(UseG1GC);
3256 UNSUPPORTED_GC_OPTION(UseParallelGC);
3257 UNSUPPORTED_GC_OPTION(UseParallelOldGC);
3258 UNSUPPORTED_GC_OPTION(UseConcMarkSweepGC);
3259 UNSUPPORTED_GC_OPTION(UseParNewGC);
3260 }
3261
3216 // Parse entry point called from JNI_CreateJavaVM 3262 // Parse entry point called from JNI_CreateJavaVM
3217 3263
3218 jint Arguments::parse(const JavaVMInitArgs* args) { 3264 jint Arguments::parse(const JavaVMInitArgs* args) {
3219 3265
3220 // Sharing support 3266 // Sharing support
3326 warning("%s file is present but has been ignored. " 3372 warning("%s file is present but has been ignored. "
3327 "Run with -XX:Flags=%s to load the file.", 3373 "Run with -XX:Flags=%s to load the file.",
3328 hotspotrc, hotspotrc); 3374 hotspotrc, hotspotrc);
3329 } 3375 }
3330 3376
3331 #if (defined JAVASE_EMBEDDED || defined ARM)
3332 UNSUPPORTED_OPTION(UseG1GC, "G1 GC");
3333 #endif
3334
3335 #ifdef _ALLBSD_SOURCE // UseLargePages is not yet supported on BSD. 3377 #ifdef _ALLBSD_SOURCE // UseLargePages is not yet supported on BSD.
3336 UNSUPPORTED_OPTION(UseLargePages, "-XX:+UseLargePages"); 3378 UNSUPPORTED_OPTION(UseLargePages, "-XX:+UseLargePages");
3337 #endif 3379 #endif
3338 3380
3339 #if !INCLUDE_ALTERNATE_GCS 3381 #if INCLUDE_ALL_GCS
3340 if (UseParallelGC) { 3382 #if (defined JAVASE_EMBEDDED || defined ARM)
3341 warning("Parallel GC is not supported in this VM. Using Serial GC."); 3383 UNSUPPORTED_OPTION(UseG1GC, "G1 GC");
3342 } 3384 #endif
3343 if (UseParallelOldGC) { 3385 #endif
3344 warning("Parallel Old GC is not supported in this VM. Using Serial GC.");
3345 }
3346 if (UseConcMarkSweepGC) {
3347 warning("Concurrent Mark Sweep GC is not supported in this VM. Using Serial GC.");
3348 }
3349 if (UseParNewGC) {
3350 warning("Par New GC is not supported in this VM. Using Serial GC.");
3351 }
3352 #endif // INCLUDE_ALTERNATE_GCS
3353 3386
3354 #ifndef PRODUCT 3387 #ifndef PRODUCT
3355 if (TraceBytecodesAt != 0) { 3388 if (TraceBytecodesAt != 0) {
3356 TraceBytecodes = true; 3389 TraceBytecodes = true;
3357 } 3390 }
3394 } 3427 }
3395 3428
3396 // Set object alignment values. 3429 // Set object alignment values.
3397 set_object_alignment(); 3430 set_object_alignment();
3398 3431
3399 #ifdef SERIALGC 3432 #if !INCLUDE_ALL_GCS
3400 force_serial_gc(); 3433 force_serial_gc();
3401 #endif // SERIALGC 3434 #endif // INCLUDE_ALL_GCS
3402 #if !INCLUDE_CDS 3435 #if !INCLUDE_CDS
3403 no_shared_spaces(); 3436 no_shared_spaces();
3404 #endif // INCLUDE_CDS 3437 #endif // INCLUDE_CDS
3405 3438
3406 // Set flags based on ergonomics. 3439 // Set flags based on ergonomics.
3424 } 3457 }
3425 3458
3426 // Set heap size based on available physical memory 3459 // Set heap size based on available physical memory
3427 set_heap_size(); 3460 set_heap_size();
3428 3461
3429 #if INCLUDE_ALTERNATE_GCS 3462 #if INCLUDE_ALL_GCS
3430 // Set per-collector flags 3463 // Set per-collector flags
3431 if (UseParallelGC || UseParallelOldGC) { 3464 if (UseParallelGC || UseParallelOldGC) {
3432 set_parallel_gc_flags(); 3465 set_parallel_gc_flags();
3433 } else if (UseConcMarkSweepGC) { // should be done before ParNew check below 3466 } else if (UseConcMarkSweepGC) { // should be done before ParNew check below
3434 set_cms_and_parnew_gc_flags(); 3467 set_cms_and_parnew_gc_flags();
3436 set_parnew_gc_flags(); 3469 set_parnew_gc_flags();
3437 } else if (UseG1GC) { 3470 } else if (UseG1GC) {
3438 set_g1_gc_flags(); 3471 set_g1_gc_flags();
3439 } 3472 }
3440 check_deprecated_gcs(); 3473 check_deprecated_gcs();
3441 #endif // INCLUDE_ALTERNATE_GCS 3474 #else // INCLUDE_ALL_GCS
3442
3443 #ifdef SERIALGC
3444 assert(verify_serial_gc_flags(), "SerialGC unset"); 3475 assert(verify_serial_gc_flags(), "SerialGC unset");
3445 #endif // SERIALGC 3476 #endif // INCLUDE_ALL_GCS
3446 3477
3447 // Set bytecode rewriting flags 3478 // Set bytecode rewriting flags
3448 set_bytecode_flags(); 3479 set_bytecode_flags();
3449 3480
3450 // Set flags if Aggressive optimization flags (-XX:+AggressiveOpts) enabled. 3481 // Set flags if Aggressive optimization flags (-XX:+AggressiveOpts) enabled.
3537 3568
3538 return JNI_OK; 3569 return JNI_OK;
3539 } 3570 }
3540 3571
3541 jint Arguments::adjust_after_os() { 3572 jint Arguments::adjust_after_os() {
3542 #if INCLUDE_ALTERNATE_GCS 3573 #if INCLUDE_ALL_GCS
3543 if (UseParallelGC || UseParallelOldGC) { 3574 if (UseParallelGC || UseParallelOldGC) {
3544 if (UseNUMA) { 3575 if (UseNUMA) {
3545 if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) { 3576 if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) {
3546 FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M); 3577 FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M);
3547 } 3578 }
3548 // For those collectors or operating systems (eg, Windows) that do 3579 // For those collectors or operating systems (eg, Windows) that do
3549 // not support full UseNUMA, we will map to UseNUMAInterleaving for now 3580 // not support full UseNUMA, we will map to UseNUMAInterleaving for now
3550 UseNUMAInterleaving = true; 3581 UseNUMAInterleaving = true;
3551 } 3582 }
3552 } 3583 }
3553 #endif 3584 #endif // INCLUDE_ALL_GCS
3554 return JNI_OK; 3585 return JNI_OK;
3555 } 3586 }
3556 3587
3557 int Arguments::PropertyList_count(SystemProperty* pl) { 3588 int Arguments::PropertyList_count(SystemProperty* pl) {
3558 int count = 0; 3589 int count = 0;
3642 } 3673 }
3643 } 3674 }
3644 3675
3645 PropertyList_add(plist, k, v); 3676 PropertyList_add(plist, k, v);
3646 } 3677 }
3647
3648 #ifdef KERNEL
3649 char *Arguments::get_kernel_properties() {
3650 // Find properties starting with kernel and append them to string
3651 // We need to find out how long they are first because the URL's that they
3652 // might point to could get long.
3653 int length = 0;
3654 SystemProperty* prop;
3655 for (prop = _system_properties; prop != NULL; prop = prop->next()) {
3656 if (strncmp(prop->key(), "kernel.", 7 ) == 0) {
3657 length += (strlen(prop->key()) + strlen(prop->value()) + 5); // "-D ="
3658 }
3659 }
3660 // Add one for null terminator.
3661 char *props = AllocateHeap(length + 1, mtInternal);
3662 if (length != 0) {
3663 int pos = 0;
3664 for (prop = _system_properties; prop != NULL; prop = prop->next()) {
3665 if (strncmp(prop->key(), "kernel.", 7 ) == 0) {
3666 jio_snprintf(&props[pos], length-pos,
3667 "-D%s=%s ", prop->key(), prop->value());
3668 pos = strlen(props);
3669 }
3670 }
3671 }
3672 // null terminate props in case of null
3673 props[length] = '\0';
3674 return props;
3675 }
3676 #endif // KERNEL
3677 3678
3678 // Copies src into buf, replacing "%%" with "%" and "%p" with pid 3679 // Copies src into buf, replacing "%%" with "%" and "%p" with pid
3679 // Returns true if all of the source pointed by src has been copied over to 3680 // Returns true if all of the source pointed by src has been copied over to
3680 // the destination buffer pointed by buf. Otherwise, returns false. 3681 // the destination buffer pointed by buf. Otherwise, returns false.
3681 // Notes: 3682 // Notes: