--- old/src/share/vm/runtime/arguments.cpp 2013-10-10 17:08:09.432891879 +0200 +++ new/src/share/vm/runtime/arguments.cpp 2013-10-10 17:08:08.372891920 +0200 @@ -1125,8 +1125,15 @@ "Incompatible compilation policy selected", NULL); } // Increase the code cache size - tiered compiles a lot more. - if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) { + if (FLAG_IS_DEFAULT(ReservedCodeCacheSize) && + FLAG_IS_DEFAULT(ProfiledCodeHeapSize) && + FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) { + intx non_method_size = ReservedCodeCacheSize - (ProfiledCodeHeapSize + NonProfiledCodeHeapSize); + + // Multiply sizes by 5 but fix non_method_size (distribute among non-profiled and profiled code heap) FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 5); + FLAG_SET_DEFAULT(ProfiledCodeHeapSize, ProfiledCodeHeapSize * 5 + non_method_size * 2); + FLAG_SET_DEFAULT(NonProfiledCodeHeapSize, NonProfiledCodeHeapSize * 5 + non_method_size * 2); } if (!UseInterpreter) { // -Xcomp Tier3InvokeNotifyFreqLog = 0; @@ -2339,6 +2346,12 @@ "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M, (2*G)/M); status = false; + } else if ((!FLAG_IS_DEFAULT(NonProfiledCodeHeapSize) || !FLAG_IS_DEFAULT(ProfiledCodeHeapSize)) + && (NonProfiledCodeHeapSize + ProfiledCodeHeapSize) > ReservedCodeCacheSize) { + jio_fprintf(defaultStream::error_stream(), + "Invalid NonProfiledCodeHeapSize + ProfiledCodeHeapSize = %dM. Must be smaller than ReservedCodeCacheSize = %dM.\n", + (NonProfiledCodeHeapSize + ProfiledCodeHeapSize)/M, ReservedCodeCacheSize/M); + status = false; } status &= verify_interval(NmethodSweepFraction, 1, ReservedCodeCacheSize/K, "NmethodSweepFraction"); @@ -2748,8 +2761,30 @@ return JNI_EINVAL; } FLAG_SET_CMDLINE(uintx, ReservedCodeCacheSize, (uintx)long_ReservedCodeCacheSize); + // -XX:ProfiledCodeHeapSize= + } else if (match_option(option, "-XX:ProfiledCodeHeapSize=", &tail)) { + julong long_ProfiledCodeHeapSize = 0; + + ArgsRange errcode = parse_memory_size(tail, &long_ProfiledCodeHeapSize, 1); + if (errcode != arg_in_range) { + jio_fprintf(defaultStream::error_stream(), + "Invalid maximum profiled code heap size: %s.\n", option->optionString); + return JNI_EINVAL; + } + FLAG_SET_CMDLINE(uintx, ProfiledCodeHeapSize, (uintx)long_ProfiledCodeHeapSize); + // -XX:NonProfiledCodeHeapSizee= + } else if (match_option(option, "-XX:NonProfiledCodeHeapSize=", &tail)) { + julong long_NonProfiledCodeHeapSize = 0; + + ArgsRange errcode = parse_memory_size(tail, &long_NonProfiledCodeHeapSize, 1); + if (errcode != arg_in_range) { + jio_fprintf(defaultStream::error_stream(), + "Invalid maximum non-profiled code heap size: %s.\n", option->optionString); + return JNI_EINVAL; + } + FLAG_SET_CMDLINE(uintx, NonProfiledCodeHeapSize, (uintx)long_NonProfiledCodeHeapSize); //-XX:IncreaseFirstTierCompileThresholdAt= - } else if (match_option(option, "-XX:IncreaseFirstTierCompileThresholdAt=", &tail)) { + } else if (match_option(option, "-XX:IncreaseFirstTierCompileThresholdAt=", &tail)) { uintx uint_IncreaseFirstTierCompileThresholdAt = 0; if (!parse_uintx(tail, &uint_IncreaseFirstTierCompileThresholdAt, 0) || uint_IncreaseFirstTierCompileThresholdAt > 99) { jio_fprintf(defaultStream::error_stream(),