comparison src/share/vm/prims/jvmtiCodeBlobEvents.cpp @ 1649:a528509c992b

6968336: VM crash guarantee(!nm->is_zombie()) failed: cannot lock a zombie method Reviewed-by: twisti
author never
date Thu, 15 Jul 2010 08:54:48 -0700
parents 65b0c03b165d
children 3e8fbc61cee8
comparison
equal deleted inserted replaced
1648:8099e71601df 1649:a528509c992b
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 }