Mercurial > hg > truffle
comparison src/share/vm/runtime/arguments.cpp @ 1930:2d26b0046e0d
Merge.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Tue, 30 Nov 2010 14:53:30 +0100 |
parents | ba37b9335e1e 2db84614f61d |
children | 06f017f7daa7 |
comparison
equal
deleted
inserted
replaced
1484:6b7001391c97 | 1930:2d26b0046e0d |
---|---|
1 /* | 1 /* |
2 * Copyright 1997-2010 Sun Microsystems, Inc. All Rights Reserved. | 2 * Copyright (c) 1997, 2010, 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. |
14 * | 14 * |
15 * You should have received a copy of the GNU General Public License version | 15 * You should have received a copy of the GNU General Public License version |
16 * 2 along with this work; if not, write to the Free Software Foundation, | 16 * 2 along with this work; if not, write to the Free Software Foundation, |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
18 * | 18 * |
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 * CA 95054 USA or visit www.sun.com if you need additional information or | 20 * or visit www.oracle.com if you need additional information or have any |
21 * have any questions. | 21 * questions. |
22 * | 22 * |
23 */ | 23 */ |
24 | 24 |
25 #include "incls/_precompiled.incl" | 25 #include "incls/_precompiled.incl" |
26 #include "incls/_arguments.cpp.incl" | 26 #include "incls/_arguments.cpp.incl" |
50 // These parameters are reset in method parse_vm_init_args(JavaVMInitArgs*) | 50 // These parameters are reset in method parse_vm_init_args(JavaVMInitArgs*) |
51 bool Arguments::_AlwaysCompileLoopMethods = AlwaysCompileLoopMethods; | 51 bool Arguments::_AlwaysCompileLoopMethods = AlwaysCompileLoopMethods; |
52 bool Arguments::_UseOnStackReplacement = UseOnStackReplacement; | 52 bool Arguments::_UseOnStackReplacement = UseOnStackReplacement; |
53 bool Arguments::_BackgroundCompilation = BackgroundCompilation; | 53 bool Arguments::_BackgroundCompilation = BackgroundCompilation; |
54 bool Arguments::_ClipInlining = ClipInlining; | 54 bool Arguments::_ClipInlining = ClipInlining; |
55 intx Arguments::_Tier2CompileThreshold = Tier2CompileThreshold; | |
56 | 55 |
57 char* Arguments::SharedArchivePath = NULL; | 56 char* Arguments::SharedArchivePath = NULL; |
58 | 57 |
59 AgentLibraryList Arguments::_libraryList; | 58 AgentLibraryList Arguments::_libraryList; |
60 AgentLibraryList Arguments::_agentList; | 59 AgentLibraryList Arguments::_agentList; |
120 void Arguments::init_system_properties() { | 119 void Arguments::init_system_properties() { |
121 | 120 |
122 PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.version", "1.0", false)); | 121 PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.version", "1.0", false)); |
123 PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.name", | 122 PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.name", |
124 "Java Virtual Machine Specification", false)); | 123 "Java Virtual Machine Specification", false)); |
125 PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.vendor", | |
126 "Sun Microsystems Inc.", false)); | |
127 PropertyList_add(&_system_properties, new SystemProperty("java.vm.version", VM_Version::vm_release(), false)); | 124 PropertyList_add(&_system_properties, new SystemProperty("java.vm.version", VM_Version::vm_release(), false)); |
128 PropertyList_add(&_system_properties, new SystemProperty("java.vm.name", VM_Version::vm_name(), false)); | 125 PropertyList_add(&_system_properties, new SystemProperty("java.vm.name", VM_Version::vm_name(), false)); |
129 PropertyList_add(&_system_properties, new SystemProperty("java.vm.vendor", VM_Version::vm_vendor(), false)); | |
130 PropertyList_add(&_system_properties, new SystemProperty("java.vm.info", VM_Version::vm_info_string(), true)); | 126 PropertyList_add(&_system_properties, new SystemProperty("java.vm.info", VM_Version::vm_info_string(), true)); |
131 | 127 |
132 // following are JVMTI agent writeable properties. | 128 // following are JVMTI agent writeable properties. |
133 // Properties values are set to NULL and they are | 129 // Properties values are set to NULL and they are |
134 // os specific they are initialized in os::init_system_properties_values(). | 130 // os specific they are initialized in os::init_system_properties_values(). |
150 PropertyList_add(&_system_properties, _java_class_path); | 146 PropertyList_add(&_system_properties, _java_class_path); |
151 PropertyList_add(&_system_properties, _sun_boot_class_path); | 147 PropertyList_add(&_system_properties, _sun_boot_class_path); |
152 | 148 |
153 // Set OS specific system properties values | 149 // Set OS specific system properties values |
154 os::init_system_properties_values(); | 150 os::init_system_properties_values(); |
151 } | |
152 | |
153 | |
154 // Update/Initialize System properties after JDK version number is known | |
155 void Arguments::init_version_specific_system_properties() { | |
156 PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.vendor", | |
157 JDK_Version::is_gte_jdk17x_version() ? "Oracle Corporation" : "Sun Microsystems Inc.", false)); | |
158 PropertyList_add(&_system_properties, new SystemProperty("java.vm.vendor", VM_Version::vm_vendor(), false)); | |
155 } | 159 } |
156 | 160 |
157 /** | 161 /** |
158 * Provide a slightly more user-friendly way of eliminating -XX flags. | 162 * Provide a slightly more user-friendly way of eliminating -XX flags. |
159 * When a flag is eliminated, it can be added to this list in order to | 163 * When a flag is eliminated, it can be added to this list in order to |
184 { "MinTrainLength", JDK_Version::jdk(5), JDK_Version::jdk(7) }, | 188 { "MinTrainLength", JDK_Version::jdk(5), JDK_Version::jdk(7) }, |
185 { "AppendRatio", JDK_Version::jdk_update(6,10), JDK_Version::jdk(7) }, | 189 { "AppendRatio", JDK_Version::jdk_update(6,10), JDK_Version::jdk(7) }, |
186 { "DefaultMaxRAM", JDK_Version::jdk_update(6,18), JDK_Version::jdk(7) }, | 190 { "DefaultMaxRAM", JDK_Version::jdk_update(6,18), JDK_Version::jdk(7) }, |
187 { "DefaultInitialRAMFraction", | 191 { "DefaultInitialRAMFraction", |
188 JDK_Version::jdk_update(6,18), JDK_Version::jdk(7) }, | 192 JDK_Version::jdk_update(6,18), JDK_Version::jdk(7) }, |
193 { "UseDepthFirstScavengeOrder", | |
194 JDK_Version::jdk_update(6,22), JDK_Version::jdk(7) }, | |
195 { "HandlePromotionFailure", | |
196 JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) }, | |
197 { "MaxLiveObjectEvacuationRatio", | |
198 JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) }, | |
189 { NULL, JDK_Version(0), JDK_Version(0) } | 199 { NULL, JDK_Version(0), JDK_Version(0) } |
190 }; | 200 }; |
191 | 201 |
192 // Returns true if the flag is obsolete and fits into the range specified | 202 // Returns true if the flag is obsolete and fits into the range specified |
193 // for being ignored. In the case that the flag is ignored, the 'version' | 203 // for being ignored. In the case that the flag is ignored, the 'version' |
915 // use the saved values | 925 // use the saved values |
916 ClipInlining = Arguments::_ClipInlining; | 926 ClipInlining = Arguments::_ClipInlining; |
917 AlwaysCompileLoopMethods = Arguments::_AlwaysCompileLoopMethods; | 927 AlwaysCompileLoopMethods = Arguments::_AlwaysCompileLoopMethods; |
918 UseOnStackReplacement = Arguments::_UseOnStackReplacement; | 928 UseOnStackReplacement = Arguments::_UseOnStackReplacement; |
919 BackgroundCompilation = Arguments::_BackgroundCompilation; | 929 BackgroundCompilation = Arguments::_BackgroundCompilation; |
920 Tier2CompileThreshold = Arguments::_Tier2CompileThreshold; | |
921 | 930 |
922 // Change from defaults based on mode | 931 // Change from defaults based on mode |
923 switch (mode) { | 932 switch (mode) { |
924 default: | 933 default: |
925 ShouldNotReachHere(); | 934 ShouldNotReachHere(); |
949 jio_fprintf(defaultStream::error_stream(), | 958 jio_fprintf(defaultStream::error_stream(), |
950 "Class data sharing is inconsistent with other specified options.\n"); | 959 "Class data sharing is inconsistent with other specified options.\n"); |
951 vm_exit_during_initialization("Unable to use shared archive.", NULL); | 960 vm_exit_during_initialization("Unable to use shared archive.", NULL); |
952 } else { | 961 } else { |
953 FLAG_SET_DEFAULT(UseSharedSpaces, false); | 962 FLAG_SET_DEFAULT(UseSharedSpaces, false); |
963 } | |
964 } | |
965 | |
966 void Arguments::check_compressed_oops_compat() { | |
967 #ifdef _LP64 | |
968 assert(UseCompressedOops, "Precondition"); | |
969 # if defined(COMPILER1) && !defined(TIERED) | |
970 // Until c1 supports compressed oops turn them off. | |
971 FLAG_SET_DEFAULT(UseCompressedOops, false); | |
972 # else | |
973 // Is it on by default or set on ergonomically | |
974 bool is_on_by_default = FLAG_IS_DEFAULT(UseCompressedOops) || FLAG_IS_ERGO(UseCompressedOops); | |
975 | |
976 // Tiered currently doesn't work with compressed oops | |
977 if (TieredCompilation) { | |
978 if (is_on_by_default) { | |
979 FLAG_SET_DEFAULT(UseCompressedOops, false); | |
980 return; | |
981 } else { | |
982 vm_exit_during_initialization( | |
983 "Tiered compilation is not supported with compressed oops yet", NULL); | |
984 } | |
985 } | |
986 | |
987 // If dumping an archive or forcing its use, disable compressed oops if possible | |
988 if (DumpSharedSpaces || RequireSharedSpaces) { | |
989 if (is_on_by_default) { | |
990 FLAG_SET_DEFAULT(UseCompressedOops, false); | |
991 return; | |
992 } else { | |
993 vm_exit_during_initialization( | |
994 "Class Data Sharing is not supported with compressed oops yet", NULL); | |
995 } | |
996 } else if (UseSharedSpaces) { | |
997 // UseSharedSpaces is on by default. With compressed oops, we turn it off. | |
998 FLAG_SET_DEFAULT(UseSharedSpaces, false); | |
999 } | |
1000 | |
1001 # endif // defined(COMPILER1) && !defined(TIERED) | |
1002 #endif // _LP64 | |
1003 } | |
1004 | |
1005 void Arguments::set_tiered_flags() { | |
1006 if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) { | |
1007 FLAG_SET_DEFAULT(CompilationPolicyChoice, 2); | |
1008 } | |
1009 if (CompilationPolicyChoice < 2) { | |
1010 vm_exit_during_initialization( | |
1011 "Incompatible compilation policy selected", NULL); | |
1012 } | |
1013 // Increase the code cache size - tiered compiles a lot more. | |
1014 if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) { | |
1015 FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 2); | |
954 } | 1016 } |
955 } | 1017 } |
956 | 1018 |
957 #ifndef KERNEL | 1019 #ifndef KERNEL |
958 // If the user has chosen ParallelGCThreads > 0, we set UseParNewGC | 1020 // If the user has chosen ParallelGCThreads > 0, we set UseParNewGC |
1215 tty->print_cr("ConcGCThreads: %u", ConcGCThreads); | 1277 tty->print_cr("ConcGCThreads: %u", ConcGCThreads); |
1216 } | 1278 } |
1217 } | 1279 } |
1218 #endif // KERNEL | 1280 #endif // KERNEL |
1219 | 1281 |
1282 void set_object_alignment() { | |
1283 // Object alignment. | |
1284 assert(is_power_of_2(ObjectAlignmentInBytes), "ObjectAlignmentInBytes must be power of 2"); | |
1285 MinObjAlignmentInBytes = ObjectAlignmentInBytes; | |
1286 assert(MinObjAlignmentInBytes >= HeapWordsPerLong * HeapWordSize, "ObjectAlignmentInBytes value is too small"); | |
1287 MinObjAlignment = MinObjAlignmentInBytes / HeapWordSize; | |
1288 assert(MinObjAlignmentInBytes == MinObjAlignment * HeapWordSize, "ObjectAlignmentInBytes value is incorrect"); | |
1289 MinObjAlignmentInBytesMask = MinObjAlignmentInBytes - 1; | |
1290 | |
1291 LogMinObjAlignmentInBytes = exact_log2(ObjectAlignmentInBytes); | |
1292 LogMinObjAlignment = LogMinObjAlignmentInBytes - LogHeapWordSize; | |
1293 | |
1294 // Oop encoding heap max | |
1295 OopEncodingHeapMax = (uint64_t(max_juint) + 1) << LogMinObjAlignmentInBytes; | |
1296 | |
1297 #ifndef KERNEL | |
1298 // Set CMS global values | |
1299 CompactibleFreeListSpace::set_cms_values(); | |
1300 #endif // KERNEL | |
1301 } | |
1302 | |
1303 bool verify_object_alignment() { | |
1304 // Object alignment. | |
1305 if (!is_power_of_2(ObjectAlignmentInBytes)) { | |
1306 jio_fprintf(defaultStream::error_stream(), | |
1307 "error: ObjectAlignmentInBytes=%d must be power of 2\n", | |
1308 (int)ObjectAlignmentInBytes); | |
1309 return false; | |
1310 } | |
1311 if ((int)ObjectAlignmentInBytes < BytesPerLong) { | |
1312 jio_fprintf(defaultStream::error_stream(), | |
1313 "error: ObjectAlignmentInBytes=%d must be greater or equal %d\n", | |
1314 (int)ObjectAlignmentInBytes, BytesPerLong); | |
1315 return false; | |
1316 } | |
1317 // It does not make sense to have big object alignment | |
1318 // since a space lost due to alignment will be greater | |
1319 // then a saved space from compressed oops. | |
1320 if ((int)ObjectAlignmentInBytes > 256) { | |
1321 jio_fprintf(defaultStream::error_stream(), | |
1322 "error: ObjectAlignmentInBytes=%d must not be greater then 256\n", | |
1323 (int)ObjectAlignmentInBytes); | |
1324 return false; | |
1325 } | |
1326 // In case page size is very small. | |
1327 if ((int)ObjectAlignmentInBytes >= os::vm_page_size()) { | |
1328 jio_fprintf(defaultStream::error_stream(), | |
1329 "error: ObjectAlignmentInBytes=%d must be less then page size %d\n", | |
1330 (int)ObjectAlignmentInBytes, os::vm_page_size()); | |
1331 return false; | |
1332 } | |
1333 return true; | |
1334 } | |
1335 | |
1220 inline uintx max_heap_for_compressed_oops() { | 1336 inline uintx max_heap_for_compressed_oops() { |
1221 LP64_ONLY(return oopDesc::OopEncodingHeapMax - MaxPermSize - os::vm_page_size()); | 1337 // Heap should be above HeapBaseMinAddress to get zero based compressed oops. |
1338 LP64_ONLY(return OopEncodingHeapMax - MaxPermSize - os::vm_page_size() - HeapBaseMinAddress); | |
1222 NOT_LP64(ShouldNotReachHere(); return 0); | 1339 NOT_LP64(ShouldNotReachHere(); return 0); |
1223 } | 1340 } |
1224 | 1341 |
1225 bool Arguments::should_auto_select_low_pause_collector() { | 1342 bool Arguments::should_auto_select_low_pause_collector() { |
1226 if (UseAutoGCSelectPolicy && | 1343 if (UseAutoGCSelectPolicy && |
1265 #ifndef ZERO | 1382 #ifndef ZERO |
1266 #ifdef _LP64 | 1383 #ifdef _LP64 |
1267 // Check that UseCompressedOops can be set with the max heap size allocated | 1384 // Check that UseCompressedOops can be set with the max heap size allocated |
1268 // by ergonomics. | 1385 // by ergonomics. |
1269 if (MaxHeapSize <= max_heap_for_compressed_oops()) { | 1386 if (MaxHeapSize <= max_heap_for_compressed_oops()) { |
1270 #ifndef COMPILER1 | 1387 #if !defined(COMPILER1) || defined(TIERED) |
1271 if (FLAG_IS_DEFAULT(UseCompressedOops) && !UseG1GC) { | 1388 if (FLAG_IS_DEFAULT(UseCompressedOops) && !UseG1GC) { |
1272 FLAG_SET_ERGO(bool, UseCompressedOops, true); | 1389 FLAG_SET_ERGO(bool, UseCompressedOops, true); |
1273 } | 1390 } |
1274 #endif | 1391 #endif |
1275 #ifdef _WIN64 | 1392 #ifdef _WIN64 |
1344 FLAG_SET_DEFAULT(ParallelGCThreads, | 1461 FLAG_SET_DEFAULT(ParallelGCThreads, |
1345 Abstract_VM_Version::parallel_worker_threads()); | 1462 Abstract_VM_Version::parallel_worker_threads()); |
1346 } | 1463 } |
1347 no_shared_spaces(); | 1464 no_shared_spaces(); |
1348 | 1465 |
1349 // Set the maximum pause time goal to be a reasonable default. | |
1350 if (FLAG_IS_DEFAULT(MaxGCPauseMillis)) { | |
1351 FLAG_SET_DEFAULT(MaxGCPauseMillis, 200); | |
1352 } | |
1353 | |
1354 if (FLAG_IS_DEFAULT(MarkStackSize)) { | 1466 if (FLAG_IS_DEFAULT(MarkStackSize)) { |
1355 FLAG_SET_DEFAULT(MarkStackSize, 128 * TASKQUEUE_SIZE); | 1467 FLAG_SET_DEFAULT(MarkStackSize, 128 * TASKQUEUE_SIZE); |
1356 } | 1468 } |
1357 if (PrintGCDetails && Verbose) { | 1469 if (PrintGCDetails && Verbose) { |
1358 tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk", | 1470 tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk", |
1481 FLAG_SET_DEFAULT(DoEscapeAnalysis, true); | 1593 FLAG_SET_DEFAULT(DoEscapeAnalysis, true); |
1482 } | 1594 } |
1483 if (AggressiveOpts && FLAG_IS_DEFAULT(BiasedLockingStartupDelay)) { | 1595 if (AggressiveOpts && FLAG_IS_DEFAULT(BiasedLockingStartupDelay)) { |
1484 FLAG_SET_DEFAULT(BiasedLockingStartupDelay, 500); | 1596 FLAG_SET_DEFAULT(BiasedLockingStartupDelay, 500); |
1485 } | 1597 } |
1598 if (AggressiveOpts && FLAG_IS_DEFAULT(OptimizeStringConcat)) { | |
1599 FLAG_SET_DEFAULT(OptimizeStringConcat, true); | |
1600 } | |
1601 if (AggressiveOpts && FLAG_IS_DEFAULT(OptimizeFill)) { | |
1602 FLAG_SET_DEFAULT(OptimizeFill, true); | |
1603 } | |
1486 #endif | 1604 #endif |
1487 | 1605 |
1488 if (AggressiveOpts) { | 1606 if (AggressiveOpts) { |
1489 // Sample flag setting code | 1607 // Sample flag setting code |
1490 // if (FLAG_IS_DEFAULT(EliminateZeroing)) { | 1608 // if (FLAG_IS_DEFAULT(EliminateZeroing)) { |
1526 } | 1644 } |
1527 jio_fprintf(defaultStream::error_stream(), | 1645 jio_fprintf(defaultStream::error_stream(), |
1528 "%s of " UINTX_FORMAT " is invalid; must be between " UINTX_FORMAT | 1646 "%s of " UINTX_FORMAT " is invalid; must be between " UINTX_FORMAT |
1529 " and " UINTX_FORMAT "\n", | 1647 " and " UINTX_FORMAT "\n", |
1530 name, val, min, max); | 1648 name, val, min, max); |
1649 return false; | |
1650 } | |
1651 | |
1652 bool Arguments::verify_min_value(intx val, intx min, const char* name) { | |
1653 // Returns true if given value is greater than specified min threshold | |
1654 // false, otherwise. | |
1655 if (val >= min ) { | |
1656 return true; | |
1657 } | |
1658 jio_fprintf(defaultStream::error_stream(), | |
1659 "%s of " INTX_FORMAT " is invalid; must be greater than " INTX_FORMAT "\n", | |
1660 name, val, min); | |
1531 return false; | 1661 return false; |
1532 } | 1662 } |
1533 | 1663 |
1534 bool Arguments::verify_percentage(uintx value, const char* name) { | 1664 bool Arguments::verify_percentage(uintx value, const char* name) { |
1535 if (value <= 100) { | 1665 if (value <= 100) { |
1581 } | 1711 } |
1582 | 1712 |
1583 return status; | 1713 return status; |
1584 } | 1714 } |
1585 | 1715 |
1716 // Check stack pages settings | |
1717 bool Arguments::check_stack_pages() | |
1718 { | |
1719 bool status = true; | |
1720 status = status && verify_min_value(StackYellowPages, 1, "StackYellowPages"); | |
1721 status = status && verify_min_value(StackRedPages, 1, "StackRedPages"); | |
1722 // greater stack shadow pages can't generate instruction to bang stack | |
1723 status = status && verify_interval(StackShadowPages, 1, 50, "StackShadowPages"); | |
1724 return status; | |
1725 } | |
1726 | |
1586 // Check the consistency of vm_init_args | 1727 // Check the consistency of vm_init_args |
1587 bool Arguments::check_vm_args_consistency() { | 1728 bool Arguments::check_vm_args_consistency() { |
1588 // Method for adding checks for flag consistency. | 1729 // Method for adding checks for flag consistency. |
1589 // The intent is to warn the user of all possible conflicts, | 1730 // The intent is to warn the user of all possible conflicts, |
1590 // before returning an error. | 1731 // before returning an error. |
1623 "not " SIZE_FORMAT "\n", | 1764 "not " SIZE_FORMAT "\n", |
1624 TLABRefillWasteFraction); | 1765 TLABRefillWasteFraction); |
1625 status = false; | 1766 status = false; |
1626 } | 1767 } |
1627 | 1768 |
1628 status = status && verify_percentage(MaxLiveObjectEvacuationRatio, | |
1629 "MaxLiveObjectEvacuationRatio"); | |
1630 status = status && verify_percentage(AdaptiveSizePolicyWeight, | 1769 status = status && verify_percentage(AdaptiveSizePolicyWeight, |
1631 "AdaptiveSizePolicyWeight"); | 1770 "AdaptiveSizePolicyWeight"); |
1632 status = status && verify_percentage(AdaptivePermSizeWeight, "AdaptivePermSizeWeight"); | 1771 status = status && verify_percentage(AdaptivePermSizeWeight, "AdaptivePermSizeWeight"); |
1633 status = status && verify_percentage(ThresholdTolerance, "ThresholdTolerance"); | 1772 status = status && verify_percentage(ThresholdTolerance, "ThresholdTolerance"); |
1634 status = status && verify_percentage(MinHeapFreeRatio, "MinHeapFreeRatio"); | 1773 status = status && verify_percentage(MinHeapFreeRatio, "MinHeapFreeRatio"); |
1665 FLAG_SET_DEFAULT(UseGCOverheadLimit, false); | 1804 FLAG_SET_DEFAULT(UseGCOverheadLimit, false); |
1666 } | 1805 } |
1667 | 1806 |
1668 status = status && verify_percentage(GCHeapFreeLimit, "GCHeapFreeLimit"); | 1807 status = status && verify_percentage(GCHeapFreeLimit, "GCHeapFreeLimit"); |
1669 | 1808 |
1670 // Check user specified sharing option conflict with Parallel GC | 1809 // Check whether user-specified sharing option conflicts with GC or page size. |
1671 bool cannot_share = ((UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC || UseParNewGC || | 1810 // Both sharing and large pages are enabled by default on some platforms; |
1672 UseParallelGC || UseParallelOldGC || | 1811 // large pages override sharing only if explicitly set on the command line. |
1673 SOLARIS_ONLY(UseISM) NOT_SOLARIS(UseLargePages)); | 1812 const bool cannot_share = UseConcMarkSweepGC || CMSIncrementalMode || |
1674 | 1813 UseG1GC || UseParNewGC || UseParallelGC || UseParallelOldGC || |
1814 UseLargePages && FLAG_IS_CMDLINE(UseLargePages); | |
1675 if (cannot_share) { | 1815 if (cannot_share) { |
1676 // Either force sharing on by forcing the other options off, or | 1816 // Either force sharing on by forcing the other options off, or |
1677 // force sharing off. | 1817 // force sharing off. |
1678 if (DumpSharedSpaces || ForceSharedSpaces) { | 1818 if (DumpSharedSpaces || ForceSharedSpaces) { |
1679 jio_fprintf(defaultStream::error_stream(), | 1819 jio_fprintf(defaultStream::error_stream(), |
1680 "Reverting to Serial GC because of %s\n", | 1820 "Using Serial GC and default page size because of %s\n", |
1681 ForceSharedSpaces ? " -Xshare:on" : "-Xshare:dump"); | 1821 ForceSharedSpaces ? "-Xshare:on" : "-Xshare:dump"); |
1682 force_serial_gc(); | 1822 force_serial_gc(); |
1683 FLAG_SET_DEFAULT(SOLARIS_ONLY(UseISM) NOT_SOLARIS(UseLargePages), false); | 1823 FLAG_SET_DEFAULT(UseLargePages, false); |
1684 } else { | 1824 } else { |
1685 if (UseSharedSpaces && Verbose) { | 1825 if (UseSharedSpaces && Verbose) { |
1686 jio_fprintf(defaultStream::error_stream(), | 1826 jio_fprintf(defaultStream::error_stream(), |
1687 "Turning off use of shared archive because of " | 1827 "Turning off use of shared archive because of " |
1688 "choice of garbage collector or large pages\n"); | 1828 "choice of garbage collector or large pages\n"); |
1689 } | 1829 } |
1690 no_shared_spaces(); | 1830 no_shared_spaces(); |
1691 } | 1831 } |
1832 } else if (UseLargePages && (UseSharedSpaces || DumpSharedSpaces)) { | |
1833 FLAG_SET_DEFAULT(UseLargePages, false); | |
1692 } | 1834 } |
1693 | 1835 |
1694 status = status && check_gc_consistency(); | 1836 status = status && check_gc_consistency(); |
1837 status = status && check_stack_pages(); | |
1695 | 1838 |
1696 if (_has_alloc_profile) { | 1839 if (_has_alloc_profile) { |
1697 if (UseParallelGC || UseParallelOldGC) { | 1840 if (UseParallelGC || UseParallelOldGC) { |
1698 jio_fprintf(defaultStream::error_stream(), | 1841 jio_fprintf(defaultStream::error_stream(), |
1699 "error: invalid argument combination.\n" | 1842 "error: invalid argument combination.\n" |
1780 // Limit the lower bound of this flag to 1 as it is used in a division | 1923 // Limit the lower bound of this flag to 1 as it is used in a division |
1781 // expression. | 1924 // expression. |
1782 status = status && verify_interval(TLABWasteTargetPercent, | 1925 status = status && verify_interval(TLABWasteTargetPercent, |
1783 1, 100, "TLABWasteTargetPercent"); | 1926 1, 100, "TLABWasteTargetPercent"); |
1784 | 1927 |
1928 status = status && verify_object_alignment(); | |
1929 | |
1785 return status; | 1930 return status; |
1786 } | 1931 } |
1787 | 1932 |
1788 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore, | 1933 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore, |
1789 const char* option_type) { | 1934 const char* option_type) { |
1870 // Save default settings for some mode flags | 2015 // Save default settings for some mode flags |
1871 Arguments::_AlwaysCompileLoopMethods = AlwaysCompileLoopMethods; | 2016 Arguments::_AlwaysCompileLoopMethods = AlwaysCompileLoopMethods; |
1872 Arguments::_UseOnStackReplacement = UseOnStackReplacement; | 2017 Arguments::_UseOnStackReplacement = UseOnStackReplacement; |
1873 Arguments::_ClipInlining = ClipInlining; | 2018 Arguments::_ClipInlining = ClipInlining; |
1874 Arguments::_BackgroundCompilation = BackgroundCompilation; | 2019 Arguments::_BackgroundCompilation = BackgroundCompilation; |
1875 Arguments::_Tier2CompileThreshold = Tier2CompileThreshold; | |
1876 | 2020 |
1877 // Parse JAVA_TOOL_OPTIONS environment variable (if present) | 2021 // Parse JAVA_TOOL_OPTIONS environment variable (if present) |
1878 jint result = parse_java_tool_options_environment_variable(&scp, &scp_assembly_required); | 2022 jint result = parse_java_tool_options_environment_variable(&scp, &scp_assembly_required); |
1879 if (result != JNI_OK) { | 2023 if (result != JNI_OK) { |
1880 return result; | 2024 return result; |
2594 // when working with older JDKs. | 2738 // when working with older JDKs. |
2595 if (JDK_Version::current().compare_major(6) <= 0 && | 2739 if (JDK_Version::current().compare_major(6) <= 0 && |
2596 FLAG_IS_DEFAULT(UseVMInterruptibleIO)) { | 2740 FLAG_IS_DEFAULT(UseVMInterruptibleIO)) { |
2597 FLAG_SET_DEFAULT(UseVMInterruptibleIO, true); | 2741 FLAG_SET_DEFAULT(UseVMInterruptibleIO, true); |
2598 } | 2742 } |
2743 #ifdef LINUX | |
2744 if (JDK_Version::current().compare_major(6) <= 0 && | |
2745 FLAG_IS_DEFAULT(UseLinuxPosixThreadCPUClocks)) { | |
2746 FLAG_SET_DEFAULT(UseLinuxPosixThreadCPUClocks, false); | |
2747 } | |
2748 #endif // LINUX | |
2599 return JNI_OK; | 2749 return JNI_OK; |
2600 } | 2750 } |
2601 | 2751 |
2602 jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required) { | 2752 jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required) { |
2603 // This must be done after all -D arguments have been processed. | 2753 // This must be done after all -D arguments have been processed. |
2617 set_mode_flags(_int); | 2767 set_mode_flags(_int); |
2618 } | 2768 } |
2619 if (CompileThreshold == 0) { | 2769 if (CompileThreshold == 0) { |
2620 set_mode_flags(_int); | 2770 set_mode_flags(_int); |
2621 } | 2771 } |
2622 | |
2623 #ifdef TIERED | |
2624 // If we are using tiered compilation in the tiered vm then c1 will | |
2625 // do the profiling and we don't want to waste that time in the | |
2626 // interpreter. | |
2627 if (TieredCompilation) { | |
2628 ProfileInterpreter = false; | |
2629 } else { | |
2630 // Since we are running vanilla server we must adjust the compile threshold | |
2631 // unless the user has already adjusted it because the default threshold assumes | |
2632 // we will run tiered. | |
2633 | |
2634 if (FLAG_IS_DEFAULT(CompileThreshold)) { | |
2635 CompileThreshold = Tier2CompileThreshold; | |
2636 } | |
2637 } | |
2638 #endif // TIERED | |
2639 | 2772 |
2640 #ifndef COMPILER2 | 2773 #ifndef COMPILER2 |
2641 // Don't degrade server performance for footprint | 2774 // Don't degrade server performance for footprint |
2642 if (FLAG_IS_DEFAULT(UseLargePages) && | 2775 if (FLAG_IS_DEFAULT(UseLargePages) && |
2643 MaxHeapSize < LargePageHeapSizeThreshold) { | 2776 MaxHeapSize < LargePageHeapSizeThreshold) { |
2649 SOLARIS_ONLY(FLAG_SET_DEFAULT(UseISM, false)); | 2782 SOLARIS_ONLY(FLAG_SET_DEFAULT(UseISM, false)); |
2650 } | 2783 } |
2651 | 2784 |
2652 // Tiered compilation is undefined with C1. | 2785 // Tiered compilation is undefined with C1. |
2653 TieredCompilation = false; | 2786 TieredCompilation = false; |
2654 | |
2655 #else | 2787 #else |
2656 if (!FLAG_IS_DEFAULT(OptoLoopAlignment) && FLAG_IS_DEFAULT(MaxLoopPad)) { | 2788 if (!FLAG_IS_DEFAULT(OptoLoopAlignment) && FLAG_IS_DEFAULT(MaxLoopPad)) { |
2657 FLAG_SET_DEFAULT(MaxLoopPad, OptoLoopAlignment-1); | 2789 FLAG_SET_DEFAULT(MaxLoopPad, OptoLoopAlignment-1); |
2658 } | 2790 } |
2659 // Temporary disable bulk zeroing reduction with G1. See CR 6627983. | 2791 // Temporary disable bulk zeroing reduction with G1. See CR 6627983. |
2660 if (UseG1GC) { | 2792 if (UseG1GC) { |
2661 FLAG_SET_DEFAULT(ReduceBulkZeroing, false); | 2793 FLAG_SET_DEFAULT(ReduceBulkZeroing, false); |
2662 } | 2794 } |
2663 #endif | 2795 #endif |
2796 | |
2797 // If we are running in a headless jre, force java.awt.headless property | |
2798 // to be true unless the property has already been set. | |
2799 // Also allow the OS environment variable JAVA_AWT_HEADLESS to set headless state. | |
2800 if (os::is_headless_jre()) { | |
2801 const char* headless = Arguments::get_property("java.awt.headless"); | |
2802 if (headless == NULL) { | |
2803 char envbuffer[128]; | |
2804 if (!os::getenv("JAVA_AWT_HEADLESS", envbuffer, sizeof(envbuffer))) { | |
2805 if (!add_property("java.awt.headless=true")) { | |
2806 return JNI_ENOMEM; | |
2807 } | |
2808 } else { | |
2809 char buffer[256]; | |
2810 strcpy(buffer, "java.awt.headless="); | |
2811 strcat(buffer, envbuffer); | |
2812 if (!add_property(buffer)) { | |
2813 return JNI_ENOMEM; | |
2814 } | |
2815 } | |
2816 } | |
2817 } | |
2664 | 2818 |
2665 if (!check_vm_args_consistency()) { | 2819 if (!check_vm_args_consistency()) { |
2666 return JNI_ERR; | 2820 return JNI_ERR; |
2667 } | 2821 } |
2668 | 2822 |
2749 return(parse_each_vm_init_arg(&vm_args, scp_p, scp_assembly_required_p, ENVIRON_VAR)); | 2903 return(parse_each_vm_init_arg(&vm_args, scp_p, scp_assembly_required_p, ENVIRON_VAR)); |
2750 } | 2904 } |
2751 return JNI_OK; | 2905 return JNI_OK; |
2752 } | 2906 } |
2753 | 2907 |
2908 | |
2754 // Parse entry point called from JNI_CreateJavaVM | 2909 // Parse entry point called from JNI_CreateJavaVM |
2755 | 2910 |
2756 jint Arguments::parse(const JavaVMInitArgs* args) { | 2911 jint Arguments::parse(const JavaVMInitArgs* args) { |
2757 | 2912 |
2758 // Sharing support | 2913 // Sharing support |
2803 } | 2958 } |
2804 if (match_option(option, "-XX:+PrintFlagsInitial", &tail)) { | 2959 if (match_option(option, "-XX:+PrintFlagsInitial", &tail)) { |
2805 CommandLineFlags::printFlags(); | 2960 CommandLineFlags::printFlags(); |
2806 vm_exit(0); | 2961 vm_exit(0); |
2807 } | 2962 } |
2963 | |
2964 #ifndef PRODUCT | |
2965 if (match_option(option, "-XX:+PrintFlagsWithComments", &tail)) { | |
2966 CommandLineFlags::printFlags(true); | |
2967 vm_exit(0); | |
2968 } | |
2969 #endif | |
2808 } | 2970 } |
2809 | 2971 |
2810 if (IgnoreUnrecognizedVMOptions) { | 2972 if (IgnoreUnrecognizedVMOptions) { |
2811 // uncast const to modify the flag args->ignoreUnrecognized | 2973 // uncast const to modify the flag args->ignoreUnrecognized |
2812 *(jboolean*)(&args->ignoreUnrecognized) = true; | 2974 *(jboolean*)(&args->ignoreUnrecognized) = true; |
2884 if (PrintGCDetails) { | 3046 if (PrintGCDetails) { |
2885 // Turn on -verbose:gc options as well | 3047 // Turn on -verbose:gc options as well |
2886 PrintGC = true; | 3048 PrintGC = true; |
2887 } | 3049 } |
2888 | 3050 |
2889 #if defined(_LP64) && defined(COMPILER1) | 3051 // Set object alignment values. |
2890 UseCompressedOops = false; | 3052 set_object_alignment(); |
2891 #endif | |
2892 | 3053 |
2893 #ifdef SERIALGC | 3054 #ifdef SERIALGC |
2894 force_serial_gc(); | 3055 force_serial_gc(); |
2895 #endif // SERIALGC | 3056 #endif // SERIALGC |
2896 #ifdef KERNEL | 3057 #ifdef KERNEL |
2899 | 3060 |
2900 // Set flags based on ergonomics. | 3061 // Set flags based on ergonomics. |
2901 set_ergonomics_flags(); | 3062 set_ergonomics_flags(); |
2902 | 3063 |
2903 #ifdef _LP64 | 3064 #ifdef _LP64 |
2904 // XXX JSR 292 currently does not support compressed oops. | 3065 if (UseCompressedOops) { |
2905 if (EnableMethodHandles && UseCompressedOops) { | 3066 check_compressed_oops_compat(); |
2906 if (FLAG_IS_DEFAULT(UseCompressedOops) || FLAG_IS_ERGO(UseCompressedOops)) { | 3067 } |
2907 UseCompressedOops = false; | 3068 #endif |
2908 } | |
2909 } | |
2910 #endif // _LP64 | |
2911 | |
2912 // MethodHandles code does not support TaggedStackInterpreter. | |
2913 if (EnableMethodHandles && TaggedStackInterpreter) { | |
2914 warning("TaggedStackInterpreter is not supported by MethodHandles code. Disabling TaggedStackInterpreter."); | |
2915 TaggedStackInterpreter = false; | |
2916 } | |
2917 | 3069 |
2918 // Check the GC selections again. | 3070 // Check the GC selections again. |
2919 if (!check_gc_consistency()) { | 3071 if (!check_gc_consistency()) { |
2920 return JNI_EINVAL; | 3072 return JNI_EINVAL; |
3073 } | |
3074 | |
3075 if (TieredCompilation) { | |
3076 set_tiered_flags(); | |
3077 } else { | |
3078 // Check if the policy is valid. Policies 0 and 1 are valid for non-tiered setup. | |
3079 if (CompilationPolicyChoice >= 2) { | |
3080 vm_exit_during_initialization( | |
3081 "Incompatible compilation policy selected", NULL); | |
3082 } | |
2921 } | 3083 } |
2922 | 3084 |
2923 #ifndef KERNEL | 3085 #ifndef KERNEL |
2924 if (UseConcMarkSweepGC) { | 3086 if (UseConcMarkSweepGC) { |
2925 // Set flags for CMS and ParNew. Check UseConcMarkSweep first | 3087 // Set flags for CMS and ParNew. Check UseConcMarkSweep first |
2955 FLAG_SET_DEFAULT(ProfileInterpreter, false); | 3117 FLAG_SET_DEFAULT(ProfileInterpreter, false); |
2956 FLAG_SET_DEFAULT(UseBiasedLocking, false); | 3118 FLAG_SET_DEFAULT(UseBiasedLocking, false); |
2957 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedOops, false)); | 3119 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedOops, false)); |
2958 #endif // CC_INTERP | 3120 #endif // CC_INTERP |
2959 | 3121 |
2960 #ifdef ZERO | |
2961 // Clear flags not supported by Zero | |
2962 FLAG_SET_DEFAULT(TaggedStackInterpreter, false); | |
2963 #endif // ZERO | |
2964 | |
2965 #ifdef COMPILER2 | 3122 #ifdef COMPILER2 |
2966 if (!UseBiasedLocking || EmitSync != 0) { | 3123 if (!UseBiasedLocking || EmitSync != 0) { |
2967 UseOptoBiasInlining = false; | 3124 UseOptoBiasInlining = false; |
2968 } | 3125 } |
2969 #endif | 3126 #endif |
2984 | 3141 |
2985 if (PrintCommandLineFlags) { | 3142 if (PrintCommandLineFlags) { |
2986 CommandLineFlags::printSetFlags(); | 3143 CommandLineFlags::printSetFlags(); |
2987 } | 3144 } |
2988 | 3145 |
2989 if (PrintFlagsFinal) { | 3146 // Apply CPU specific policy for the BiasedLocking |
2990 CommandLineFlags::printFlags(); | 3147 if (UseBiasedLocking) { |
3148 if (!VM_Version::use_biased_locking() && | |
3149 !(FLAG_IS_CMDLINE(UseBiasedLocking))) { | |
3150 UseBiasedLocking = false; | |
3151 } | |
2991 } | 3152 } |
2992 | 3153 |
2993 return JNI_OK; | 3154 return JNI_OK; |
2994 } | 3155 } |
2995 | 3156 |