diff --git a/src/hotspot/share/code/nmethod.cpp b/src/hotspot/share/code/nmethod.cpp index 83afc02cdfc..d82e31fd855 100644 --- a/src/hotspot/share/code/nmethod.cpp +++ b/src/hotspot/share/code/nmethod.cpp @@ -2143,10 +2143,19 @@ void nmethod::purge(bool unregister_nmethod) { // completely deallocate this method Events::log_nmethod_flush(Thread::current(), "flushing %s nmethod " INTPTR_FORMAT, is_osr_method() ? "osr" : "", p2i(this)); - log_debug(codecache)("*flushing %s nmethod %3d/" INTPTR_FORMAT ". Live blobs:" UINT32_FORMAT - "/Free CodeCache:%zuKb", - is_osr_method() ? "osr" : "",_compile_id, p2i(this), CodeCache::blob_count(), - CodeCache::unallocated_capacity(CodeCache::get_code_blob_type(this))/1024); + + LogTarget(Debug, codecache) lt; + if (lt.is_enabled()) { + ResourceMark rm; + LogStream ls(lt); + const char* method_name = method()->name()->as_C_string(); + const size_t codecache_capacity = CodeCache::capacity()/1024; + const size_t codecache_free_space = CodeCache::unallocated_capacity(CodeCache::get_code_blob_type(this))/1024; + ls.print("Flushing nmethod %6d/" INTPTR_FORMAT ", level=%d, osr=%d, cold=%d, epoch=" UINT64_FORMAT ", cold_count=" UINT64_FORMAT ". " + "Cache capacity: %zuKb, free space: %zuKb. method %s (%s)", + _compile_id, p2i(this), _comp_level, is_osr_method(), is_cold(), _gc_epoch, CodeCache::cold_gc_count(), + codecache_capacity, codecache_free_space, method_name, compiler_name()); + } // We need to deallocate any ExceptionCache data. // Note that we do not need to grab the nmethod lock for this, it