8059596: VM startup fails with 'Invalid code heap sizes' if -XX:ReservedCodeCacheSize is set

Only increase code heap sizes in Arguments::set_tiered_flags() if reserved code cache size is default.

Reviewed-by: shade, vlivanov, sla
This commit is contained in:
Tobias Hartmann 2014-10-02 12:58:37 +02:00
parent 4c5840ada6
commit c410cd3bfb

View File

@ -1152,20 +1152,22 @@ void Arguments::set_tiered_flags() {
if (FLAG_IS_DEFAULT(SegmentedCodeCache) && ReservedCodeCacheSize >= 240*M) {
FLAG_SET_ERGO(bool, SegmentedCodeCache, true);
// Multiply sizes by 5 but fix NonMethodCodeHeapSize (distribute among non-profiled and profiled code heap)
if (FLAG_IS_DEFAULT(ProfiledCodeHeapSize)) {
FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, ProfiledCodeHeapSize * 5 + NonMethodCodeHeapSize * 2);
}
if (FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) {
FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, NonProfiledCodeHeapSize * 5 + NonMethodCodeHeapSize * 2);
}
// Check consistency of code heap sizes
if ((NonMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) {
jio_fprintf(defaultStream::error_stream(),
"Invalid code heap sizes: NonMethodCodeHeapSize(%dK) + ProfiledCodeHeapSize(%dK) + NonProfiledCodeHeapSize(%dK) = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n",
NonMethodCodeHeapSize/K, ProfiledCodeHeapSize/K, NonProfiledCodeHeapSize/K,
(NonMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K);
vm_exit(1);
if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
// Multiply sizes by 5 but fix NonMethodCodeHeapSize (distribute among non-profiled and profiled code heap)
if (FLAG_IS_DEFAULT(ProfiledCodeHeapSize)) {
FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, ProfiledCodeHeapSize * 5 + NonMethodCodeHeapSize * 2);
}
if (FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) {
FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, NonProfiledCodeHeapSize * 5 + NonMethodCodeHeapSize * 2);
}
// Check consistency of code heap sizes
if ((NonMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) {
jio_fprintf(defaultStream::error_stream(),
"Invalid code heap sizes: NonMethodCodeHeapSize(%dK) + ProfiledCodeHeapSize(%dK) + NonProfiledCodeHeapSize(%dK) = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n",
NonMethodCodeHeapSize/K, ProfiledCodeHeapSize/K, NonProfiledCodeHeapSize/K,
(NonMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K);
vm_exit(1);
}
}
}
if (!UseInterpreter) { // -Xcomp