comparison src/share/vm/runtime/arguments.cpp @ 1783:d5d065957597

6953144: Tiered compilation Summary: Infrastructure for tiered compilation support (interpreter + c1 + c2) for 32 and 64 bit. Simple tiered policy implementation. Reviewed-by: kvn, never, phh, twisti
author iveresov
date Fri, 03 Sep 2010 17:51:07 -0700
parents 14197af1010e
children a8b66e00933b
comparison
equal deleted inserted replaced
1782:f353275af40e 1783:d5d065957597
48 // These parameters are reset in method parse_vm_init_args(JavaVMInitArgs*) 48 // These parameters are reset in method parse_vm_init_args(JavaVMInitArgs*)
49 bool Arguments::_AlwaysCompileLoopMethods = AlwaysCompileLoopMethods; 49 bool Arguments::_AlwaysCompileLoopMethods = AlwaysCompileLoopMethods;
50 bool Arguments::_UseOnStackReplacement = UseOnStackReplacement; 50 bool Arguments::_UseOnStackReplacement = UseOnStackReplacement;
51 bool Arguments::_BackgroundCompilation = BackgroundCompilation; 51 bool Arguments::_BackgroundCompilation = BackgroundCompilation;
52 bool Arguments::_ClipInlining = ClipInlining; 52 bool Arguments::_ClipInlining = ClipInlining;
53 intx Arguments::_Tier2CompileThreshold = Tier2CompileThreshold;
54 53
55 char* Arguments::SharedArchivePath = NULL; 54 char* Arguments::SharedArchivePath = NULL;
56 55
57 AgentLibraryList Arguments::_libraryList; 56 AgentLibraryList Arguments::_libraryList;
58 AgentLibraryList Arguments::_agentList; 57 AgentLibraryList Arguments::_agentList;
911 // use the saved values 910 // use the saved values
912 ClipInlining = Arguments::_ClipInlining; 911 ClipInlining = Arguments::_ClipInlining;
913 AlwaysCompileLoopMethods = Arguments::_AlwaysCompileLoopMethods; 912 AlwaysCompileLoopMethods = Arguments::_AlwaysCompileLoopMethods;
914 UseOnStackReplacement = Arguments::_UseOnStackReplacement; 913 UseOnStackReplacement = Arguments::_UseOnStackReplacement;
915 BackgroundCompilation = Arguments::_BackgroundCompilation; 914 BackgroundCompilation = Arguments::_BackgroundCompilation;
916 Tier2CompileThreshold = Arguments::_Tier2CompileThreshold;
917 915
918 // Change from defaults based on mode 916 // Change from defaults based on mode
919 switch (mode) { 917 switch (mode) {
920 default: 918 default:
921 ShouldNotReachHere(); 919 ShouldNotReachHere();
945 jio_fprintf(defaultStream::error_stream(), 943 jio_fprintf(defaultStream::error_stream(),
946 "Class data sharing is inconsistent with other specified options.\n"); 944 "Class data sharing is inconsistent with other specified options.\n");
947 vm_exit_during_initialization("Unable to use shared archive.", NULL); 945 vm_exit_during_initialization("Unable to use shared archive.", NULL);
948 } else { 946 } else {
949 FLAG_SET_DEFAULT(UseSharedSpaces, false); 947 FLAG_SET_DEFAULT(UseSharedSpaces, false);
948 }
949 }
950
951 void Arguments::set_tiered_flags() {
952 if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) {
953 FLAG_SET_DEFAULT(CompilationPolicyChoice, 2);
954 }
955
956 if (CompilationPolicyChoice < 2) {
957 vm_exit_during_initialization(
958 "Incompatible compilation policy selected", NULL);
959 }
960
961 #ifdef _LP64
962 if (FLAG_IS_DEFAULT(UseCompressedOops) || FLAG_IS_ERGO(UseCompressedOops)) {
963 UseCompressedOops = false;
964 }
965 if (UseCompressedOops) {
966 vm_exit_during_initialization(
967 "Tiered compilation is not supported with compressed oops yet", NULL);
968 }
969 #endif
970 // Increase the code cache size - tiered compiles a lot more.
971 if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
972 FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 2);
950 } 973 }
951 } 974 }
952 975
953 #ifndef KERNEL 976 #ifndef KERNEL
954 // If the user has chosen ParallelGCThreads > 0, we set UseParNewGC 977 // If the user has chosen ParallelGCThreads > 0, we set UseParNewGC
1297 #ifndef ZERO 1320 #ifndef ZERO
1298 #ifdef _LP64 1321 #ifdef _LP64
1299 // Check that UseCompressedOops can be set with the max heap size allocated 1322 // Check that UseCompressedOops can be set with the max heap size allocated
1300 // by ergonomics. 1323 // by ergonomics.
1301 if (MaxHeapSize <= max_heap_for_compressed_oops()) { 1324 if (MaxHeapSize <= max_heap_for_compressed_oops()) {
1302 #ifndef COMPILER1 1325 #if !defined(COMPILER1) || defined(TIERED)
1303 if (FLAG_IS_DEFAULT(UseCompressedOops) && !UseG1GC) { 1326 if (FLAG_IS_DEFAULT(UseCompressedOops) && !UseG1GC) {
1304 FLAG_SET_ERGO(bool, UseCompressedOops, true); 1327 FLAG_SET_ERGO(bool, UseCompressedOops, true);
1305 } 1328 }
1306 #endif 1329 #endif
1307 #ifdef _WIN64 1330 #ifdef _WIN64
1931 // Save default settings for some mode flags 1954 // Save default settings for some mode flags
1932 Arguments::_AlwaysCompileLoopMethods = AlwaysCompileLoopMethods; 1955 Arguments::_AlwaysCompileLoopMethods = AlwaysCompileLoopMethods;
1933 Arguments::_UseOnStackReplacement = UseOnStackReplacement; 1956 Arguments::_UseOnStackReplacement = UseOnStackReplacement;
1934 Arguments::_ClipInlining = ClipInlining; 1957 Arguments::_ClipInlining = ClipInlining;
1935 Arguments::_BackgroundCompilation = BackgroundCompilation; 1958 Arguments::_BackgroundCompilation = BackgroundCompilation;
1936 Arguments::_Tier2CompileThreshold = Tier2CompileThreshold;
1937 1959
1938 // Parse JAVA_TOOL_OPTIONS environment variable (if present) 1960 // Parse JAVA_TOOL_OPTIONS environment variable (if present)
1939 jint result = parse_java_tool_options_environment_variable(&scp, &scp_assembly_required); 1961 jint result = parse_java_tool_options_environment_variable(&scp, &scp_assembly_required);
1940 if (result != JNI_OK) { 1962 if (result != JNI_OK) {
1941 return result; 1963 return result;
2649 } 2671 }
2650 if (CompileThreshold == 0) { 2672 if (CompileThreshold == 0) {
2651 set_mode_flags(_int); 2673 set_mode_flags(_int);
2652 } 2674 }
2653 2675
2654 #ifdef TIERED
2655 // If we are using tiered compilation in the tiered vm then c1 will
2656 // do the profiling and we don't want to waste that time in the
2657 // interpreter.
2658 if (TieredCompilation) {
2659 ProfileInterpreter = false;
2660 } else {
2661 // Since we are running vanilla server we must adjust the compile threshold
2662 // unless the user has already adjusted it because the default threshold assumes
2663 // we will run tiered.
2664
2665 if (FLAG_IS_DEFAULT(CompileThreshold)) {
2666 CompileThreshold = Tier2CompileThreshold;
2667 }
2668 }
2669 #endif // TIERED
2670
2671 #ifndef COMPILER2 2676 #ifndef COMPILER2
2672 // Don't degrade server performance for footprint 2677 // Don't degrade server performance for footprint
2673 if (FLAG_IS_DEFAULT(UseLargePages) && 2678 if (FLAG_IS_DEFAULT(UseLargePages) &&
2674 MaxHeapSize < LargePageHeapSizeThreshold) { 2679 MaxHeapSize < LargePageHeapSizeThreshold) {
2675 // No need for large granularity pages w/small heaps. 2680 // No need for large granularity pages w/small heaps.
2680 SOLARIS_ONLY(FLAG_SET_DEFAULT(UseISM, false)); 2685 SOLARIS_ONLY(FLAG_SET_DEFAULT(UseISM, false));
2681 } 2686 }
2682 2687
2683 // Tiered compilation is undefined with C1. 2688 // Tiered compilation is undefined with C1.
2684 TieredCompilation = false; 2689 TieredCompilation = false;
2685
2686 #else 2690 #else
2687 if (!FLAG_IS_DEFAULT(OptoLoopAlignment) && FLAG_IS_DEFAULT(MaxLoopPad)) { 2691 if (!FLAG_IS_DEFAULT(OptoLoopAlignment) && FLAG_IS_DEFAULT(MaxLoopPad)) {
2688 FLAG_SET_DEFAULT(MaxLoopPad, OptoLoopAlignment-1); 2692 FLAG_SET_DEFAULT(MaxLoopPad, OptoLoopAlignment-1);
2689 } 2693 }
2690 // Temporary disable bulk zeroing reduction with G1. See CR 6627983. 2694 // Temporary disable bulk zeroing reduction with G1. See CR 6627983.
2937 if (PrintGCDetails) { 2941 if (PrintGCDetails) {
2938 // Turn on -verbose:gc options as well 2942 // Turn on -verbose:gc options as well
2939 PrintGC = true; 2943 PrintGC = true;
2940 } 2944 }
2941 2945
2942 #if defined(_LP64) && defined(COMPILER1) 2946 #if defined(_LP64) && defined(COMPILER1) && !defined(TIERED)
2943 UseCompressedOops = false; 2947 UseCompressedOops = false;
2944 #endif 2948 #endif
2945 2949
2946 // Set object alignment values. 2950 // Set object alignment values.
2947 set_object_alignment(); 2951 set_object_alignment();
2966 #endif // _LP64 2970 #endif // _LP64
2967 2971
2968 // Check the GC selections again. 2972 // Check the GC selections again.
2969 if (!check_gc_consistency()) { 2973 if (!check_gc_consistency()) {
2970 return JNI_EINVAL; 2974 return JNI_EINVAL;
2975 }
2976
2977 if (TieredCompilation) {
2978 set_tiered_flags();
2979 } else {
2980 // Check if the policy is valid. Policies 0 and 1 are valid for non-tiered setup.
2981 if (CompilationPolicyChoice >= 2) {
2982 vm_exit_during_initialization(
2983 "Incompatible compilation policy selected", NULL);
2984 }
2971 } 2985 }
2972 2986
2973 #ifndef KERNEL 2987 #ifndef KERNEL
2974 if (UseConcMarkSweepGC) { 2988 if (UseConcMarkSweepGC) {
2975 // Set flags for CMS and ParNew. Check UseConcMarkSweep first 2989 // Set flags for CMS and ParNew. Check UseConcMarkSweep first