1.1 --- a/src/share/vm/compiler/compileBroker.cpp Wed Nov 20 11:08:09 2013 -0800 1.2 +++ b/src/share/vm/compiler/compileBroker.cpp Thu Nov 21 12:30:35 2013 -0800 1.3 @@ -126,6 +126,7 @@ 1.4 1.5 bool CompileBroker::_initialized = false; 1.6 volatile bool CompileBroker::_should_block = false; 1.7 +volatile jint CompileBroker::_print_compilation_warning = 0; 1.8 volatile jint CompileBroker::_should_compile_new_jobs = run_compilation; 1.9 1.10 // The installed compiler(s) 1.11 @@ -2027,11 +2028,10 @@ 1.12 #endif 1.13 } 1.14 1.15 -// ------------------------------------------------------------------ 1.16 -// CompileBroker::handle_full_code_cache 1.17 -// 1.18 -// The CodeCache is full. Print out warning and disable compilation or 1.19 -// try code cache cleaning so compilation can continue later. 1.20 +/** 1.21 + * The CodeCache is full. Print out warning and disable compilation 1.22 + * or try code cache cleaning so compilation can continue later. 1.23 + */ 1.24 void CompileBroker::handle_full_code_cache() { 1.25 UseInterpreter = true; 1.26 if (UseCompiler || AlwaysCompileLoopMethods ) { 1.27 @@ -2048,12 +2048,9 @@ 1.28 xtty->stamp(); 1.29 xtty->end_elem(); 1.30 } 1.31 - warning("CodeCache is full. Compiler has been disabled."); 1.32 - warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize="); 1.33 1.34 CodeCache::report_codemem_full(); 1.35 1.36 - 1.37 #ifndef PRODUCT 1.38 if (CompileTheWorld || ExitOnFullCodeCache) { 1.39 codecache_print(/* detailed= */ true); 1.40 @@ -2066,17 +2063,22 @@ 1.41 // Since code cache is full, immediately stop new compiles 1.42 if (CompileBroker::set_should_compile_new_jobs(CompileBroker::stop_compilation)) { 1.43 NMethodSweeper::log_sweep("disable_compiler"); 1.44 - 1.45 - // Switch to 'vm_state'. This ensures that possibly_sweep() can be called 1.46 - // without having to consider the state in which the current thread is. 1.47 - ThreadInVMfromUnknown in_vm; 1.48 - NMethodSweeper::possibly_sweep(); 1.49 } 1.50 + // Switch to 'vm_state'. This ensures that possibly_sweep() can be called 1.51 + // without having to consider the state in which the current thread is. 1.52 + ThreadInVMfromUnknown in_vm; 1.53 + NMethodSweeper::possibly_sweep(); 1.54 } else { 1.55 disable_compilation_forever(); 1.56 } 1.57 + 1.58 + // Print warning only once 1.59 + if (should_print_compiler_warning()) { 1.60 + warning("CodeCache is full. Compiler has been disabled."); 1.61 + warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize="); 1.62 + codecache_print(/* detailed= */ true); 1.63 + } 1.64 } 1.65 - codecache_print(/* detailed= */ true); 1.66 } 1.67 1.68 // ------------------------------------------------------------------