hotspot/src/share/vm/prims/jvmtiCodeBlobEvents.cpp
changeset 5929 279fd26a4b68
parent 5913 9dbc3381245b
child 6418 6671edbd230e
equal deleted inserted replaced
5928:f6e69b46e9e3 5929:279fd26a4b68
   116   // enclosing BufferBlobs.
   116   // enclosing BufferBlobs.
   117   address addr = cb->instructions_begin();
   117   address addr = cb->instructions_begin();
   118   for (int i=0; i<_global_code_blobs->length(); i++) {
   118   for (int i=0; i<_global_code_blobs->length(); i++) {
   119     JvmtiCodeBlobDesc* scb = _global_code_blobs->at(i);
   119     JvmtiCodeBlobDesc* scb = _global_code_blobs->at(i);
   120     if (addr == scb->code_begin()) {
   120     if (addr == scb->code_begin()) {
   121       ShouldNotReachHere();
       
   122       return;
   121       return;
   123     }
   122     }
   124   }
   123   }
   125 
   124 
   126   // record the CodeBlob details as a JvmtiCodeBlobDesc
   125   // record the CodeBlob details as a JvmtiCodeBlobDesc
   204   // created nmethod will notify normally and nmethods which are freed
   203   // created nmethod will notify normally and nmethods which are freed
   205   // can be safely skipped.
   204   // can be safely skipped.
   206   MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   205   MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   207   nmethod* current = CodeCache::first_nmethod();
   206   nmethod* current = CodeCache::first_nmethod();
   208   while (current != NULL) {
   207   while (current != NULL) {
   209     // Lock the nmethod so it can't be freed
       
   210     nmethodLocker nml(current);
       
   211 
       
   212     // Only notify for live nmethods
   208     // Only notify for live nmethods
   213     if (current->is_alive()) {
   209     if (current->is_alive()) {
       
   210       // Lock the nmethod so it can't be freed
       
   211       nmethodLocker nml(current);
       
   212 
   214       // Don't hold the lock over the notify or jmethodID creation
   213       // Don't hold the lock over the notify or jmethodID creation
   215       MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   214       MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   216       current->get_and_cache_jmethod_id();
   215       current->get_and_cache_jmethod_id();
   217       JvmtiExport::post_compiled_method_load(current);
   216       JvmtiExport::post_compiled_method_load(current);
   218     }
   217     }