equal
deleted
inserted
replaced
28 #include "classfile/javaAssertions.hpp" |
28 #include "classfile/javaAssertions.hpp" |
29 #include "classfile/moduleEntry.hpp" |
29 #include "classfile/moduleEntry.hpp" |
30 #include "classfile/stringTable.hpp" |
30 #include "classfile/stringTable.hpp" |
31 #include "classfile/symbolTable.hpp" |
31 #include "classfile/symbolTable.hpp" |
32 #include "gc/shared/gcArguments.hpp" |
32 #include "gc/shared/gcArguments.hpp" |
|
33 #include "gc/shared/gcConfig.hpp" |
33 #include "gc/shared/genCollectedHeap.hpp" |
34 #include "gc/shared/genCollectedHeap.hpp" |
34 #include "gc/shared/referenceProcessor.hpp" |
35 #include "gc/shared/referenceProcessor.hpp" |
35 #include "gc/shared/taskqueue.hpp" |
36 #include "gc/shared/taskqueue.hpp" |
36 #include "logging/log.hpp" |
37 #include "logging/log.hpp" |
37 #include "logging/logConfiguration.hpp" |
38 #include "logging/logConfiguration.hpp" |
1747 void Arguments::set_conservative_max_heap_alignment() { |
1748 void Arguments::set_conservative_max_heap_alignment() { |
1748 // The conservative maximum required alignment for the heap is the maximum of |
1749 // The conservative maximum required alignment for the heap is the maximum of |
1749 // the alignments imposed by several sources: any requirements from the heap |
1750 // the alignments imposed by several sources: any requirements from the heap |
1750 // itself, the collector policy and the maximum page size we may run the VM |
1751 // itself, the collector policy and the maximum page size we may run the VM |
1751 // with. |
1752 // with. |
1752 size_t heap_alignment = GCArguments::arguments()->conservative_max_heap_alignment(); |
1753 size_t heap_alignment = GCConfig::arguments()->conservative_max_heap_alignment(); |
1753 _conservative_max_heap_alignment = MAX4(heap_alignment, |
1754 _conservative_max_heap_alignment = MAX4(heap_alignment, |
1754 (size_t)os::vm_allocation_granularity(), |
1755 (size_t)os::vm_allocation_granularity(), |
1755 os::max_page_size(), |
1756 os::max_page_size(), |
1756 CollectorPolicy::compute_heap_alignment()); |
1757 CollectorPolicy::compute_heap_alignment()); |
1757 } |
1758 } |
1813 if (!compilation_mode_selected()) { |
1814 if (!compilation_mode_selected()) { |
1814 select_compilation_mode_ergonomically(); |
1815 select_compilation_mode_ergonomically(); |
1815 } |
1816 } |
1816 #endif |
1817 #endif |
1817 |
1818 |
1818 jint gc_result = GCArguments::initialize(); |
1819 GCConfig::initialize(); |
1819 if (gc_result != JNI_OK) { |
|
1820 return gc_result; |
|
1821 } |
|
1822 |
1820 |
1823 #if COMPILER2_OR_JVMCI |
1821 #if COMPILER2_OR_JVMCI |
1824 // Shared spaces work fine with other GCs but causes bytecode rewriting |
1822 // Shared spaces work fine with other GCs but causes bytecode rewriting |
1825 // to be disabled, which hurts interpreter performance and decreases |
1823 // to be disabled, which hurts interpreter performance and decreases |
1826 // server performance. When -server is specified, keep the default off |
1824 // server performance. When -server is specified, keep the default off |
2174 bool Arguments::check_jvmci_args_consistency() { |
2172 bool Arguments::check_jvmci_args_consistency() { |
2175 return JVMCIGlobals::check_jvmci_flags_are_consistent(); |
2173 return JVMCIGlobals::check_jvmci_flags_are_consistent(); |
2176 } |
2174 } |
2177 #endif //INCLUDE_JVMCI |
2175 #endif //INCLUDE_JVMCI |
2178 |
2176 |
2179 // Check consistency of GC selection |
|
2180 bool Arguments::check_gc_consistency() { |
|
2181 // Ensure that the user has not selected conflicting sets |
|
2182 // of collectors. |
|
2183 uint i = 0; |
|
2184 if (UseSerialGC) i++; |
|
2185 if (UseConcMarkSweepGC) i++; |
|
2186 if (UseParallelGC || UseParallelOldGC) i++; |
|
2187 if (UseG1GC) i++; |
|
2188 if (i > 1) { |
|
2189 jio_fprintf(defaultStream::error_stream(), |
|
2190 "Conflicting collector combinations in option list; " |
|
2191 "please refer to the release notes for the combinations " |
|
2192 "allowed\n"); |
|
2193 return false; |
|
2194 } |
|
2195 |
|
2196 return true; |
|
2197 } |
|
2198 |
|
2199 // Check the consistency of vm_init_args |
2177 // Check the consistency of vm_init_args |
2200 bool Arguments::check_vm_args_consistency() { |
2178 bool Arguments::check_vm_args_consistency() { |
2201 // Method for adding checks for flag consistency. |
2179 // Method for adding checks for flag consistency. |
2202 // The intent is to warn the user of all possible conflicts, |
2180 // The intent is to warn the user of all possible conflicts, |
2203 // before returning an error. |
2181 // before returning an error. |
2222 |
2200 |
2223 if (GCTimeLimit == 100) { |
2201 if (GCTimeLimit == 100) { |
2224 // Turn off gc-overhead-limit-exceeded checks |
2202 // Turn off gc-overhead-limit-exceeded checks |
2225 FLAG_SET_DEFAULT(UseGCOverheadLimit, false); |
2203 FLAG_SET_DEFAULT(UseGCOverheadLimit, false); |
2226 } |
2204 } |
2227 |
|
2228 status = status && check_gc_consistency(); |
|
2229 |
2205 |
2230 // CMS space iteration, which FLSVerifyAllHeapreferences entails, |
2206 // CMS space iteration, which FLSVerifyAllHeapreferences entails, |
2231 // insists that we hold the requisite locks so that the iteration is |
2207 // insists that we hold the requisite locks so that the iteration is |
2232 // MT-safe. For the verification at start-up and shut-down, we don't |
2208 // MT-safe. For the verification at start-up and shut-down, we don't |
2233 // yet have a good way of acquiring and releasing these locks, |
2209 // yet have a good way of acquiring and releasing these locks, |
4239 set_jvmci_specific_flags(); |
4215 set_jvmci_specific_flags(); |
4240 #endif |
4216 #endif |
4241 |
4217 |
4242 set_shared_spaces_flags(); |
4218 set_shared_spaces_flags(); |
4243 |
4219 |
4244 // Check the GC selections again. |
|
4245 if (!check_gc_consistency()) { |
|
4246 return JNI_EINVAL; |
|
4247 } |
|
4248 |
|
4249 if (TieredCompilation) { |
4220 if (TieredCompilation) { |
4250 set_tiered_flags(); |
4221 set_tiered_flags(); |
4251 } else { |
4222 } else { |
4252 int max_compilation_policy_choice = 1; |
4223 int max_compilation_policy_choice = 1; |
4253 #ifdef COMPILER2 |
4224 #ifdef COMPILER2 |
4276 #endif |
4247 #endif |
4277 |
4248 |
4278 // Set heap size based on available physical memory |
4249 // Set heap size based on available physical memory |
4279 set_heap_size(); |
4250 set_heap_size(); |
4280 |
4251 |
4281 GCArguments::arguments()->initialize_flags(); |
4252 GCConfig::arguments()->initialize(); |
4282 |
4253 |
4283 // Initialize Metaspace flags and alignments |
4254 // Initialize Metaspace flags and alignments |
4284 Metaspace::ergo_initialize(); |
4255 Metaspace::ergo_initialize(); |
4285 |
4256 |
4286 // Set bytecode rewriting flags |
4257 // Set bytecode rewriting flags |