2463 // aggressive prefetching, while still leaving the room for segregating 2464 // among the distinct pages. 2465 if (ContendedPaddingWidth < 0 || ContendedPaddingWidth > 8192) { 2466 jio_fprintf(defaultStream::error_stream(), 2467 "ContendedPaddingWidth=" INTX_FORMAT " must be in between %d and %d\n", 2468 ContendedPaddingWidth, 0, 8192); 2469 status = false; 2470 } 2471 2472 // Need to enforce the padding not to break the existing field alignments. 2473 // It is sufficient to check against the largest type size. 2474 if ((ContendedPaddingWidth % BytesPerLong) != 0) { 2475 jio_fprintf(defaultStream::error_stream(), 2476 "ContendedPaddingWidth=" INTX_FORMAT " must be a multiple of %d\n", 2477 ContendedPaddingWidth, BytesPerLong); 2478 status = false; 2479 } 2480 2481 // Check lower bounds of the code cache 2482 // Template Interpreter code is approximately 3X larger in debug builds. 2483 uint min_code_cache_size = (CodeCacheMinimumUseSpace DEBUG_ONLY(* 3)) + CodeCacheMinimumFreeSpace; 2484 if (InitialCodeCacheSize < (uintx)os::vm_page_size()) { 2485 jio_fprintf(defaultStream::error_stream(), 2486 "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K, 2487 os::vm_page_size()/K); 2488 status = false; 2489 } else if (ReservedCodeCacheSize < InitialCodeCacheSize) { 2490 jio_fprintf(defaultStream::error_stream(), 2491 "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n", 2492 ReservedCodeCacheSize/K, InitialCodeCacheSize/K); 2493 status = false; 2494 } else if (ReservedCodeCacheSize < min_code_cache_size) { 2495 jio_fprintf(defaultStream::error_stream(), 2496 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K, 2497 min_code_cache_size/K); 2498 status = false; 2499 } else if (ReservedCodeCacheSize > 2*G) { 2500 // Code cache size larger than MAXINT is not supported. 2501 jio_fprintf(defaultStream::error_stream(), 2502 "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M, 2503 (2*G)/M); 2504 status = false; 2505 } else if (NonNMethodCodeHeapSize < min_code_cache_size){ 2506 jio_fprintf(defaultStream::error_stream(), 2507 "Invalid NonNMethodCodeHeapSize=%dK. Must be at least %uK.\n", NonNMethodCodeHeapSize/K, 2508 min_code_cache_size/K); 2509 status = false; 2510 } else if ((!FLAG_IS_DEFAULT(NonNMethodCodeHeapSize) || !FLAG_IS_DEFAULT(ProfiledCodeHeapSize) || !FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) 2511 && (NonNMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) { 2512 jio_fprintf(defaultStream::error_stream(), 2513 "Invalid code heap sizes: NonNMethodCodeHeapSize(%dK) + ProfiledCodeHeapSize(%dK) + NonProfiledCodeHeapSize(%dK) = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n", 2514 NonNMethodCodeHeapSize/K, ProfiledCodeHeapSize/K, NonProfiledCodeHeapSize/K, 2515 (NonNMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K); 2516 status = false; 2517 } 2518 2519 status &= verify_interval(NmethodSweepFraction, 1, ReservedCodeCacheSize/K, "NmethodSweepFraction"); 2520 status &= verify_interval(NmethodSweepActivity, 0, 2000, "NmethodSweepActivity"); 2521 status &= verify_interval(CodeCacheMinBlockLength, 1, 100, "CodeCacheMinBlockLength"); 2522 status &= verify_interval(CodeCacheSegmentSize, 1, 1024, "CodeCacheSegmentSize"); 2523 2524 int min_number_of_compiler_threads = get_min_number_of_compiler_threads(); 2525 // The default CICompilerCount's value is CI_COMPILER_COUNT. 2526 assert(min_number_of_compiler_threads <= CI_COMPILER_COUNT, "minimum should be less or equal default number"); 2527 // Check the minimum number of compiler threads 2528 status &=verify_min_value(CICompilerCount, min_number_of_compiler_threads, "CICompilerCount"); 2529 2530 if (!FLAG_IS_DEFAULT(CICompilerCount) && !FLAG_IS_DEFAULT(CICompilerCountPerCPU) && CICompilerCountPerCPU) { 2531 warning("The VM option CICompilerCountPerCPU overrides CICompilerCount."); 2532 } 2533 2534 return status; 2535 } 2536 2537 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore, 2538 const char* option_type) { 2539 if (ignore) return false; 2540 2541 const char* spacer = " "; 2542 if (option_type == NULL) { 3898 3899 // Set flags based on ergonomics. 3900 set_ergonomics_flags(); 3901 3902 set_shared_spaces_flags(); 3903 3904 // Check the GC selections again. 3905 if (!ArgumentsExt::check_gc_consistency_ergo()) { 3906 return JNI_EINVAL; 3907 } 3908 3909 if (TieredCompilation) { 3910 set_tiered_flags(); 3911 } else { 3912 // Check if the policy is valid. Policies 0 and 1 are valid for non-tiered setup. 3913 if (CompilationPolicyChoice >= 2) { 3914 vm_exit_during_initialization( 3915 "Incompatible compilation policy selected", NULL); 3916 } 3917 } 3918 // Set NmethodSweepFraction after the size of the code cache is adapted (in case of tiered) 3919 if (FLAG_IS_DEFAULT(NmethodSweepFraction)) { 3920 FLAG_SET_DEFAULT(NmethodSweepFraction, 1 + ReservedCodeCacheSize / (16 * M)); 3921 } 3922 3923 3924 // Set heap size based on available physical memory 3925 set_heap_size(); 3926 3927 set_gc_specific_flags(); 3928 3929 // Initialize Metaspace flags and alignments 3930 Metaspace::ergo_initialize(); 3931 3932 // Set bytecode rewriting flags 3933 set_bytecode_flags(); 3934 3935 // Set flags if Aggressive optimization flags (-XX:+AggressiveOpts) enabled 3936 set_aggressive_opts_flags(); 3937 3938 // Turn off biased locking for locking debug mode flags, 3939 // which are subtly different from each other but neither works with 3940 // biased locking 3941 if (UseHeavyMonitors 3942 #ifdef COMPILER1 3971 if (!IncrementalInline) { 3972 AlwaysIncrementalInline = false; 3973 } 3974 #endif 3975 if (!UseTypeSpeculation && FLAG_IS_DEFAULT(TypeProfileLevel)) { 3976 // nothing to use the profiling, turn if off 3977 FLAG_SET_DEFAULT(TypeProfileLevel, 0); 3978 } 3979 #endif 3980 3981 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) { 3982 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output"); 3983 DebugNonSafepoints = true; 3984 } 3985 3986 if (FLAG_IS_CMDLINE(CompressedClassSpaceSize) && !UseCompressedClassPointers) { 3987 warning("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used"); 3988 } 3989 3990 #ifndef PRODUCT 3991 if (CompileTheWorld) { 3992 // Force NmethodSweeper to sweep whole CodeCache each time. 3993 if (FLAG_IS_DEFAULT(NmethodSweepFraction)) { 3994 NmethodSweepFraction = 1; 3995 } 3996 } 3997 3998 if (!LogVMOutput && FLAG_IS_DEFAULT(LogVMOutput)) { 3999 if (use_vm_log()) { 4000 LogVMOutput = true; 4001 } 4002 } 4003 #endif // PRODUCT 4004 4005 if (PrintCommandLineFlags) { 4006 CommandLineFlags::printSetFlags(tty); 4007 } 4008 4009 // Apply CPU specific policy for the BiasedLocking 4010 if (UseBiasedLocking) { 4011 if (!VM_Version::use_biased_locking() && 4012 !(FLAG_IS_CMDLINE(UseBiasedLocking))) { 4013 UseBiasedLocking = false; 4014 } 4015 } 4016 #ifdef COMPILER2 4017 if (!UseBiasedLocking || EmitSync != 0) { | 2463 // aggressive prefetching, while still leaving the room for segregating 2464 // among the distinct pages. 2465 if (ContendedPaddingWidth < 0 || ContendedPaddingWidth > 8192) { 2466 jio_fprintf(defaultStream::error_stream(), 2467 "ContendedPaddingWidth=" INTX_FORMAT " must be in between %d and %d\n", 2468 ContendedPaddingWidth, 0, 8192); 2469 status = false; 2470 } 2471 2472 // Need to enforce the padding not to break the existing field alignments. 2473 // It is sufficient to check against the largest type size. 2474 if ((ContendedPaddingWidth % BytesPerLong) != 0) { 2475 jio_fprintf(defaultStream::error_stream(), 2476 "ContendedPaddingWidth=" INTX_FORMAT " must be a multiple of %d\n", 2477 ContendedPaddingWidth, BytesPerLong); 2478 status = false; 2479 } 2480 2481 // Check lower bounds of the code cache 2482 // Template Interpreter code is approximately 3X larger in debug builds. 2483 uint min_code_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3); 2484 if (InitialCodeCacheSize < (uintx)os::vm_page_size()) { 2485 jio_fprintf(defaultStream::error_stream(), 2486 "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K, 2487 os::vm_page_size()/K); 2488 status = false; 2489 } else if (ReservedCodeCacheSize < InitialCodeCacheSize) { 2490 jio_fprintf(defaultStream::error_stream(), 2491 "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n", 2492 ReservedCodeCacheSize/K, InitialCodeCacheSize/K); 2493 status = false; 2494 } else if (ReservedCodeCacheSize < min_code_cache_size) { 2495 jio_fprintf(defaultStream::error_stream(), 2496 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K, 2497 min_code_cache_size/K); 2498 status = false; 2499 } else if (ReservedCodeCacheSize > 2*G) { 2500 // Code cache size larger than MAXINT is not supported. 2501 jio_fprintf(defaultStream::error_stream(), 2502 "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M, 2503 (2*G)/M); 2504 status = false; 2505 } else if (NonNMethodCodeHeapSize < min_code_cache_size){ 2506 jio_fprintf(defaultStream::error_stream(), 2507 "Invalid NonNMethodCodeHeapSize=%dK. Must be at least %uK.\n", NonNMethodCodeHeapSize/K, 2508 min_code_cache_size/K); 2509 status = false; 2510 } else if ((!FLAG_IS_DEFAULT(NonNMethodCodeHeapSize) || !FLAG_IS_DEFAULT(ProfiledCodeHeapSize) || !FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) 2511 && (NonNMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) { 2512 jio_fprintf(defaultStream::error_stream(), 2513 "Invalid code heap sizes: NonNMethodCodeHeapSize(%dK) + ProfiledCodeHeapSize(%dK) + NonProfiledCodeHeapSize(%dK) = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n", 2514 NonNMethodCodeHeapSize/K, ProfiledCodeHeapSize/K, NonProfiledCodeHeapSize/K, 2515 (NonNMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K); 2516 status = false; 2517 } 2518 2519 status &= verify_interval(NmethodSweepActivity, 0, 2000, "NmethodSweepActivity"); 2520 status &= verify_interval(CodeCacheMinBlockLength, 1, 100, "CodeCacheMinBlockLength"); 2521 status &= verify_interval(CodeCacheSegmentSize, 1, 1024, "CodeCacheSegmentSize"); 2522 status &= verify_interval(StartAggressiveSweepingAt, 0, 100, "StartAggressiveSweepingAt"); 2523 2524 2525 int min_number_of_compiler_threads = get_min_number_of_compiler_threads(); 2526 // The default CICompilerCount's value is CI_COMPILER_COUNT. 2527 assert(min_number_of_compiler_threads <= CI_COMPILER_COUNT, "minimum should be less or equal default number"); 2528 // Check the minimum number of compiler threads 2529 status &=verify_min_value(CICompilerCount, min_number_of_compiler_threads, "CICompilerCount"); 2530 2531 if (!FLAG_IS_DEFAULT(CICompilerCount) && !FLAG_IS_DEFAULT(CICompilerCountPerCPU) && CICompilerCountPerCPU) { 2532 warning("The VM option CICompilerCountPerCPU overrides CICompilerCount."); 2533 } 2534 2535 return status; 2536 } 2537 2538 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore, 2539 const char* option_type) { 2540 if (ignore) return false; 2541 2542 const char* spacer = " "; 2543 if (option_type == NULL) { 3899 3900 // Set flags based on ergonomics. 3901 set_ergonomics_flags(); 3902 3903 set_shared_spaces_flags(); 3904 3905 // Check the GC selections again. 3906 if (!ArgumentsExt::check_gc_consistency_ergo()) { 3907 return JNI_EINVAL; 3908 } 3909 3910 if (TieredCompilation) { 3911 set_tiered_flags(); 3912 } else { 3913 // Check if the policy is valid. Policies 0 and 1 are valid for non-tiered setup. 3914 if (CompilationPolicyChoice >= 2) { 3915 vm_exit_during_initialization( 3916 "Incompatible compilation policy selected", NULL); 3917 } 3918 } 3919 3920 // Set heap size based on available physical memory 3921 set_heap_size(); 3922 3923 set_gc_specific_flags(); 3924 3925 // Initialize Metaspace flags and alignments 3926 Metaspace::ergo_initialize(); 3927 3928 // Set bytecode rewriting flags 3929 set_bytecode_flags(); 3930 3931 // Set flags if Aggressive optimization flags (-XX:+AggressiveOpts) enabled 3932 set_aggressive_opts_flags(); 3933 3934 // Turn off biased locking for locking debug mode flags, 3935 // which are subtly different from each other but neither works with 3936 // biased locking 3937 if (UseHeavyMonitors 3938 #ifdef COMPILER1 3967 if (!IncrementalInline) { 3968 AlwaysIncrementalInline = false; 3969 } 3970 #endif 3971 if (!UseTypeSpeculation && FLAG_IS_DEFAULT(TypeProfileLevel)) { 3972 // nothing to use the profiling, turn if off 3973 FLAG_SET_DEFAULT(TypeProfileLevel, 0); 3974 } 3975 #endif 3976 3977 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) { 3978 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output"); 3979 DebugNonSafepoints = true; 3980 } 3981 3982 if (FLAG_IS_CMDLINE(CompressedClassSpaceSize) && !UseCompressedClassPointers) { 3983 warning("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used"); 3984 } 3985 3986 #ifndef PRODUCT 3987 if (!LogVMOutput && FLAG_IS_DEFAULT(LogVMOutput)) { 3988 if (use_vm_log()) { 3989 LogVMOutput = true; 3990 } 3991 } 3992 #endif // PRODUCT 3993 3994 if (PrintCommandLineFlags) { 3995 CommandLineFlags::printSetFlags(tty); 3996 } 3997 3998 // Apply CPU specific policy for the BiasedLocking 3999 if (UseBiasedLocking) { 4000 if (!VM_Version::use_biased_locking() && 4001 !(FLAG_IS_CMDLINE(UseBiasedLocking))) { 4002 UseBiasedLocking = false; 4003 } 4004 } 4005 #ifdef COMPILER2 4006 if (!UseBiasedLocking || EmitSync != 0) { |