8172286: CodeCacheFlushing message should be shown in UL
authorysuenaga
Tue, 14 Feb 2017 19:16:46 -0800
changeset 46269 7e725659ea12
parent 46268 cb4459e22f7a
child 46270 2e7898927798
8172286: CodeCacheFlushing message should be shown in UL Reviewed-by: kvn
hotspot/src/share/vm/code/codeCache.cpp
hotspot/src/share/vm/logging/logTag.hpp
hotspot/src/share/vm/runtime/sweeper.cpp
--- a/hotspot/src/share/vm/code/codeCache.cpp	Tue Feb 14 11:26:27 2017 -0500
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Tue Feb 14 19:16:46 2017 -0800
@@ -1309,6 +1309,8 @@
 }
 
 // A CodeHeap is full. Print out warning and report event.
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED
 void CodeCache::report_codemem_full(int code_blob_type, bool print) {
   // Get nmethod heap for the given CodeBlobType and build CodeCacheFull event
   CodeHeap* heap = get_code_heap(code_blob_type);
@@ -1317,11 +1319,27 @@
   if ((heap->full_count() == 0) || print) {
     // Not yet reported for this heap, report
     if (SegmentedCodeCache) {
-      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));
+      ResourceMark rm;
+      stringStream msg1_stream, msg2_stream;
+      msg1_stream.print("%s is full. Compiler has been disabled.",
+                        get_code_heap_name(code_blob_type));
+      msg2_stream.print("Try increasing the code heap size using -XX:%s=",
+                 get_code_heap_flag_name(code_blob_type));
+      const char *msg1 = msg1_stream.as_string();
+      const char *msg2 = msg2_stream.as_string();
+
+      log_warning(codecache)(msg1);
+      log_warning(codecache)(msg2);
+      warning(msg1);
+      warning(msg2);
     } else {
-      warning("CodeCache is full. Compiler has been disabled.");
-      warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize=");
+      const char *msg1 = "CodeCache is full. Compiler has been disabled.";
+      const char *msg2 = "Try increasing the code cache size using -XX:ReservedCodeCacheSize=";
+
+      log_warning(codecache)(msg1);
+      log_warning(codecache)(msg2);
+      warning(msg1);
+      warning(msg2);
     }
     ResourceMark rm;
     stringStream s;
@@ -1350,6 +1368,7 @@
     event.commit();
   }
 }
+PRAGMA_DIAG_POP
 
 void CodeCache::print_memory_overhead() {
   size_t wasted_bytes = 0;
--- a/hotspot/src/share/vm/logging/logTag.hpp	Tue Feb 14 11:26:27 2017 -0500
+++ b/hotspot/src/share/vm/logging/logTag.hpp	Tue Feb 14 19:16:46 2017 -0800
@@ -48,6 +48,7 @@
   LOG_TAG(class) \
   LOG_TAG(classhisto) \
   LOG_TAG(cleanup) \
+  LOG_TAG(codecache) \
   LOG_TAG(compaction) \
   LOG_TAG(constraints) \
   LOG_TAG(constantpool) \
--- a/hotspot/src/share/vm/runtime/sweeper.cpp	Tue Feb 14 11:26:27 2017 -0500
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp	Tue Feb 14 19:16:46 2017 -0800
@@ -403,6 +403,8 @@
   ResourceMark rm;
   Ticks sweep_start_counter = Ticks::now();
 
+  log_debug(codecache, sweep, start)("CodeCache flushing");
+
   int flushed_count                = 0;
   int zombified_count              = 0;
   int flushed_c2_count     = 0;
@@ -500,6 +502,10 @@
   }
 #endif
 
+  Log(codecache, sweep) log;
+  if (log.is_debug()) {
+    CodeCache::print_summary(log.debug_stream(), false);
+  }
   log_sweep("finished");
 
   // Sweeper is the only case where memory is released, check here if it
@@ -513,6 +519,7 @@
   // cache. As a result, 'freed_memory' > 0 to restart the compiler.
   if (!CompileBroker::should_compile_new_jobs() && (freed_memory > 0)) {
     CompileBroker::set_should_compile_new_jobs(CompileBroker::run_compilation);
+    log.debug("restart compiler");
     log_sweep("restart_compiler");
   }
 }