Mercurial > hg > graal-compiler
comparison src/share/vm/runtime/arguments.cpp @ 2044:06f017f7daa7
Merge.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Fri, 07 Jan 2011 18:18:08 +0100 |
parents | 2d26b0046e0d ac637b7220d1 |
children | 91fe28b03d6a |
comparison
equal
deleted
inserted
replaced
1942:00bc9eaf0e24 | 2044:06f017f7daa7 |
---|---|
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 * | 22 * |
23 */ | 23 */ |
24 | 24 |
25 #include "incls/_precompiled.incl" | 25 #include "precompiled.hpp" |
26 #include "incls/_arguments.cpp.incl" | 26 #include "classfile/javaAssertions.hpp" |
27 #include "compiler/compilerOracle.hpp" | |
28 #include "memory/allocation.inline.hpp" | |
29 #include "memory/cardTableRS.hpp" | |
30 #include "memory/referenceProcessor.hpp" | |
31 #include "memory/universe.inline.hpp" | |
32 #include "oops/oop.inline.hpp" | |
33 #include "prims/jvmtiExport.hpp" | |
34 #include "runtime/arguments.hpp" | |
35 #include "runtime/globals_extension.hpp" | |
36 #include "runtime/java.hpp" | |
37 #include "services/management.hpp" | |
38 #include "utilities/defaultStream.hpp" | |
39 #include "utilities/taskqueue.hpp" | |
40 #ifdef TARGET_ARCH_x86 | |
41 # include "vm_version_x86.hpp" | |
42 #endif | |
43 #ifdef TARGET_ARCH_sparc | |
44 # include "vm_version_sparc.hpp" | |
45 #endif | |
46 #ifdef TARGET_ARCH_zero | |
47 # include "vm_version_zero.hpp" | |
48 #endif | |
49 #ifdef TARGET_OS_FAMILY_linux | |
50 # include "os_linux.inline.hpp" | |
51 #endif | |
52 #ifdef TARGET_OS_FAMILY_solaris | |
53 # include "os_solaris.inline.hpp" | |
54 #endif | |
55 #ifdef TARGET_OS_FAMILY_windows | |
56 # include "os_windows.inline.hpp" | |
57 #endif | |
58 #ifndef SERIALGC | |
59 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp" | |
60 #endif | |
27 | 61 |
28 #define DEFAULT_VENDOR_URL_BUG "http://java.sun.com/webapps/bugreport/crash.jsp" | 62 #define DEFAULT_VENDOR_URL_BUG "http://java.sun.com/webapps/bugreport/crash.jsp" |
29 #define DEFAULT_JAVA_LAUNCHER "generic" | 63 #define DEFAULT_JAVA_LAUNCHER "generic" |
30 | 64 |
31 char** Arguments::_jvm_flags_array = NULL; | 65 char** Arguments::_jvm_flags_array = NULL; |
116 } | 150 } |
117 | 151 |
118 // Initialize system properties key and value. | 152 // Initialize system properties key and value. |
119 void Arguments::init_system_properties() { | 153 void Arguments::init_system_properties() { |
120 | 154 |
121 PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.version", "1.0", false)); | |
122 PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.name", | 155 PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.name", |
123 "Java Virtual Machine Specification", false)); | 156 "Java Virtual Machine Specification", false)); |
124 PropertyList_add(&_system_properties, new SystemProperty("java.vm.version", VM_Version::vm_release(), false)); | 157 PropertyList_add(&_system_properties, new SystemProperty("java.vm.version", VM_Version::vm_release(), false)); |
125 PropertyList_add(&_system_properties, new SystemProperty("java.vm.name", VM_Version::vm_name(), false)); | 158 PropertyList_add(&_system_properties, new SystemProperty("java.vm.name", VM_Version::vm_name(), false)); |
126 PropertyList_add(&_system_properties, new SystemProperty("java.vm.info", VM_Version::vm_info_string(), true)); | 159 PropertyList_add(&_system_properties, new SystemProperty("java.vm.info", VM_Version::vm_info_string(), true)); |
151 } | 184 } |
152 | 185 |
153 | 186 |
154 // Update/Initialize System properties after JDK version number is known | 187 // Update/Initialize System properties after JDK version number is known |
155 void Arguments::init_version_specific_system_properties() { | 188 void Arguments::init_version_specific_system_properties() { |
156 PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.vendor", | 189 enum { bufsz = 16 }; |
157 JDK_Version::is_gte_jdk17x_version() ? "Oracle Corporation" : "Sun Microsystems Inc.", false)); | 190 char buffer[bufsz]; |
158 PropertyList_add(&_system_properties, new SystemProperty("java.vm.vendor", VM_Version::vm_vendor(), false)); | 191 const char* spec_vendor = "Sun Microsystems Inc."; |
192 uint32_t spec_version = 0; | |
193 | |
194 if (JDK_Version::is_gte_jdk17x_version()) { | |
195 spec_vendor = "Oracle Corporation"; | |
196 spec_version = JDK_Version::current().major_version(); | |
197 } | |
198 jio_snprintf(buffer, bufsz, "1." UINT32_FORMAT, spec_version); | |
199 | |
200 PropertyList_add(&_system_properties, | |
201 new SystemProperty("java.vm.specification.vendor", spec_vendor, false)); | |
202 PropertyList_add(&_system_properties, | |
203 new SystemProperty("java.vm.specification.version", buffer, false)); | |
204 PropertyList_add(&_system_properties, | |
205 new SystemProperty("java.vm.vendor", VM_Version::vm_vendor(), false)); | |
159 } | 206 } |
160 | 207 |
161 /** | 208 /** |
162 * Provide a slightly more user-friendly way of eliminating -XX flags. | 209 * Provide a slightly more user-friendly way of eliminating -XX flags. |
163 * When a flag is eliminated, it can be added to this list in order to | 210 * When a flag is eliminated, it can be added to this list in order to |
964 } | 1011 } |
965 | 1012 |
966 void Arguments::check_compressed_oops_compat() { | 1013 void Arguments::check_compressed_oops_compat() { |
967 #ifdef _LP64 | 1014 #ifdef _LP64 |
968 assert(UseCompressedOops, "Precondition"); | 1015 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 | 1016 // Is it on by default or set on ergonomically |
974 bool is_on_by_default = FLAG_IS_DEFAULT(UseCompressedOops) || FLAG_IS_ERGO(UseCompressedOops); | 1017 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 | 1018 |
987 // If dumping an archive or forcing its use, disable compressed oops if possible | 1019 // If dumping an archive or forcing its use, disable compressed oops if possible |
988 if (DumpSharedSpaces || RequireSharedSpaces) { | 1020 if (DumpSharedSpaces || RequireSharedSpaces) { |
989 if (is_on_by_default) { | 1021 if (is_on_by_default) { |
990 FLAG_SET_DEFAULT(UseCompressedOops, false); | 1022 FLAG_SET_DEFAULT(UseCompressedOops, false); |
995 } | 1027 } |
996 } else if (UseSharedSpaces) { | 1028 } else if (UseSharedSpaces) { |
997 // UseSharedSpaces is on by default. With compressed oops, we turn it off. | 1029 // UseSharedSpaces is on by default. With compressed oops, we turn it off. |
998 FLAG_SET_DEFAULT(UseSharedSpaces, false); | 1030 FLAG_SET_DEFAULT(UseSharedSpaces, false); |
999 } | 1031 } |
1000 | 1032 #endif |
1001 # endif // defined(COMPILER1) && !defined(TIERED) | |
1002 #endif // _LP64 | |
1003 } | 1033 } |
1004 | 1034 |
1005 void Arguments::set_tiered_flags() { | 1035 void Arguments::set_tiered_flags() { |
1006 if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) { | 1036 if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) { |
1007 FLAG_SET_DEFAULT(CompilationPolicyChoice, 2); | 1037 FLAG_SET_DEFAULT(CompilationPolicyChoice, 2); |
1332 } | 1362 } |
1333 return true; | 1363 return true; |
1334 } | 1364 } |
1335 | 1365 |
1336 inline uintx max_heap_for_compressed_oops() { | 1366 inline uintx max_heap_for_compressed_oops() { |
1337 // Heap should be above HeapBaseMinAddress to get zero based compressed oops. | 1367 // Avoid sign flip. |
1338 LP64_ONLY(return OopEncodingHeapMax - MaxPermSize - os::vm_page_size() - HeapBaseMinAddress); | 1368 if (OopEncodingHeapMax < MaxPermSize + os::vm_page_size()) { |
1369 return 0; | |
1370 } | |
1371 LP64_ONLY(return OopEncodingHeapMax - MaxPermSize - os::vm_page_size()); | |
1339 NOT_LP64(ShouldNotReachHere(); return 0); | 1372 NOT_LP64(ShouldNotReachHere(); return 0); |
1340 } | 1373 } |
1341 | 1374 |
1342 bool Arguments::should_auto_select_low_pause_collector() { | 1375 bool Arguments::should_auto_select_low_pause_collector() { |
1343 if (UseAutoGCSelectPolicy && | 1376 if (UseAutoGCSelectPolicy && |
1511 // Limit the heap size to ErgoHeapSizeLimit | 1544 // Limit the heap size to ErgoHeapSizeLimit |
1512 reasonable_max = MIN2(reasonable_max, (julong)ErgoHeapSizeLimit); | 1545 reasonable_max = MIN2(reasonable_max, (julong)ErgoHeapSizeLimit); |
1513 } | 1546 } |
1514 if (UseCompressedOops) { | 1547 if (UseCompressedOops) { |
1515 // Limit the heap size to the maximum possible when using compressed oops | 1548 // Limit the heap size to the maximum possible when using compressed oops |
1516 reasonable_max = MIN2(reasonable_max, (julong)max_heap_for_compressed_oops()); | 1549 julong max_coop_heap = (julong)max_heap_for_compressed_oops(); |
1550 if (HeapBaseMinAddress + MaxHeapSize < max_coop_heap) { | |
1551 // Heap should be above HeapBaseMinAddress to get zero based compressed oops | |
1552 // but it should be not less than default MaxHeapSize. | |
1553 max_coop_heap -= HeapBaseMinAddress; | |
1554 } | |
1555 reasonable_max = MIN2(reasonable_max, max_coop_heap); | |
1517 } | 1556 } |
1518 reasonable_max = os::allocatable_physical_memory(reasonable_max); | 1557 reasonable_max = os::allocatable_physical_memory(reasonable_max); |
1519 | 1558 |
1520 if (!FLAG_IS_DEFAULT(InitialHeapSize)) { | 1559 if (!FLAG_IS_DEFAULT(InitialHeapSize)) { |
1521 // An initial heap size was specified on the command line, | 1560 // An initial heap size was specified on the command line, |
3059 #endif // KERNEL | 3098 #endif // KERNEL |
3060 | 3099 |
3061 // Set flags based on ergonomics. | 3100 // Set flags based on ergonomics. |
3062 set_ergonomics_flags(); | 3101 set_ergonomics_flags(); |
3063 | 3102 |
3064 #ifdef _LP64 | |
3065 if (UseCompressedOops) { | 3103 if (UseCompressedOops) { |
3066 check_compressed_oops_compat(); | 3104 check_compressed_oops_compat(); |
3067 } | 3105 } |
3068 #endif | |
3069 | 3106 |
3070 // Check the GC selections again. | 3107 // Check the GC selections again. |
3071 if (!check_gc_consistency()) { | 3108 if (!check_gc_consistency()) { |
3072 return JNI_EINVAL; | 3109 return JNI_EINVAL; |
3073 } | 3110 } |