8060196: 'CodeHeap is full' warning suggests to increase wrong code heap size
Summary: Fixed 'CodeHeap is full' warning to output the right CodeHeapSize flag.
Reviewed-by: kvn, anoll
--- a/hotspot/src/share/vm/code/codeCache.cpp Thu Oct 16 12:57:04 2014 +0200
+++ b/hotspot/src/share/vm/code/codeCache.cpp Fri Oct 17 08:56:07 2014 +0200
@@ -267,6 +267,22 @@
}
}
+const char* CodeCache::get_code_heap_flag_name(int code_blob_type) {
+ switch(code_blob_type) {
+ case CodeBlobType::NonNMethod:
+ return "NonNMethodCodeHeapSize";
+ break;
+ case CodeBlobType::MethodNonProfiled:
+ return "NonProfiledCodeHeapSize";
+ break;
+ case CodeBlobType::MethodProfiled:
+ return "ProfiledCodeHeapSize";
+ break;
+ }
+ ShouldNotReachHere();
+ return NULL;
+}
+
void CodeCache::add_heap(ReservedSpace rs, const char* name, size_t size_initial, int code_blob_type) {
// Check if heap is needed
if (!heap_available(code_blob_type)) {
@@ -1011,9 +1027,8 @@
// Not yet reported for this heap, report
heap->report_full();
if (SegmentedCodeCache) {
- warning("%s is full. Compiler has been disabled.", CodeCache::get_code_heap_name(code_blob_type));
- warning("Try increasing the code heap size using -XX:%s=",
- (code_blob_type == CodeBlobType::MethodNonProfiled) ? "NonProfiledCodeHeapSize" : "ProfiledCodeHeapSize");
+ warning("%s is full. Compiler has been disabled.", get_code_heap_name(code_blob_type));
+ warning("Try increasing the code heap size using -XX:%s=", get_code_heap_flag_name(code_blob_type));
} else {
warning("CodeCache is full. Compiler has been disabled.");
warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize=");
--- a/hotspot/src/share/vm/code/codeCache.hpp Thu Oct 16 12:57:04 2014 +0200
+++ b/hotspot/src/share/vm/code/codeCache.hpp Fri Oct 17 08:56:07 2014 +0200
@@ -100,6 +100,8 @@
static void add_heap(ReservedSpace rs, const char* name, size_t size_initial, int code_blob_type);
static CodeHeap* get_code_heap(CodeBlob* cb); // Returns the CodeHeap for the given CodeBlob
static CodeHeap* get_code_heap(int code_blob_type); // Returns the CodeHeap for the given CodeBlobType
+ // Returns the name of the VM option to set the size of the corresponding CodeHeap
+ static const char* get_code_heap_flag_name(int code_blob_type);
static bool heap_available(int code_blob_type); // Returns true if an own CodeHeap for the given CodeBlobType is available
static ReservedCodeSpace reserve_heap_memory(size_t size); // Reserves one continuous chunk of memory for the CodeHeaps