Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/arguments.cpp @ 14422:2b8e28fdf503
Merge
author | kvn |
---|---|
date | Tue, 05 Nov 2013 17:38:04 -0800 |
parents | abe03600372a 3b3133d93fb6 |
children | da862781b584 |
comparison
equal
deleted
inserted
replaced
14421:3068270ba476 | 14422:2b8e28fdf503 |
---|---|
26 #include "classfile/javaAssertions.hpp" | 26 #include "classfile/javaAssertions.hpp" |
27 #include "classfile/symbolTable.hpp" | 27 #include "classfile/symbolTable.hpp" |
28 #include "compiler/compilerOracle.hpp" | 28 #include "compiler/compilerOracle.hpp" |
29 #include "memory/allocation.inline.hpp" | 29 #include "memory/allocation.inline.hpp" |
30 #include "memory/cardTableRS.hpp" | 30 #include "memory/cardTableRS.hpp" |
31 #include "memory/genCollectedHeap.hpp" | |
31 #include "memory/referenceProcessor.hpp" | 32 #include "memory/referenceProcessor.hpp" |
32 #include "memory/universe.inline.hpp" | 33 #include "memory/universe.inline.hpp" |
33 #include "oops/oop.inline.hpp" | 34 #include "oops/oop.inline.hpp" |
34 #include "prims/jvmtiExport.hpp" | 35 #include "prims/jvmtiExport.hpp" |
35 #include "runtime/arguments.hpp" | 36 #include "runtime/arguments.hpp" |
55 #ifdef TARGET_OS_FAMILY_bsd | 56 #ifdef TARGET_OS_FAMILY_bsd |
56 # include "os_bsd.inline.hpp" | 57 # include "os_bsd.inline.hpp" |
57 #endif | 58 #endif |
58 #if INCLUDE_ALL_GCS | 59 #if INCLUDE_ALL_GCS |
59 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp" | 60 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp" |
61 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" | |
62 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" | |
60 #endif // INCLUDE_ALL_GCS | 63 #endif // INCLUDE_ALL_GCS |
61 | 64 |
62 // Note: This is a special bug reporting site for the JVM | 65 // Note: This is a special bug reporting site for the JVM |
63 #define DEFAULT_VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/crash.jsp" | 66 #define DEFAULT_VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/crash.jsp" |
64 #define DEFAULT_JAVA_LAUNCHER "generic" | 67 #define DEFAULT_JAVA_LAUNCHER "generic" |
91 int Arguments::_num_jvm_args = 0; | 94 int Arguments::_num_jvm_args = 0; |
92 char* Arguments::_java_command = NULL; | 95 char* Arguments::_java_command = NULL; |
93 SystemProperty* Arguments::_system_properties = NULL; | 96 SystemProperty* Arguments::_system_properties = NULL; |
94 const char* Arguments::_gc_log_filename = NULL; | 97 const char* Arguments::_gc_log_filename = NULL; |
95 bool Arguments::_has_profile = false; | 98 bool Arguments::_has_profile = false; |
99 size_t Arguments::_conservative_max_heap_alignment = 0; | |
96 uintx Arguments::_min_heap_size = 0; | 100 uintx Arguments::_min_heap_size = 0; |
97 Arguments::Mode Arguments::_mode = _mixed; | 101 Arguments::Mode Arguments::_mode = _mixed; |
98 bool Arguments::_java_compiler = false; | 102 bool Arguments::_java_compiler = false; |
99 bool Arguments::_xdebug_mode = false; | 103 bool Arguments::_xdebug_mode = false; |
100 const char* Arguments::_java_vendor_url_bug = DEFAULT_VENDOR_URL_BUG; | 104 const char* Arguments::_java_vendor_url_bug = DEFAULT_VENDOR_URL_BUG; |
622 default: | 626 default: |
623 ShouldNotReachHere(); | 627 ShouldNotReachHere(); |
624 } | 628 } |
625 } | 629 } |
626 | 630 |
627 static bool set_bool_flag(char* name, bool value, FlagValueOrigin origin) { | 631 static bool set_bool_flag(char* name, bool value, Flag::Flags origin) { |
628 return CommandLineFlags::boolAtPut(name, &value, origin); | 632 return CommandLineFlags::boolAtPut(name, &value, origin); |
629 } | 633 } |
630 | 634 |
631 static bool set_fp_numeric_flag(char* name, char* value, FlagValueOrigin origin) { | 635 static bool set_fp_numeric_flag(char* name, char* value, Flag::Flags origin) { |
632 double v; | 636 double v; |
633 if (sscanf(value, "%lf", &v) != 1) { | 637 if (sscanf(value, "%lf", &v) != 1) { |
634 return false; | 638 return false; |
635 } | 639 } |
636 | 640 |
638 return true; | 642 return true; |
639 } | 643 } |
640 return false; | 644 return false; |
641 } | 645 } |
642 | 646 |
643 static bool set_numeric_flag(char* name, char* value, FlagValueOrigin origin) { | 647 static bool set_numeric_flag(char* name, char* value, Flag::Flags origin) { |
644 julong v; | 648 julong v; |
645 intx intx_v; | 649 intx intx_v; |
646 bool is_neg = false; | 650 bool is_neg = false; |
647 // Check the sign first since atomull() parses only unsigned values. | 651 // Check the sign first since atomull() parses only unsigned values. |
648 if (*value == '-') { | 652 if (*value == '-') { |
671 return true; | 675 return true; |
672 } | 676 } |
673 return false; | 677 return false; |
674 } | 678 } |
675 | 679 |
676 static bool set_string_flag(char* name, const char* value, FlagValueOrigin origin) { | 680 static bool set_string_flag(char* name, const char* value, Flag::Flags origin) { |
677 if (!CommandLineFlags::ccstrAtPut(name, &value, origin)) return false; | 681 if (!CommandLineFlags::ccstrAtPut(name, &value, origin)) return false; |
678 // Contract: CommandLineFlags always returns a pointer that needs freeing. | 682 // Contract: CommandLineFlags always returns a pointer that needs freeing. |
679 FREE_C_HEAP_ARRAY(char, value, mtInternal); | 683 FREE_C_HEAP_ARRAY(char, value, mtInternal); |
680 return true; | 684 return true; |
681 } | 685 } |
682 | 686 |
683 static bool append_to_string_flag(char* name, const char* new_value, FlagValueOrigin origin) { | 687 static bool append_to_string_flag(char* name, const char* new_value, Flag::Flags origin) { |
684 const char* old_value = ""; | 688 const char* old_value = ""; |
685 if (!CommandLineFlags::ccstrAt(name, &old_value)) return false; | 689 if (!CommandLineFlags::ccstrAt(name, &old_value)) return false; |
686 size_t old_len = old_value != NULL ? strlen(old_value) : 0; | 690 size_t old_len = old_value != NULL ? strlen(old_value) : 0; |
687 size_t new_len = strlen(new_value); | 691 size_t new_len = strlen(new_value); |
688 const char* value; | 692 const char* value; |
706 FREE_C_HEAP_ARRAY(char, free_this_too, mtInternal); | 710 FREE_C_HEAP_ARRAY(char, free_this_too, mtInternal); |
707 } | 711 } |
708 return true; | 712 return true; |
709 } | 713 } |
710 | 714 |
711 bool Arguments::parse_argument(const char* arg, FlagValueOrigin origin) { | 715 bool Arguments::parse_argument(const char* arg, Flag::Flags origin) { |
712 | 716 |
713 // range of acceptable characters spelled out for portability reasons | 717 // range of acceptable characters spelled out for portability reasons |
714 #define NAME_RANGE "[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]" | 718 #define NAME_RANGE "[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]" |
715 #define BUFLEN 255 | 719 #define BUFLEN 255 |
716 char name[BUFLEN+1]; | 720 char name[BUFLEN+1]; |
847 st->print_cr(""); | 851 st->print_cr(""); |
848 } | 852 } |
849 } | 853 } |
850 | 854 |
851 bool Arguments::process_argument(const char* arg, | 855 bool Arguments::process_argument(const char* arg, |
852 jboolean ignore_unrecognized, FlagValueOrigin origin) { | 856 jboolean ignore_unrecognized, Flag::Flags origin) { |
853 | 857 |
854 JDK_Version since = JDK_Version(); | 858 JDK_Version since = JDK_Version(); |
855 | 859 |
856 if (parse_argument(arg, origin) || ignore_unrecognized) { | 860 if (parse_argument(arg, origin) || ignore_unrecognized) { |
857 return true; | 861 return true; |
901 Flag* fuzzy_matched = Flag::fuzzy_match((const char*)argname, arg_len, true); | 905 Flag* fuzzy_matched = Flag::fuzzy_match((const char*)argname, arg_len, true); |
902 if (fuzzy_matched != NULL) { | 906 if (fuzzy_matched != NULL) { |
903 jio_fprintf(defaultStream::error_stream(), | 907 jio_fprintf(defaultStream::error_stream(), |
904 "Did you mean '%s%s%s'?\n", | 908 "Did you mean '%s%s%s'?\n", |
905 (fuzzy_matched->is_bool()) ? "(+/-)" : "", | 909 (fuzzy_matched->is_bool()) ? "(+/-)" : "", |
906 fuzzy_matched->name, | 910 fuzzy_matched->_name, |
907 (fuzzy_matched->is_bool()) ? "" : "=<value>"); | 911 (fuzzy_matched->is_bool()) ? "" : "=<value>"); |
908 } | 912 } |
909 } | 913 } |
910 | 914 |
911 // allow for commandline "commenting out" options like -XX:#+Verbose | 915 // allow for commandline "commenting out" options like -XX:#+Verbose |
949 if (c == '\n' || (!in_quote && isspace(c))) { | 953 if (c == '\n' || (!in_quote && isspace(c))) { |
950 // token ends at newline, or at unquoted whitespace | 954 // token ends at newline, or at unquoted whitespace |
951 // this allows a way to include spaces in string-valued options | 955 // this allows a way to include spaces in string-valued options |
952 token[pos] = '\0'; | 956 token[pos] = '\0'; |
953 logOption(token); | 957 logOption(token); |
954 result &= process_argument(token, ignore_unrecognized, CONFIG_FILE); | 958 result &= process_argument(token, ignore_unrecognized, Flag::CONFIG_FILE); |
955 build_jvm_flags(token); | 959 build_jvm_flags(token); |
956 pos = 0; | 960 pos = 0; |
957 in_white_space = true; | 961 in_white_space = true; |
958 in_quote = false; | 962 in_quote = false; |
959 } else if (!in_quote && (c == '\'' || c == '"')) { | 963 } else if (!in_quote && (c == '\'' || c == '"')) { |
967 } | 971 } |
968 c = getc(stream); | 972 c = getc(stream); |
969 } | 973 } |
970 if (pos > 0) { | 974 if (pos > 0) { |
971 token[pos] = '\0'; | 975 token[pos] = '\0'; |
972 result &= process_argument(token, ignore_unrecognized, CONFIG_FILE); | 976 result &= process_argument(token, ignore_unrecognized, Flag::CONFIG_FILE); |
973 build_jvm_flags(token); | 977 build_jvm_flags(token); |
974 } | 978 } |
975 fclose(stream); | 979 fclose(stream); |
976 return result; | 980 return result; |
977 } | 981 } |
1097 } | 1101 } |
1098 break; | 1102 break; |
1099 } | 1103 } |
1100 } | 1104 } |
1101 | 1105 |
1106 #if defined(COMPILER2) || defined(_LP64) || !INCLUDE_CDS | |
1102 // Conflict: required to use shared spaces (-Xshare:on), but | 1107 // Conflict: required to use shared spaces (-Xshare:on), but |
1103 // incompatible command line options were chosen. | 1108 // incompatible command line options were chosen. |
1104 | 1109 |
1105 static void no_shared_spaces() { | 1110 static void no_shared_spaces() { |
1106 if (RequireSharedSpaces) { | 1111 if (RequireSharedSpaces) { |
1109 vm_exit_during_initialization("Unable to use shared archive.", NULL); | 1114 vm_exit_during_initialization("Unable to use shared archive.", NULL); |
1110 } else { | 1115 } else { |
1111 FLAG_SET_DEFAULT(UseSharedSpaces, false); | 1116 FLAG_SET_DEFAULT(UseSharedSpaces, false); |
1112 } | 1117 } |
1113 } | 1118 } |
1119 #endif | |
1114 | 1120 |
1115 void Arguments::set_tiered_flags() { | 1121 void Arguments::set_tiered_flags() { |
1116 // With tiered, set default policy to AdvancedThresholdPolicy, which is 3. | 1122 // With tiered, set default policy to AdvancedThresholdPolicy, which is 3. |
1117 if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) { | 1123 if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) { |
1118 FLAG_SET_DEFAULT(CompilationPolicyChoice, 3); | 1124 FLAG_SET_DEFAULT(CompilationPolicyChoice, 3); |
1126 FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 5); | 1132 FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 5); |
1127 } | 1133 } |
1128 if (!UseInterpreter) { // -Xcomp | 1134 if (!UseInterpreter) { // -Xcomp |
1129 Tier3InvokeNotifyFreqLog = 0; | 1135 Tier3InvokeNotifyFreqLog = 0; |
1130 Tier4InvocationThreshold = 0; | 1136 Tier4InvocationThreshold = 0; |
1137 } | |
1138 if (FLAG_IS_DEFAULT(NmethodSweepFraction)) { | |
1139 FLAG_SET_DEFAULT(NmethodSweepFraction, 1 + ReservedCodeCacheSize / (16 * M)); | |
1131 } | 1140 } |
1132 } | 1141 } |
1133 | 1142 |
1134 #if INCLUDE_ALL_GCS | 1143 #if INCLUDE_ALL_GCS |
1135 static void disable_adaptive_size_policy(const char* collector_name) { | 1144 static void disable_adaptive_size_policy(const char* collector_name) { |
1392 return false; | 1401 return false; |
1393 } | 1402 } |
1394 return true; | 1403 return true; |
1395 } | 1404 } |
1396 | 1405 |
1397 inline uintx max_heap_for_compressed_oops() { | 1406 uintx Arguments::max_heap_for_compressed_oops() { |
1398 // Avoid sign flip. | 1407 // Avoid sign flip. |
1399 assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size"); | 1408 assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size"); |
1400 LP64_ONLY(return OopEncodingHeapMax - os::vm_page_size()); | 1409 // We need to fit both the NULL page and the heap into the memory budget, while |
1410 // keeping alignment constraints of the heap. To guarantee the latter, as the | |
1411 // NULL page is located before the heap, we pad the NULL page to the conservative | |
1412 // maximum alignment that the GC may ever impose upon the heap. | |
1413 size_t displacement_due_to_null_page = align_size_up_(os::vm_page_size(), | |
1414 Arguments::conservative_max_heap_alignment()); | |
1415 | |
1416 LP64_ONLY(return OopEncodingHeapMax - displacement_due_to_null_page); | |
1401 NOT_LP64(ShouldNotReachHere(); return 0); | 1417 NOT_LP64(ShouldNotReachHere(); return 0); |
1402 } | 1418 } |
1403 | 1419 |
1404 bool Arguments::should_auto_select_low_pause_collector() { | 1420 bool Arguments::should_auto_select_low_pause_collector() { |
1405 if (UseAutoGCSelectPolicy && | 1421 if (UseAutoGCSelectPolicy && |
1440 #endif // _WIN64 | 1456 #endif // _WIN64 |
1441 } else { | 1457 } else { |
1442 if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) { | 1458 if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) { |
1443 warning("Max heap size too large for Compressed Oops"); | 1459 warning("Max heap size too large for Compressed Oops"); |
1444 FLAG_SET_DEFAULT(UseCompressedOops, false); | 1460 FLAG_SET_DEFAULT(UseCompressedOops, false); |
1445 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false); | 1461 FLAG_SET_DEFAULT(UseCompressedClassPointers, false); |
1446 } | 1462 } |
1447 } | 1463 } |
1448 #endif // _LP64 | 1464 #endif // _LP64 |
1449 #endif // ZERO | 1465 #endif // ZERO |
1450 } | 1466 } |
1453 // NOTE: set_use_compressed_klass_ptrs() must be called after calling | 1469 // NOTE: set_use_compressed_klass_ptrs() must be called after calling |
1454 // set_use_compressed_oops(). | 1470 // set_use_compressed_oops(). |
1455 void Arguments::set_use_compressed_klass_ptrs() { | 1471 void Arguments::set_use_compressed_klass_ptrs() { |
1456 #ifndef ZERO | 1472 #ifndef ZERO |
1457 #ifdef _LP64 | 1473 #ifdef _LP64 |
1458 // UseCompressedOops must be on for UseCompressedKlassPointers to be on. | 1474 // UseCompressedOops must be on for UseCompressedClassPointers to be on. |
1459 if (!UseCompressedOops) { | 1475 if (!UseCompressedOops) { |
1460 if (UseCompressedKlassPointers) { | 1476 if (UseCompressedClassPointers) { |
1461 warning("UseCompressedKlassPointers requires UseCompressedOops"); | 1477 warning("UseCompressedClassPointers requires UseCompressedOops"); |
1462 } | 1478 } |
1463 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false); | 1479 FLAG_SET_DEFAULT(UseCompressedClassPointers, false); |
1464 } else { | 1480 } else { |
1465 // Turn on UseCompressedKlassPointers too | 1481 // Turn on UseCompressedClassPointers too |
1466 if (FLAG_IS_DEFAULT(UseCompressedKlassPointers)) { | 1482 if (FLAG_IS_DEFAULT(UseCompressedClassPointers)) { |
1467 FLAG_SET_ERGO(bool, UseCompressedKlassPointers, true); | 1483 FLAG_SET_ERGO(bool, UseCompressedClassPointers, true); |
1468 } | 1484 } |
1469 // Check the ClassMetaspaceSize to make sure we use compressed klass ptrs. | 1485 // Check the CompressedClassSpaceSize to make sure we use compressed klass ptrs. |
1470 if (UseCompressedKlassPointers) { | 1486 if (UseCompressedClassPointers) { |
1471 if (ClassMetaspaceSize > KlassEncodingMetaspaceMax) { | 1487 if (CompressedClassSpaceSize > KlassEncodingMetaspaceMax) { |
1472 warning("Class metaspace size is too large for UseCompressedKlassPointers"); | 1488 warning("CompressedClassSpaceSize is too large for UseCompressedClassPointers"); |
1473 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false); | 1489 FLAG_SET_DEFAULT(UseCompressedClassPointers, false); |
1474 } | 1490 } |
1475 } | 1491 } |
1476 } | 1492 } |
1477 #endif // _LP64 | 1493 #endif // _LP64 |
1478 #endif // !ZERO | 1494 #endif // !ZERO |
1495 } | |
1496 | |
1497 void Arguments::set_conservative_max_heap_alignment() { | |
1498 // The conservative maximum required alignment for the heap is the maximum of | |
1499 // the alignments imposed by several sources: any requirements from the heap | |
1500 // itself, the collector policy and the maximum page size we may run the VM | |
1501 // with. | |
1502 size_t heap_alignment = GenCollectedHeap::conservative_max_heap_alignment(); | |
1503 #if INCLUDE_ALL_GCS | |
1504 if (UseParallelGC) { | |
1505 heap_alignment = ParallelScavengeHeap::conservative_max_heap_alignment(); | |
1506 } else if (UseG1GC) { | |
1507 heap_alignment = G1CollectedHeap::conservative_max_heap_alignment(); | |
1508 } | |
1509 #endif // INCLUDE_ALL_GCS | |
1510 _conservative_max_heap_alignment = MAX3(heap_alignment, os::max_page_size(), | |
1511 CollectorPolicy::compute_max_alignment()); | |
1479 } | 1512 } |
1480 | 1513 |
1481 void Arguments::set_ergonomics_flags() { | 1514 void Arguments::set_ergonomics_flags() { |
1482 | 1515 |
1483 if (os::is_server_class_machine()) { | 1516 if (os::is_server_class_machine()) { |
1493 FLAG_SET_ERGO(bool, UseConcMarkSweepGC, true); | 1526 FLAG_SET_ERGO(bool, UseConcMarkSweepGC, true); |
1494 } else { | 1527 } else { |
1495 FLAG_SET_ERGO(bool, UseParallelGC, true); | 1528 FLAG_SET_ERGO(bool, UseParallelGC, true); |
1496 } | 1529 } |
1497 } | 1530 } |
1498 // Shared spaces work fine with other GCs but causes bytecode rewriting | 1531 } |
1499 // to be disabled, which hurts interpreter performance and decreases | 1532 #ifdef COMPILER2 |
1500 // server performance. On server class machines, keep the default | 1533 // Shared spaces work fine with other GCs but causes bytecode rewriting |
1501 // off unless it is asked for. Future work: either add bytecode rewriting | 1534 // to be disabled, which hurts interpreter performance and decreases |
1502 // at link time, or rewrite bytecodes in non-shared methods. | 1535 // server performance. When -server is specified, keep the default off |
1503 if (!DumpSharedSpaces && !RequireSharedSpaces && | 1536 // unless it is asked for. Future work: either add bytecode rewriting |
1504 (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) { | 1537 // at link time, or rewrite bytecodes in non-shared methods. |
1505 no_shared_spaces(); | 1538 if (!DumpSharedSpaces && !RequireSharedSpaces && |
1506 } | 1539 (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) { |
1507 } | 1540 no_shared_spaces(); |
1541 } | |
1542 #endif | |
1543 | |
1544 set_conservative_max_heap_alignment(); | |
1508 | 1545 |
1509 #ifndef ZERO | 1546 #ifndef ZERO |
1510 #ifdef _LP64 | 1547 #ifdef _LP64 |
1511 set_use_compressed_oops(); | 1548 set_use_compressed_oops(); |
1512 | 1549 |
1606 result = MIN2(result, max_allocatable / MaxVirtMemFraction); | 1643 result = MIN2(result, max_allocatable / MaxVirtMemFraction); |
1607 } | 1644 } |
1608 return result; | 1645 return result; |
1609 } | 1646 } |
1610 | 1647 |
1611 void Arguments::set_heap_base_min_address() { | |
1612 if (FLAG_IS_DEFAULT(HeapBaseMinAddress) && UseG1GC && HeapBaseMinAddress < 1*G) { | |
1613 // By default HeapBaseMinAddress is 2G on all platforms except Solaris x86. | |
1614 // G1 currently needs a lot of C-heap, so on Solaris we have to give G1 | |
1615 // some extra space for the C-heap compared to other collectors. | |
1616 // Use FLAG_SET_DEFAULT here rather than FLAG_SET_ERGO to make sure that | |
1617 // code that checks for default values work correctly. | |
1618 FLAG_SET_DEFAULT(HeapBaseMinAddress, 1*G); | |
1619 } | |
1620 } | |
1621 | |
1622 void Arguments::set_heap_size() { | 1648 void Arguments::set_heap_size() { |
1623 if (!FLAG_IS_DEFAULT(DefaultMaxRAMFraction)) { | 1649 if (!FLAG_IS_DEFAULT(DefaultMaxRAMFraction)) { |
1624 // Deprecated flag | 1650 // Deprecated flag |
1625 FLAG_SET_CMDLINE(uintx, MaxRAMFraction, DefaultMaxRAMFraction); | 1651 FLAG_SET_CMDLINE(uintx, MaxRAMFraction, DefaultMaxRAMFraction); |
1626 } | 1652 } |
1851 if (UseGCLogFileRotation) { | 1877 if (UseGCLogFileRotation) { |
1852 if ((Arguments::gc_log_filename() == NULL) || | 1878 if ((Arguments::gc_log_filename() == NULL) || |
1853 (NumberOfGCLogFiles == 0) || | 1879 (NumberOfGCLogFiles == 0) || |
1854 (GCLogFileSize == 0)) { | 1880 (GCLogFileSize == 0)) { |
1855 jio_fprintf(defaultStream::output_stream(), | 1881 jio_fprintf(defaultStream::output_stream(), |
1856 "To enable GC log rotation, use -Xloggc:<filename> -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=<num_of_files> -XX:GCLogFileSize=<num_of_size>\n" | 1882 "To enable GC log rotation, use -Xloggc:<filename> -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=<num_of_files> -XX:GCLogFileSize=<num_of_size>[k|K|m|M|g|G]\n" |
1857 "where num_of_file > 0 and num_of_size > 0\n" | 1883 "where num_of_file > 0 and num_of_size > 0\n" |
1858 "GC log rotation is turned off\n"); | 1884 "GC log rotation is turned off\n"); |
1859 UseGCLogFileRotation = false; | 1885 UseGCLogFileRotation = false; |
1860 } | 1886 } |
1861 } | 1887 } |
1863 if (UseGCLogFileRotation && GCLogFileSize < 8*K) { | 1889 if (UseGCLogFileRotation && GCLogFileSize < 8*K) { |
1864 FLAG_SET_CMDLINE(uintx, GCLogFileSize, 8*K); | 1890 FLAG_SET_CMDLINE(uintx, GCLogFileSize, 8*K); |
1865 jio_fprintf(defaultStream::output_stream(), | 1891 jio_fprintf(defaultStream::output_stream(), |
1866 "GCLogFileSize changed to minimum 8K\n"); | 1892 "GCLogFileSize changed to minimum 8K\n"); |
1867 } | 1893 } |
1894 } | |
1895 | |
1896 // This function is called for -Xloggc:<filename>, it can be used | |
1897 // to check if a given file name(or string) conforms to the following | |
1898 // specification: | |
1899 // A valid string only contains "[A-Z][a-z][0-9].-_%[p|t]" | |
1900 // %p and %t only allowed once. We only limit usage of filename not path | |
1901 bool is_filename_valid(const char *file_name) { | |
1902 const char* p = file_name; | |
1903 char file_sep = os::file_separator()[0]; | |
1904 const char* cp; | |
1905 // skip prefix path | |
1906 for (cp = file_name; *cp != '\0'; cp++) { | |
1907 if (*cp == '/' || *cp == file_sep) { | |
1908 p = cp + 1; | |
1909 } | |
1910 } | |
1911 | |
1912 int count_p = 0; | |
1913 int count_t = 0; | |
1914 while (*p != '\0') { | |
1915 if ((*p >= '0' && *p <= '9') || | |
1916 (*p >= 'A' && *p <= 'Z') || | |
1917 (*p >= 'a' && *p <= 'z') || | |
1918 *p == '-' || | |
1919 *p == '_' || | |
1920 *p == '.') { | |
1921 p++; | |
1922 continue; | |
1923 } | |
1924 if (*p == '%') { | |
1925 if(*(p + 1) == 'p') { | |
1926 p += 2; | |
1927 count_p ++; | |
1928 continue; | |
1929 } | |
1930 if (*(p + 1) == 't') { | |
1931 p += 2; | |
1932 count_t ++; | |
1933 continue; | |
1934 } | |
1935 } | |
1936 return false; | |
1937 } | |
1938 return count_p < 2 && count_t < 2; | |
1868 } | 1939 } |
1869 | 1940 |
1870 // Check consistency of GC selection | 1941 // Check consistency of GC selection |
1871 bool Arguments::check_gc_consistency() { | 1942 bool Arguments::check_gc_consistency() { |
1872 check_gclog_consistency(); | 1943 check_gclog_consistency(); |
1887 jio_fprintf(defaultStream::error_stream(), | 1958 jio_fprintf(defaultStream::error_stream(), |
1888 "Conflicting collector combinations in option list; " | 1959 "Conflicting collector combinations in option list; " |
1889 "please refer to the release notes for the combinations " | 1960 "please refer to the release notes for the combinations " |
1890 "allowed\n"); | 1961 "allowed\n"); |
1891 status = false; | 1962 status = false; |
1892 } else if (ReservedCodeCacheSize > 2*G) { | |
1893 // Code cache size larger than MAXINT is not supported. | |
1894 jio_fprintf(defaultStream::error_stream(), | |
1895 "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M, | |
1896 (2*G)/M); | |
1897 status = false; | |
1898 } | 1963 } |
1899 return status; | 1964 return status; |
1900 } | 1965 } |
1901 | 1966 |
1902 void Arguments::check_deprecated_gcs() { | 1967 void Arguments::check_deprecated_gcs() { |
1923 "and will likely be removed in future release"); | 1988 "and will likely be removed in future release"); |
1924 } | 1989 } |
1925 if (FLAG_IS_CMDLINE(DefaultMaxRAMFraction)) { | 1990 if (FLAG_IS_CMDLINE(DefaultMaxRAMFraction)) { |
1926 warning("DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. " | 1991 warning("DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. " |
1927 "Use MaxRAMFraction instead."); | 1992 "Use MaxRAMFraction instead."); |
1993 } | |
1994 if (FLAG_IS_CMDLINE(UseCMSCompactAtFullCollection)) { | |
1995 warning("UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release."); | |
1996 } | |
1997 if (FLAG_IS_CMDLINE(CMSFullGCsBeforeCompaction)) { | |
1998 warning("CMSFullGCsBeforeCompaction is deprecated and will likely be removed in a future release."); | |
1999 } | |
2000 if (FLAG_IS_CMDLINE(UseCMSCollectionPassing)) { | |
2001 warning("UseCMSCollectionPassing is deprecated and will likely be removed in a future release."); | |
1928 } | 2002 } |
1929 } | 2003 } |
1930 | 2004 |
1931 // Check stack pages settings | 2005 // Check stack pages settings |
1932 bool Arguments::check_stack_pages() | 2006 bool Arguments::check_stack_pages() |
1974 | 2048 |
1975 // Divide by bucket size to prevent a large size from causing rollover when | 2049 // Divide by bucket size to prevent a large size from causing rollover when |
1976 // calculating amount of memory needed to be allocated for the String table. | 2050 // calculating amount of memory needed to be allocated for the String table. |
1977 status = status && verify_interval(StringTableSize, minimumStringTableSize, | 2051 status = status && verify_interval(StringTableSize, minimumStringTableSize, |
1978 (max_uintx / StringTable::bucket_size()), "StringTable size"); | 2052 (max_uintx / StringTable::bucket_size()), "StringTable size"); |
2053 | |
2054 status = status && verify_interval(SymbolTableSize, minimumSymbolTableSize, | |
2055 (max_uintx / SymbolTable::bucket_size()), "SymbolTable size"); | |
1979 | 2056 |
1980 if (MinHeapFreeRatio > MaxHeapFreeRatio) { | 2057 if (MinHeapFreeRatio > MaxHeapFreeRatio) { |
1981 jio_fprintf(defaultStream::error_stream(), | 2058 jio_fprintf(defaultStream::error_stream(), |
1982 "MinHeapFreeRatio (" UINTX_FORMAT ") must be less than or " | 2059 "MinHeapFreeRatio (" UINTX_FORMAT ") must be less than or " |
1983 "equal to MaxHeapFreeRatio (" UINTX_FORMAT ")\n", | 2060 "equal to MaxHeapFreeRatio (" UINTX_FORMAT ")\n", |
2160 status = status && verify_interval(TLABWasteTargetPercent, | 2237 status = status && verify_interval(TLABWasteTargetPercent, |
2161 1, 100, "TLABWasteTargetPercent"); | 2238 1, 100, "TLABWasteTargetPercent"); |
2162 | 2239 |
2163 status = status && verify_object_alignment(); | 2240 status = status && verify_object_alignment(); |
2164 | 2241 |
2165 status = status && verify_interval(ClassMetaspaceSize, 1*M, 3*G, | 2242 status = status && verify_interval(CompressedClassSpaceSize, 1*M, 3*G, |
2166 "ClassMetaspaceSize"); | 2243 "CompressedClassSpaceSize"); |
2167 | 2244 |
2168 status = status && verify_interval(MarkStackSizeMax, | 2245 status = status && verify_interval(MarkStackSizeMax, |
2169 1, (max_jint - 1), "MarkStackSizeMax"); | 2246 1, (max_jint - 1), "MarkStackSizeMax"); |
2170 status = status && verify_interval(NUMAChunkResizeWeight, 0, 100, "NUMAChunkResizeWeight"); | 2247 status = status && verify_interval(NUMAChunkResizeWeight, 0, 100, "NUMAChunkResizeWeight"); |
2171 | 2248 |
2231 // 8K is well beyond the reasonable HW cache line size, even with the | 2308 // 8K is well beyond the reasonable HW cache line size, even with the |
2232 // aggressive prefetching, while still leaving the room for segregating | 2309 // aggressive prefetching, while still leaving the room for segregating |
2233 // among the distinct pages. | 2310 // among the distinct pages. |
2234 if (ContendedPaddingWidth < 0 || ContendedPaddingWidth > 8192) { | 2311 if (ContendedPaddingWidth < 0 || ContendedPaddingWidth > 8192) { |
2235 jio_fprintf(defaultStream::error_stream(), | 2312 jio_fprintf(defaultStream::error_stream(), |
2236 "ContendedPaddingWidth=" INTX_FORMAT " must be the between %d and %d\n", | 2313 "ContendedPaddingWidth=" INTX_FORMAT " must be in between %d and %d\n", |
2237 ContendedPaddingWidth, 0, 8192); | 2314 ContendedPaddingWidth, 0, 8192); |
2238 status = false; | 2315 status = false; |
2239 } | 2316 } |
2240 | 2317 |
2241 // Need to enforce the padding not to break the existing field alignments. | 2318 // Need to enforce the padding not to break the existing field alignments. |
2242 // It is sufficient to check against the largest type size. | 2319 // It is sufficient to check against the largest type size. |
2243 if ((ContendedPaddingWidth % BytesPerLong) != 0) { | 2320 if ((ContendedPaddingWidth % BytesPerLong) != 0) { |
2244 jio_fprintf(defaultStream::error_stream(), | 2321 jio_fprintf(defaultStream::error_stream(), |
2245 "ContendedPaddingWidth=" INTX_FORMAT " must be the multiple of %d\n", | 2322 "ContendedPaddingWidth=" INTX_FORMAT " must be a multiple of %d\n", |
2246 ContendedPaddingWidth, BytesPerLong); | 2323 ContendedPaddingWidth, BytesPerLong); |
2247 status = false; | 2324 status = false; |
2248 } | 2325 } |
2249 | 2326 |
2250 // Check lower bounds of the code cache | 2327 // Check lower bounds of the code cache |
2270 jio_fprintf(defaultStream::error_stream(), | 2347 jio_fprintf(defaultStream::error_stream(), |
2271 "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M, | 2348 "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M, |
2272 (2*G)/M); | 2349 (2*G)/M); |
2273 status = false; | 2350 status = false; |
2274 } | 2351 } |
2352 | |
2353 status &= verify_interval(NmethodSweepFraction, 1, ReservedCodeCacheSize/K, "NmethodSweepFraction"); | |
2354 status &= verify_interval(NmethodSweepActivity, 0, 2000, "NmethodSweepActivity"); | |
2355 | |
2275 return status; | 2356 return status; |
2276 } | 2357 } |
2277 | 2358 |
2278 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore, | 2359 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore, |
2279 const char* option_type) { | 2360 const char* option_type) { |
2371 if (result != JNI_OK) { | 2452 if (result != JNI_OK) { |
2372 return result; | 2453 return result; |
2373 } | 2454 } |
2374 | 2455 |
2375 // Parse JavaVMInitArgs structure passed in | 2456 // Parse JavaVMInitArgs structure passed in |
2376 result = parse_each_vm_init_arg(args, &scp, &scp_assembly_required, COMMAND_LINE); | 2457 result = parse_each_vm_init_arg(args, &scp, &scp_assembly_required, Flag::COMMAND_LINE); |
2377 if (result != JNI_OK) { | 2458 if (result != JNI_OK) { |
2378 return result; | 2459 return result; |
2379 } | |
2380 | |
2381 if (AggressiveOpts) { | |
2382 // Insert alt-rt.jar between user-specified bootclasspath | |
2383 // prefix and the default bootclasspath. os::set_boot_path() | |
2384 // uses meta_index_dir as the default bootclasspath directory. | |
2385 const char* altclasses_jar = "alt-rt.jar"; | |
2386 size_t altclasses_path_len = strlen(get_meta_index_dir()) + 1 + | |
2387 strlen(altclasses_jar); | |
2388 char* altclasses_path = NEW_C_HEAP_ARRAY(char, altclasses_path_len, mtInternal); | |
2389 strcpy(altclasses_path, get_meta_index_dir()); | |
2390 strcat(altclasses_path, altclasses_jar); | |
2391 scp.add_suffix_to_prefix(altclasses_path); | |
2392 scp_assembly_required = true; | |
2393 FREE_C_HEAP_ARRAY(char, altclasses_path, mtInternal); | |
2394 } | 2460 } |
2395 | 2461 |
2396 // Parse _JAVA_OPTIONS environment variable (if present) (mimics classic VM) | 2462 // Parse _JAVA_OPTIONS environment variable (if present) (mimics classic VM) |
2397 result = parse_java_options_environment_variable(&scp, &scp_assembly_required); | 2463 result = parse_java_options_environment_variable(&scp, &scp_assembly_required); |
2398 if (result != JNI_OK) { | 2464 if (result != JNI_OK) { |
2458 } | 2524 } |
2459 | 2525 |
2460 jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, | 2526 jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, |
2461 SysClassPath* scp_p, | 2527 SysClassPath* scp_p, |
2462 bool* scp_assembly_required_p, | 2528 bool* scp_assembly_required_p, |
2463 FlagValueOrigin origin) { | 2529 Flag::Flags origin) { |
2464 // Remaining part of option string | 2530 // Remaining part of option string |
2465 const char* tail; | 2531 const char* tail; |
2466 | 2532 |
2467 // iterate over arguments | 2533 // iterate over arguments |
2468 for (int index = 0; index < args->nOptions; index++) { | 2534 for (int index = 0; index < args->nOptions; index++) { |
2595 // -Xbatch | 2661 // -Xbatch |
2596 } else if (match_option(option, "-Xbatch", &tail)) { | 2662 } else if (match_option(option, "-Xbatch", &tail)) { |
2597 FLAG_SET_CMDLINE(bool, BackgroundCompilation, false); | 2663 FLAG_SET_CMDLINE(bool, BackgroundCompilation, false); |
2598 // -Xmn for compatibility with other JVM vendors | 2664 // -Xmn for compatibility with other JVM vendors |
2599 } else if (match_option(option, "-Xmn", &tail)) { | 2665 } else if (match_option(option, "-Xmn", &tail)) { |
2600 julong long_initial_eden_size = 0; | 2666 julong long_initial_young_size = 0; |
2601 ArgsRange errcode = parse_memory_size(tail, &long_initial_eden_size, 1); | 2667 ArgsRange errcode = parse_memory_size(tail, &long_initial_young_size, 1); |
2602 if (errcode != arg_in_range) { | 2668 if (errcode != arg_in_range) { |
2603 jio_fprintf(defaultStream::error_stream(), | 2669 jio_fprintf(defaultStream::error_stream(), |
2604 "Invalid initial eden size: %s\n", option->optionString); | 2670 "Invalid initial young generation size: %s\n", option->optionString); |
2605 describe_range_error(errcode); | 2671 describe_range_error(errcode); |
2606 return JNI_EINVAL; | 2672 return JNI_EINVAL; |
2607 } | 2673 } |
2608 FLAG_SET_CMDLINE(uintx, MaxNewSize, (uintx)long_initial_eden_size); | 2674 FLAG_SET_CMDLINE(uintx, MaxNewSize, (uintx)long_initial_young_size); |
2609 FLAG_SET_CMDLINE(uintx, NewSize, (uintx)long_initial_eden_size); | 2675 FLAG_SET_CMDLINE(uintx, NewSize, (uintx)long_initial_young_size); |
2610 // -Xms | 2676 // -Xms |
2611 } else if (match_option(option, "-Xms", &tail)) { | 2677 } else if (match_option(option, "-Xms", &tail)) { |
2612 julong long_initial_heap_size = 0; | 2678 julong long_initial_heap_size = 0; |
2613 // an initial heap size of 0 means automatically determine | 2679 // an initial heap size of 0 means automatically determine |
2614 ArgsRange errcode = parse_memory_size(tail, &long_initial_heap_size, 0); | 2680 ArgsRange errcode = parse_memory_size(tail, &long_initial_heap_size, 0); |
2632 return JNI_EINVAL; | 2698 return JNI_EINVAL; |
2633 } | 2699 } |
2634 FLAG_SET_CMDLINE(uintx, MaxHeapSize, (uintx)long_max_heap_size); | 2700 FLAG_SET_CMDLINE(uintx, MaxHeapSize, (uintx)long_max_heap_size); |
2635 // Xmaxf | 2701 // Xmaxf |
2636 } else if (match_option(option, "-Xmaxf", &tail)) { | 2702 } else if (match_option(option, "-Xmaxf", &tail)) { |
2637 int maxf = (int)(atof(tail) * 100); | 2703 char* err; |
2638 if (maxf < 0 || maxf > 100) { | 2704 int maxf = (int)(strtod(tail, &err) * 100); |
2705 if (*err != '\0' || maxf < 0 || maxf > 100) { | |
2639 jio_fprintf(defaultStream::error_stream(), | 2706 jio_fprintf(defaultStream::error_stream(), |
2640 "Bad max heap free percentage size: %s\n", | 2707 "Bad max heap free percentage size: %s\n", |
2641 option->optionString); | 2708 option->optionString); |
2642 return JNI_EINVAL; | 2709 return JNI_EINVAL; |
2643 } else { | 2710 } else { |
2644 FLAG_SET_CMDLINE(uintx, MaxHeapFreeRatio, maxf); | 2711 FLAG_SET_CMDLINE(uintx, MaxHeapFreeRatio, maxf); |
2645 } | 2712 } |
2646 // Xminf | 2713 // Xminf |
2647 } else if (match_option(option, "-Xminf", &tail)) { | 2714 } else if (match_option(option, "-Xminf", &tail)) { |
2648 int minf = (int)(atof(tail) * 100); | 2715 char* err; |
2649 if (minf < 0 || minf > 100) { | 2716 int minf = (int)(strtod(tail, &err) * 100); |
2717 if (*err != '\0' || minf < 0 || minf > 100) { | |
2650 jio_fprintf(defaultStream::error_stream(), | 2718 jio_fprintf(defaultStream::error_stream(), |
2651 "Bad min heap free percentage size: %s\n", | 2719 "Bad min heap free percentage size: %s\n", |
2652 option->optionString); | 2720 option->optionString); |
2653 return JNI_EINVAL; | 2721 return JNI_EINVAL; |
2654 } else { | 2722 } else { |
2818 } else if (match_option(option, "-Xloggc:", &tail)) { | 2886 } else if (match_option(option, "-Xloggc:", &tail)) { |
2819 // Redirect GC output to the file. -Xloggc:<filename> | 2887 // Redirect GC output to the file. -Xloggc:<filename> |
2820 // ostream_init_log(), when called will use this filename | 2888 // ostream_init_log(), when called will use this filename |
2821 // to initialize a fileStream. | 2889 // to initialize a fileStream. |
2822 _gc_log_filename = strdup(tail); | 2890 _gc_log_filename = strdup(tail); |
2891 if (!is_filename_valid(_gc_log_filename)) { | |
2892 jio_fprintf(defaultStream::output_stream(), | |
2893 "Invalid file name for use with -Xloggc: Filename can only contain the " | |
2894 "characters [A-Z][a-z][0-9]-_.%%[p|t] but it has been %s\n" | |
2895 "Note %%p or %%t can only be used once\n", _gc_log_filename); | |
2896 return JNI_EINVAL; | |
2897 } | |
2823 FLAG_SET_CMDLINE(bool, PrintGC, true); | 2898 FLAG_SET_CMDLINE(bool, PrintGC, true); |
2824 FLAG_SET_CMDLINE(bool, PrintGCTimeStamps, true); | 2899 FLAG_SET_CMDLINE(bool, PrintGCTimeStamps, true); |
2825 | 2900 |
2826 // JNI hooks | 2901 // JNI hooks |
2827 } else if (match_option(option, "-Xcheck", &tail)) { | 2902 } else if (match_option(option, "-Xcheck", &tail)) { |
3274 logOption(tail); | 3349 logOption(tail); |
3275 } | 3350 } |
3276 } | 3351 } |
3277 } | 3352 } |
3278 | 3353 |
3279 return(parse_each_vm_init_arg(&vm_args, scp_p, scp_assembly_required_p, ENVIRON_VAR)); | 3354 return(parse_each_vm_init_arg(&vm_args, scp_p, scp_assembly_required_p, Flag::ENVIRON_VAR)); |
3280 } | 3355 } |
3281 return JNI_OK; | 3356 return JNI_OK; |
3282 } | 3357 } |
3283 | 3358 |
3284 void Arguments::set_shared_spaces_flags() { | 3359 void Arguments::set_shared_spaces_flags() { |
3286 if (RequireSharedSpaces) { | 3361 if (RequireSharedSpaces) { |
3287 warning("cannot dump shared archive while using shared archive"); | 3362 warning("cannot dump shared archive while using shared archive"); |
3288 } | 3363 } |
3289 UseSharedSpaces = false; | 3364 UseSharedSpaces = false; |
3290 #ifdef _LP64 | 3365 #ifdef _LP64 |
3291 if (!UseCompressedOops || !UseCompressedKlassPointers) { | 3366 if (!UseCompressedOops || !UseCompressedClassPointers) { |
3292 vm_exit_during_initialization( | 3367 vm_exit_during_initialization( |
3293 "Cannot dump shared archive when UseCompressedOops or UseCompressedKlassPointers is off.", NULL); | 3368 "Cannot dump shared archive when UseCompressedOops or UseCompressedClassPointers is off.", NULL); |
3294 } | 3369 } |
3295 } else { | 3370 } else { |
3296 // UseCompressedOops and UseCompressedKlassPointers must be on for UseSharedSpaces. | 3371 // UseCompressedOops and UseCompressedClassPointers must be on for UseSharedSpaces. |
3297 if (!UseCompressedOops || !UseCompressedKlassPointers) { | 3372 if (!UseCompressedOops || !UseCompressedClassPointers) { |
3298 no_shared_spaces(); | 3373 no_shared_spaces(); |
3299 } | 3374 } |
3300 #endif | 3375 #endif |
3301 } | 3376 } |
3302 } | 3377 } |
3338 } | 3413 } |
3339 } | 3414 } |
3340 return shared_archive_path; | 3415 return shared_archive_path; |
3341 } | 3416 } |
3342 | 3417 |
3418 #ifndef PRODUCT | |
3419 // Determine whether LogVMOutput should be implicitly turned on. | |
3420 static bool use_vm_log() { | |
3421 if (LogCompilation || !FLAG_IS_DEFAULT(LogFile) || | |
3422 PrintCompilation || PrintInlining || PrintDependencies || PrintNativeNMethods || | |
3423 PrintDebugInfo || PrintRelocations || PrintNMethods || PrintExceptionHandlers || | |
3424 PrintAssembly || TraceDeoptimization || TraceDependencies || | |
3425 (VerifyDependencies && FLAG_IS_CMDLINE(VerifyDependencies))) { | |
3426 return true; | |
3427 } | |
3428 | |
3429 #ifdef COMPILER1 | |
3430 if (PrintC1Statistics) { | |
3431 return true; | |
3432 } | |
3433 #endif // COMPILER1 | |
3434 | |
3435 #ifdef COMPILER2 | |
3436 if (PrintOptoAssembly || PrintOptoStatistics) { | |
3437 return true; | |
3438 } | |
3439 #endif // COMPILER2 | |
3440 | |
3441 return false; | |
3442 } | |
3443 #endif // PRODUCT | |
3444 | |
3343 // Parse entry point called from JNI_CreateJavaVM | 3445 // Parse entry point called from JNI_CreateJavaVM |
3344 | 3446 |
3345 jint Arguments::parse(const JavaVMInitArgs* args) { | 3447 jint Arguments::parse(const JavaVMInitArgs* args) { |
3346 | 3448 |
3347 // Remaining part of option string | 3449 // Remaining part of option string |
3518 FLAG_SET_DEFAULT(PrintSharedSpaces, false); | 3620 FLAG_SET_DEFAULT(PrintSharedSpaces, false); |
3519 } | 3621 } |
3520 no_shared_spaces(); | 3622 no_shared_spaces(); |
3521 #endif // INCLUDE_CDS | 3623 #endif // INCLUDE_CDS |
3522 | 3624 |
3625 return JNI_OK; | |
3626 } | |
3627 | |
3628 jint Arguments::apply_ergo() { | |
3629 | |
3523 // Set flags based on ergonomics. | 3630 // Set flags based on ergonomics. |
3524 set_ergonomics_flags(); | 3631 set_ergonomics_flags(); |
3525 | 3632 |
3526 set_shared_spaces_flags(); | 3633 set_shared_spaces_flags(); |
3527 | 3634 |
3537 if (CompilationPolicyChoice >= 2) { | 3644 if (CompilationPolicyChoice >= 2) { |
3538 vm_exit_during_initialization( | 3645 vm_exit_during_initialization( |
3539 "Incompatible compilation policy selected", NULL); | 3646 "Incompatible compilation policy selected", NULL); |
3540 } | 3647 } |
3541 } | 3648 } |
3542 | |
3543 set_heap_base_min_address(); | |
3544 | 3649 |
3545 // Set heap size based on available physical memory | 3650 // Set heap size based on available physical memory |
3546 set_heap_size(); | 3651 set_heap_size(); |
3547 | 3652 |
3548 #if INCLUDE_ALL_GCS | 3653 #if INCLUDE_ALL_GCS |
3566 } | 3671 } |
3567 } | 3672 } |
3568 #else // INCLUDE_ALL_GCS | 3673 #else // INCLUDE_ALL_GCS |
3569 assert(verify_serial_gc_flags(), "SerialGC unset"); | 3674 assert(verify_serial_gc_flags(), "SerialGC unset"); |
3570 #endif // INCLUDE_ALL_GCS | 3675 #endif // INCLUDE_ALL_GCS |
3676 | |
3677 // Initialize Metaspace flags and alignments. | |
3678 Metaspace::ergo_initialize(); | |
3571 | 3679 |
3572 // Set bytecode rewriting flags | 3680 // Set bytecode rewriting flags |
3573 set_bytecode_flags(); | 3681 set_bytecode_flags(); |
3574 | 3682 |
3575 // Set flags if Aggressive optimization flags (-XX:+AggressiveOpts) enabled. | 3683 // Set flags if Aggressive optimization flags (-XX:+AggressiveOpts) enabled. |
3595 #ifdef ZERO | 3703 #ifdef ZERO |
3596 // Clear flags not supported on zero. | 3704 // Clear flags not supported on zero. |
3597 FLAG_SET_DEFAULT(ProfileInterpreter, false); | 3705 FLAG_SET_DEFAULT(ProfileInterpreter, false); |
3598 FLAG_SET_DEFAULT(UseBiasedLocking, false); | 3706 FLAG_SET_DEFAULT(UseBiasedLocking, false); |
3599 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedOops, false)); | 3707 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedOops, false)); |
3600 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedKlassPointers, false)); | 3708 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedClassPointers, false)); |
3601 #endif // CC_INTERP | 3709 #endif // CC_INTERP |
3602 | 3710 |
3603 #ifdef COMPILER2 | 3711 #ifdef COMPILER2 |
3604 if (!UseBiasedLocking || EmitSync != 0) { | 3712 if (!UseBiasedLocking || EmitSync != 0) { |
3605 UseOptoBiasInlining = false; | 3713 UseOptoBiasInlining = false; |
3617 #endif | 3725 #endif |
3618 if (IncrementalInline && FLAG_IS_DEFAULT(MaxNodeLimit)) { | 3726 if (IncrementalInline && FLAG_IS_DEFAULT(MaxNodeLimit)) { |
3619 // incremental inlining: bump MaxNodeLimit | 3727 // incremental inlining: bump MaxNodeLimit |
3620 FLAG_SET_DEFAULT(MaxNodeLimit, (intx)75000); | 3728 FLAG_SET_DEFAULT(MaxNodeLimit, (intx)75000); |
3621 } | 3729 } |
3730 if (!UseTypeSpeculation && FLAG_IS_DEFAULT(TypeProfileLevel)) { | |
3731 // nothing to use the profiling, turn if off | |
3732 FLAG_SET_DEFAULT(TypeProfileLevel, 0); | |
3733 } | |
3734 if (UseTypeSpeculation && FLAG_IS_DEFAULT(ReplaceInParentMaps)) { | |
3735 // Doing the replace in parent maps helps speculation | |
3736 FLAG_SET_DEFAULT(ReplaceInParentMaps, true); | |
3737 } | |
3738 #ifndef X86 | |
3739 // Only on x86 for now | |
3740 FLAG_SET_DEFAULT(TypeProfileLevel, 0); | |
3741 #endif | |
3622 #endif | 3742 #endif |
3623 | 3743 |
3624 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) { | 3744 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) { |
3625 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output"); | 3745 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output"); |
3626 DebugNonSafepoints = true; | 3746 DebugNonSafepoints = true; |
3747 } | |
3748 | |
3749 if (FLAG_IS_CMDLINE(CompressedClassSpaceSize) && !UseCompressedClassPointers) { | |
3750 warning("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used"); | |
3627 } | 3751 } |
3628 | 3752 |
3629 #ifndef PRODUCT | 3753 #ifndef PRODUCT |
3630 if (CompileTheWorld) { | 3754 if (CompileTheWorld) { |
3631 // Force NmethodSweeper to sweep whole CodeCache each time. | 3755 // Force NmethodSweeper to sweep whole CodeCache each time. |
3632 if (FLAG_IS_DEFAULT(NmethodSweepFraction)) { | 3756 if (FLAG_IS_DEFAULT(NmethodSweepFraction)) { |
3633 NmethodSweepFraction = 1; | 3757 NmethodSweepFraction = 1; |
3634 } | 3758 } |
3635 } | 3759 } |
3636 #endif | 3760 |
3761 if (!LogVMOutput && FLAG_IS_DEFAULT(LogVMOutput)) { | |
3762 if (use_vm_log()) { | |
3763 LogVMOutput = true; | |
3764 } | |
3765 } | |
3766 #endif // PRODUCT | |
3637 | 3767 |
3638 if (PrintCommandLineFlags) { | 3768 if (PrintCommandLineFlags) { |
3639 CommandLineFlags::printSetFlags(tty); | 3769 CommandLineFlags::printSetFlags(tty); |
3640 } | 3770 } |
3641 | 3771 |