--- old/src/share/vm/compiler/compileBroker.cpp 2014-04-14 10:01:23.835015792 +0200 +++ new/src/share/vm/compiler/compileBroker.cpp 2014-04-14 10:01:22.907015757 +0200 @@ -1585,7 +1585,7 @@ // Free buffer blob, if allocated if (thread->get_buffer_blob() != NULL) { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); - CodeCache::free(thread->get_buffer_blob()); + CodeCache::free(thread->get_buffer_blob(), CodeBlobType::NonMethod); } if (comp->should_perform_shutdown()) { @@ -1669,9 +1669,12 @@ // We need this HandleMark to avoid leaking VM handles. HandleMark hm(thread); - if (CodeCache::unallocated_capacity() < CodeCacheMinimumFreeSpace) { - // the code cache is really full - handle_full_code_cache(); + // Iterate over non-profiled and profiled nmethods + for (int code_blob_type = CodeBlobType::MethodNonProfiled; code_blob_type <= CodeBlobType::MethodProfiled; ++code_blob_type) { + if (CodeCache::is_full(code_blob_type)) { + // The CodeHeap for CodeBlobType is really full + handle_full_code_cache(code_blob_type); + } } CompileTask* task = queue->get(); @@ -1999,7 +2002,7 @@ * The CodeCache is full. Print out warning and disable compilation * or try code cache cleaning so compilation can continue later. */ -void CompileBroker::handle_full_code_cache() { +void CompileBroker::handle_full_code_cache(int code_blob_type) { UseInterpreter = true; if (UseCompiler || AlwaysCompileLoopMethods ) { if (xtty != NULL) { @@ -2016,8 +2019,6 @@ xtty->end_elem(); } - CodeCache::report_codemem_full(); - #ifndef PRODUCT if (CompileTheWorld || ExitOnFullCodeCache) { codecache_print(/* detailed= */ true); @@ -2039,12 +2040,7 @@ disable_compilation_forever(); } - // Print warning only once - if (should_print_compiler_warning()) { - warning("CodeCache is full. Compiler has been disabled."); - warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize="); - codecache_print(/* detailed= */ true); - } + CodeCache::report_codemem_full(code_blob_type, should_print_compiler_warning()); } }