1072 "Class data sharing is inconsistent with other specified options.\n"); 1073 vm_exit_during_initialization("Unable to use shared archive.", NULL); 1074 } else { 1075 FLAG_SET_DEFAULT(UseSharedSpaces, false); 1076 } 1077 } 1078 1079 void Arguments::set_tiered_flags() { 1080 // With tiered, set default policy to AdvancedThresholdPolicy, which is 3. 1081 if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) { 1082 FLAG_SET_DEFAULT(CompilationPolicyChoice, 3); 1083 } 1084 if (CompilationPolicyChoice < 2) { 1085 vm_exit_during_initialization( 1086 "Incompatible compilation policy selected", NULL); 1087 } 1088 // Increase the code cache size - tiered compiles a lot more. 1089 if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) { 1090 FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 5); 1091 } 1092 } 1093 1094 #if INCLUDE_ALL_GCS 1095 static void disable_adaptive_size_policy(const char* collector_name) { 1096 if (UseAdaptiveSizePolicy) { 1097 if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) { 1098 warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.", 1099 collector_name); 1100 } 1101 FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false); 1102 } 1103 } 1104 1105 void Arguments::set_parnew_gc_flags() { 1106 assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC, 1107 "control point invariant"); 1108 assert(UseParNewGC, "Error"); 1109 1110 // Turn off AdaptiveSizePolicy for parnew until it is complete. 1111 disable_adaptive_size_policy("UseParNewGC"); 1644 } 1645 } 1646 1647 // This must be called after ergonomics because we want bytecode rewriting 1648 // if the server compiler is used, or if UseSharedSpaces is disabled. 1649 void Arguments::set_bytecode_flags() { 1650 // Better not attempt to store into a read-only space. 1651 if (UseSharedSpaces) { 1652 FLAG_SET_DEFAULT(RewriteBytecodes, false); 1653 FLAG_SET_DEFAULT(RewriteFrequentPairs, false); 1654 } 1655 1656 if (!RewriteBytecodes) { 1657 FLAG_SET_DEFAULT(RewriteFrequentPairs, false); 1658 } 1659 } 1660 1661 // Aggressive optimization flags -XX:+AggressiveOpts 1662 void Arguments::set_aggressive_opts_flags() { 1663 #ifdef COMPILER2 1664 if (AggressiveOpts || !FLAG_IS_DEFAULT(AutoBoxCacheMax)) { 1665 if (FLAG_IS_DEFAULT(EliminateAutoBox)) { 1666 FLAG_SET_DEFAULT(EliminateAutoBox, true); 1667 } 1668 if (FLAG_IS_DEFAULT(AutoBoxCacheMax)) { 1669 FLAG_SET_DEFAULT(AutoBoxCacheMax, 20000); 1670 } 1671 1672 // Feed the cache size setting into the JDK 1673 char buffer[1024]; 1674 sprintf(buffer, "java.lang.Integer.IntegerCache.high=" INTX_FORMAT, AutoBoxCacheMax); 1675 add_property(buffer); 1676 } 1677 if (AggressiveOpts && FLAG_IS_DEFAULT(BiasedLockingStartupDelay)) { 1678 FLAG_SET_DEFAULT(BiasedLockingStartupDelay, 500); 1679 } 1680 #endif 1681 1682 if (AggressiveOpts) { 1683 // Sample flag setting code | 1072 "Class data sharing is inconsistent with other specified options.\n"); 1073 vm_exit_during_initialization("Unable to use shared archive.", NULL); 1074 } else { 1075 FLAG_SET_DEFAULT(UseSharedSpaces, false); 1076 } 1077 } 1078 1079 void Arguments::set_tiered_flags() { 1080 // With tiered, set default policy to AdvancedThresholdPolicy, which is 3. 1081 if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) { 1082 FLAG_SET_DEFAULT(CompilationPolicyChoice, 3); 1083 } 1084 if (CompilationPolicyChoice < 2) { 1085 vm_exit_during_initialization( 1086 "Incompatible compilation policy selected", NULL); 1087 } 1088 // Increase the code cache size - tiered compiles a lot more. 1089 if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) { 1090 FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 5); 1091 } 1092 if (!UseInterpreter) { // -Xcomp 1093 Tier3InvokeNotifyFreqLog = 0; 1094 Tier4InvocationThreshold = 0; 1095 } 1096 } 1097 1098 #if INCLUDE_ALL_GCS 1099 static void disable_adaptive_size_policy(const char* collector_name) { 1100 if (UseAdaptiveSizePolicy) { 1101 if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) { 1102 warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.", 1103 collector_name); 1104 } 1105 FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false); 1106 } 1107 } 1108 1109 void Arguments::set_parnew_gc_flags() { 1110 assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC, 1111 "control point invariant"); 1112 assert(UseParNewGC, "Error"); 1113 1114 // Turn off AdaptiveSizePolicy for parnew until it is complete. 1115 disable_adaptive_size_policy("UseParNewGC"); 1648 } 1649 } 1650 1651 // This must be called after ergonomics because we want bytecode rewriting 1652 // if the server compiler is used, or if UseSharedSpaces is disabled. 1653 void Arguments::set_bytecode_flags() { 1654 // Better not attempt to store into a read-only space. 1655 if (UseSharedSpaces) { 1656 FLAG_SET_DEFAULT(RewriteBytecodes, false); 1657 FLAG_SET_DEFAULT(RewriteFrequentPairs, false); 1658 } 1659 1660 if (!RewriteBytecodes) { 1661 FLAG_SET_DEFAULT(RewriteFrequentPairs, false); 1662 } 1663 } 1664 1665 // Aggressive optimization flags -XX:+AggressiveOpts 1666 void Arguments::set_aggressive_opts_flags() { 1667 #ifdef COMPILER2 1668 if (AggressiveUnboxing) { 1669 if (FLAG_IS_DEFAULT(EliminateAutoBox)) { 1670 FLAG_SET_DEFAULT(EliminateAutoBox, true); 1671 } else if (!EliminateAutoBox) { 1672 // warning("AggressiveUnboxing is disabled because EliminateAutoBox is disabled"); 1673 AggressiveUnboxing = false; 1674 } 1675 if (FLAG_IS_DEFAULT(DoEscapeAnalysis)) { 1676 FLAG_SET_DEFAULT(DoEscapeAnalysis, true); 1677 } else if (!DoEscapeAnalysis) { 1678 // warning("AggressiveUnboxing is disabled because DoEscapeAnalysis is disabled"); 1679 AggressiveUnboxing = false; 1680 } 1681 } 1682 if (AggressiveOpts || !FLAG_IS_DEFAULT(AutoBoxCacheMax)) { 1683 if (FLAG_IS_DEFAULT(EliminateAutoBox)) { 1684 FLAG_SET_DEFAULT(EliminateAutoBox, true); 1685 } 1686 if (FLAG_IS_DEFAULT(AutoBoxCacheMax)) { 1687 FLAG_SET_DEFAULT(AutoBoxCacheMax, 20000); 1688 } 1689 1690 // Feed the cache size setting into the JDK 1691 char buffer[1024]; 1692 sprintf(buffer, "java.lang.Integer.IntegerCache.high=" INTX_FORMAT, AutoBoxCacheMax); 1693 add_property(buffer); 1694 } 1695 if (AggressiveOpts && FLAG_IS_DEFAULT(BiasedLockingStartupDelay)) { 1696 FLAG_SET_DEFAULT(BiasedLockingStartupDelay, 500); 1697 } 1698 #endif 1699 1700 if (AggressiveOpts) { 1701 // Sample flag setting code |