--- old/src/share/vm/code/codeCache.cpp 2017-01-05 21:28:52.419413209 +0900 +++ new/src/share/vm/code/codeCache.cpp 2017-01-05 21:28:52.328413817 +0900 @@ -1310,6 +1310,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); @@ -1318,11 +1320,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; @@ -1351,6 +1369,7 @@ event.commit(); } } +PRAGMA_DIAG_POP void CodeCache::print_memory_overhead() { size_t wasted_bytes = 0; --- old/src/share/vm/logging/logTag.hpp 2017-01-05 21:28:52.771410858 +0900 +++ new/src/share/vm/logging/logTag.hpp 2017-01-05 21:28:52.682411452 +0900 @@ -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) \ --- old/src/share/vm/runtime/sweeper.cpp 2017-01-05 21:28:53.116408553 +0900 +++ new/src/share/vm/runtime/sweeper.cpp 2017-01-05 21:28:53.025409161 +0900 @@ -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"); } }