src/share/vm/prims/jvmtiCodeBlobEvents.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8015774 Sdiff src/share/vm/prims

src/share/vm/prims/jvmtiCodeBlobEvents.cpp

Print this page




 211 
 212   // iterate over the collected list and post an event for each blob
 213   JvmtiCodeBlobDesc* blob = collector.first();
 214   while (blob != NULL) {
 215     JvmtiExport::post_dynamic_code_generated(env, blob->name(), blob->code_begin(), blob->code_end());
 216     blob = collector.next();
 217   }
 218   return JVMTI_ERROR_NONE;
 219 }
 220 
 221 
 222 // Generate a COMPILED_METHOD_LOAD event for each nnmethod
 223 jvmtiError JvmtiCodeBlobEvents::generate_compiled_method_load_events(JvmtiEnv* env) {
 224   HandleMark hm;
 225 
 226   // Walk the CodeCache notifying for live nmethods.  The code cache
 227   // may be changing while this is happening which is ok since newly
 228   // created nmethod will notify normally and nmethods which are freed
 229   // can be safely skipped.
 230   MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 231   nmethod* current = CodeCache::first_nmethod();
 232   while (current != NULL) {
 233     // Only notify for live nmethods
 234     if (current->is_alive()) {

 235       // Lock the nmethod so it can't be freed
 236       nmethodLocker nml(current);
 237 
 238       // Don't hold the lock over the notify or jmethodID creation
 239       MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 240       current->get_and_cache_jmethod_id();
 241       JvmtiExport::post_compiled_method_load(current);


 242     }
 243     current = CodeCache::next_nmethod(current);
 244   }
 245   return JVMTI_ERROR_NONE;
 246 }
 247 
 248 
 249 // create a C-heap allocated address location map for an nmethod
 250 void JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nmethod *nm,
 251                                                         jvmtiAddrLocationMap** map_ptr,
 252                                                         jint *map_length_ptr)
 253 {
 254   ResourceMark rm;
 255   jvmtiAddrLocationMap* map = NULL;
 256   jint map_length = 0;
 257 
 258 
 259   // Generate line numbers using PcDesc and ScopeDesc info
 260   methodHandle mh(nm->method());
 261 
 262   if (!mh->is_native()) {
 263     PcDesc *pcd;




 211 
 212   // iterate over the collected list and post an event for each blob
 213   JvmtiCodeBlobDesc* blob = collector.first();
 214   while (blob != NULL) {
 215     JvmtiExport::post_dynamic_code_generated(env, blob->name(), blob->code_begin(), blob->code_end());
 216     blob = collector.next();
 217   }
 218   return JVMTI_ERROR_NONE;
 219 }
 220 
 221 
 222 // Generate a COMPILED_METHOD_LOAD event for each nnmethod
 223 jvmtiError JvmtiCodeBlobEvents::generate_compiled_method_load_events(JvmtiEnv* env) {
 224   HandleMark hm;
 225 
 226   // Walk the CodeCache notifying for live nmethods.  The code cache
 227   // may be changing while this is happening which is ok since newly
 228   // created nmethod will notify normally and nmethods which are freed
 229   // can be safely skipped.
 230   MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 231   // Iterate over non-profiled and profiled nmethods
 232   for (int code_blob_type = CodeBlobType::MethodNonProfiled; code_blob_type <= CodeBlobType::MethodProfiled; ++code_blob_type) {
 233     // Only notify for live nmethods
 234     nmethod* current = (nmethod*) CodeCache::first_alive_blob(code_blob_type);
 235     while (current != NULL) {
 236       // Lock the nmethod so it can't be freed
 237       nmethodLocker nml(current);
 238 
 239       // Don't hold the lock over the notify or jmethodID creation
 240       MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 241       current->get_and_cache_jmethod_id();
 242       JvmtiExport::post_compiled_method_load(current);
 243 
 244       current = (nmethod*) CodeCache::next_alive_blob(current, code_blob_type);
 245     }

 246   }
 247   return JVMTI_ERROR_NONE;
 248 }
 249 
 250 
 251 // create a C-heap allocated address location map for an nmethod
 252 void JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nmethod *nm,
 253                                                         jvmtiAddrLocationMap** map_ptr,
 254                                                         jint *map_length_ptr)
 255 {
 256   ResourceMark rm;
 257   jvmtiAddrLocationMap* map = NULL;
 258   jint map_length = 0;
 259 
 260 
 261   // Generate line numbers using PcDesc and ScopeDesc info
 262   methodHandle mh(nm->method());
 263 
 264   if (!mh->is_native()) {
 265     PcDesc *pcd;


src/share/vm/prims/jvmtiCodeBlobEvents.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File