1817 } 1818 #else 1819 UNSUPPORTED_OPTION(UseG1GC); 1820 UNSUPPORTED_OPTION(UseParallelGC); 1821 UNSUPPORTED_OPTION(UseParallelOldGC); 1822 UNSUPPORTED_OPTION(UseConcMarkSweepGC); 1823 UNSUPPORTED_OPTION(UseParNewGC); 1824 FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true); 1825 #endif // INCLUDE_ALL_GCS 1826 } 1827 1828 void Arguments::select_gc() { 1829 if (!gc_selected()) { 1830 select_gc_ergonomically(); 1831 if (!gc_selected()) { 1832 vm_exit_during_initialization("Garbage collector not selected (default collector explicitly disabled)", NULL); 1833 } 1834 } 1835 } 1836 1837 void Arguments::set_ergonomics_flags() { 1838 select_gc(); 1839 1840 #if defined(COMPILER2) || INCLUDE_JVMCI 1841 // Shared spaces work fine with other GCs but causes bytecode rewriting 1842 // to be disabled, which hurts interpreter performance and decreases 1843 // server performance. When -server is specified, keep the default off 1844 // unless it is asked for. Future work: either add bytecode rewriting 1845 // at link time, or rewrite bytecodes in non-shared methods. 1846 if (!DumpSharedSpaces && !RequireSharedSpaces && 1847 (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) { 1848 no_shared_spaces("COMPILER2 default: -Xshare:auto | off, have to manually setup to on."); 1849 } 1850 #endif 1851 1852 set_conservative_max_heap_alignment(); 1853 1854 #ifndef ZERO 1855 #ifdef _LP64 1856 set_use_compressed_oops(); 2394 2395 if (PrintNMTStatistics) { 2396 #if INCLUDE_NMT 2397 if (MemTracker::tracking_level() == NMT_off) { 2398 #endif // INCLUDE_NMT 2399 warning("PrintNMTStatistics is disabled, because native memory tracking is not enabled"); 2400 PrintNMTStatistics = false; 2401 #if INCLUDE_NMT 2402 } 2403 #endif 2404 } 2405 #if INCLUDE_JVMCI 2406 2407 status = status && check_jvmci_args_consistency(); 2408 2409 if (EnableJVMCI) { 2410 if (!ScavengeRootsInCode) { 2411 warning("forcing ScavengeRootsInCode non-zero because JVMCI is enabled"); 2412 ScavengeRootsInCode = 1; 2413 } 2414 if (FLAG_IS_DEFAULT(TypeProfileLevel)) { 2415 TypeProfileLevel = 0; 2416 } 2417 if (UseJVMCICompiler) { 2418 if (FLAG_IS_DEFAULT(TypeProfileWidth)) { 2419 TypeProfileWidth = 8; 2420 } 2421 } 2422 } 2423 #endif 2424 2425 // Check lower bounds of the code cache 2426 // Template Interpreter code is approximately 3X larger in debug builds. 2427 uint min_code_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3); 2428 if (InitialCodeCacheSize < (uintx)os::vm_page_size()) { 2429 jio_fprintf(defaultStream::error_stream(), 2430 "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K, 2431 os::vm_page_size()/K); 2432 status = false; 2433 } else if (ReservedCodeCacheSize < InitialCodeCacheSize) { 2434 jio_fprintf(defaultStream::error_stream(), 2435 "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n", 2436 ReservedCodeCacheSize/K, InitialCodeCacheSize/K); 2437 status = false; 2438 } else if (ReservedCodeCacheSize < min_code_cache_size) { 2439 jio_fprintf(defaultStream::error_stream(), 2440 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K, 2441 min_code_cache_size/K); 4327 if (DumpSharedSpaces || RequireSharedSpaces) { 4328 jio_fprintf(defaultStream::error_stream(), 4329 "Shared spaces are not supported in this VM\n"); 4330 return JNI_ERR; 4331 } 4332 if ((UseSharedSpaces && FLAG_IS_CMDLINE(UseSharedSpaces)) || PrintSharedSpaces) { 4333 warning("Shared spaces are not supported in this VM"); 4334 FLAG_SET_DEFAULT(UseSharedSpaces, false); 4335 FLAG_SET_DEFAULT(PrintSharedSpaces, false); 4336 } 4337 no_shared_spaces("CDS Disabled"); 4338 #endif // INCLUDE_CDS 4339 4340 return JNI_OK; 4341 } 4342 4343 jint Arguments::apply_ergo() { 4344 4345 // Set flags based on ergonomics. 4346 set_ergonomics_flags(); 4347 4348 set_shared_spaces_flags(); 4349 4350 // Check the GC selections again. 4351 if (!check_gc_consistency()) { 4352 return JNI_EINVAL; 4353 } 4354 4355 if (TieredCompilation) { 4356 set_tiered_flags(); 4357 } else { 4358 int max_compilation_policy_choice = 1; 4359 #ifdef COMPILER2 4360 max_compilation_policy_choice = 2; 4361 #endif 4362 // Check if the policy is valid. 4363 if (CompilationPolicyChoice >= max_compilation_policy_choice) { 4364 vm_exit_during_initialization( 4365 "Incompatible compilation policy selected", NULL); 4366 } | 1817 } 1818 #else 1819 UNSUPPORTED_OPTION(UseG1GC); 1820 UNSUPPORTED_OPTION(UseParallelGC); 1821 UNSUPPORTED_OPTION(UseParallelOldGC); 1822 UNSUPPORTED_OPTION(UseConcMarkSweepGC); 1823 UNSUPPORTED_OPTION(UseParNewGC); 1824 FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true); 1825 #endif // INCLUDE_ALL_GCS 1826 } 1827 1828 void Arguments::select_gc() { 1829 if (!gc_selected()) { 1830 select_gc_ergonomically(); 1831 if (!gc_selected()) { 1832 vm_exit_during_initialization("Garbage collector not selected (default collector explicitly disabled)", NULL); 1833 } 1834 } 1835 } 1836 1837 #if INCLUDE_JVMCI 1838 void Arguments::set_jvmci_specific_flags() { 1839 if (UseJVMCICompiler) { 1840 if (FLAG_IS_DEFAULT(TypeProfileWidth)) { 1841 FLAG_SET_DEFAULT(TypeProfileWidth, 8); 1842 } 1843 if (FLAG_IS_DEFAULT(OnStackReplacePercentage)) { 1844 FLAG_SET_DEFAULT(OnStackReplacePercentage, 933); 1845 } 1846 if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) { 1847 FLAG_SET_DEFAULT(ReservedCodeCacheSize, 64*M); 1848 } 1849 if (FLAG_IS_DEFAULT(InitialCodeCacheSize)) { 1850 FLAG_SET_DEFAULT(InitialCodeCacheSize, 16*M); 1851 } 1852 if (FLAG_IS_DEFAULT(MetaspaceSize)) { 1853 FLAG_SET_DEFAULT(MetaspaceSize, 12*M); 1854 } 1855 if (FLAG_IS_DEFAULT(NewSizeThreadIncrease)) { 1856 FLAG_SET_DEFAULT(NewSizeThreadIncrease, 4*K); 1857 } 1858 if (FLAG_IS_DEFAULT(TypeProfileLevel)) { 1859 FLAG_SET_DEFAULT(TypeProfileLevel, 0); 1860 } 1861 } 1862 } 1863 #endif 1864 1865 void Arguments::set_ergonomics_flags() { 1866 select_gc(); 1867 1868 #if defined(COMPILER2) || INCLUDE_JVMCI 1869 // Shared spaces work fine with other GCs but causes bytecode rewriting 1870 // to be disabled, which hurts interpreter performance and decreases 1871 // server performance. When -server is specified, keep the default off 1872 // unless it is asked for. Future work: either add bytecode rewriting 1873 // at link time, or rewrite bytecodes in non-shared methods. 1874 if (!DumpSharedSpaces && !RequireSharedSpaces && 1875 (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) { 1876 no_shared_spaces("COMPILER2 default: -Xshare:auto | off, have to manually setup to on."); 1877 } 1878 #endif 1879 1880 set_conservative_max_heap_alignment(); 1881 1882 #ifndef ZERO 1883 #ifdef _LP64 1884 set_use_compressed_oops(); 2422 2423 if (PrintNMTStatistics) { 2424 #if INCLUDE_NMT 2425 if (MemTracker::tracking_level() == NMT_off) { 2426 #endif // INCLUDE_NMT 2427 warning("PrintNMTStatistics is disabled, because native memory tracking is not enabled"); 2428 PrintNMTStatistics = false; 2429 #if INCLUDE_NMT 2430 } 2431 #endif 2432 } 2433 #if INCLUDE_JVMCI 2434 2435 status = status && check_jvmci_args_consistency(); 2436 2437 if (EnableJVMCI) { 2438 if (!ScavengeRootsInCode) { 2439 warning("forcing ScavengeRootsInCode non-zero because JVMCI is enabled"); 2440 ScavengeRootsInCode = 1; 2441 } 2442 } 2443 #endif 2444 2445 // Check lower bounds of the code cache 2446 // Template Interpreter code is approximately 3X larger in debug builds. 2447 uint min_code_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3); 2448 if (InitialCodeCacheSize < (uintx)os::vm_page_size()) { 2449 jio_fprintf(defaultStream::error_stream(), 2450 "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K, 2451 os::vm_page_size()/K); 2452 status = false; 2453 } else if (ReservedCodeCacheSize < InitialCodeCacheSize) { 2454 jio_fprintf(defaultStream::error_stream(), 2455 "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n", 2456 ReservedCodeCacheSize/K, InitialCodeCacheSize/K); 2457 status = false; 2458 } else if (ReservedCodeCacheSize < min_code_cache_size) { 2459 jio_fprintf(defaultStream::error_stream(), 2460 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K, 2461 min_code_cache_size/K); 4347 if (DumpSharedSpaces || RequireSharedSpaces) { 4348 jio_fprintf(defaultStream::error_stream(), 4349 "Shared spaces are not supported in this VM\n"); 4350 return JNI_ERR; 4351 } 4352 if ((UseSharedSpaces && FLAG_IS_CMDLINE(UseSharedSpaces)) || PrintSharedSpaces) { 4353 warning("Shared spaces are not supported in this VM"); 4354 FLAG_SET_DEFAULT(UseSharedSpaces, false); 4355 FLAG_SET_DEFAULT(PrintSharedSpaces, false); 4356 } 4357 no_shared_spaces("CDS Disabled"); 4358 #endif // INCLUDE_CDS 4359 4360 return JNI_OK; 4361 } 4362 4363 jint Arguments::apply_ergo() { 4364 4365 // Set flags based on ergonomics. 4366 set_ergonomics_flags(); 4367 4368 #if INCLUDE_JVMCI 4369 set_jvmci_specific_flags(); 4370 #endif 4371 4372 set_shared_spaces_flags(); 4373 4374 // Check the GC selections again. 4375 if (!check_gc_consistency()) { 4376 return JNI_EINVAL; 4377 } 4378 4379 if (TieredCompilation) { 4380 set_tiered_flags(); 4381 } else { 4382 int max_compilation_policy_choice = 1; 4383 #ifdef COMPILER2 4384 max_compilation_policy_choice = 2; 4385 #endif 4386 // Check if the policy is valid. 4387 if (CompilationPolicyChoice >= max_compilation_policy_choice) { 4388 vm_exit_during_initialization( 4389 "Incompatible compilation policy selected", NULL); 4390 } |