--- old/src/share/vm/prims/jvmtiCodeBlobEvents.cpp 2014-04-14 10:01:24.947015832 +0200 +++ new/src/share/vm/prims/jvmtiCodeBlobEvents.cpp 2014-04-14 10:01:24.379015811 +0200 @@ -228,10 +228,11 @@ // created nmethod will notify normally and nmethods which are freed // can be safely skipped. MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); - nmethod* current = CodeCache::first_nmethod(); - while (current != NULL) { + // Iterate over non-profiled and profiled nmethods + for (int code_blob_type = CodeBlobType::MethodNonProfiled; code_blob_type <= CodeBlobType::MethodProfiled; ++code_blob_type) { // Only notify for live nmethods - if (current->is_alive()) { + nmethod* current = (nmethod*) CodeCache::first_alive_blob(code_blob_type); + while (current != NULL) { // Lock the nmethod so it can't be freed nmethodLocker nml(current); @@ -239,8 +240,9 @@ MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); current->get_and_cache_jmethod_id(); JvmtiExport::post_compiled_method_load(current); + + current = (nmethod*) CodeCache::next_alive_blob(current, code_blob_type); } - current = CodeCache::next_nmethod(current); } return JVMTI_ERROR_NONE; }