210 // iterate over the collected list and post an event for each blob
211 JvmtiCodeBlobDesc* blob = collector.first();
212 while (blob != NULL) {
213 JvmtiExport::post_dynamic_code_generated(env, blob->name(), blob->code_begin(), blob->code_end());
214 blob = collector.next();
215 }
216 return JVMTI_ERROR_NONE;
217 }
218
219
220 // Generate a COMPILED_METHOD_LOAD event for each nnmethod
221 jvmtiError JvmtiCodeBlobEvents::generate_compiled_method_load_events(JvmtiEnv* env) {
222 HandleMark hm;
223
224 // Walk the CodeCache notifying for live nmethods. The code cache
225 // may be changing while this is happening which is ok since newly
226 // created nmethod will notify normally and nmethods which are freed
227 // can be safely skipped.
228 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
229 // Iterate over non-profiled and profiled nmethods
230 NMethodIterator iter;
231 while(iter.next_alive()) {
232 nmethod* current = iter.method();
233 // Lock the nmethod so it can't be freed
234 nmethodLocker nml(current);
235
236 // Don't hold the lock over the notify or jmethodID creation
237 MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
238 current->get_and_cache_jmethod_id();
239 JvmtiExport::post_compiled_method_load(current);
240 }
241 return JVMTI_ERROR_NONE;
242 }
243
244
245 // create a C-heap allocated address location map for an nmethod
246 void JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nmethod *nm,
247 jvmtiAddrLocationMap** map_ptr,
248 jint *map_length_ptr)
249 {
250 ResourceMark rm;
|
210 // iterate over the collected list and post an event for each blob
211 JvmtiCodeBlobDesc* blob = collector.first();
212 while (blob != NULL) {
213 JvmtiExport::post_dynamic_code_generated(env, blob->name(), blob->code_begin(), blob->code_end());
214 blob = collector.next();
215 }
216 return JVMTI_ERROR_NONE;
217 }
218
219
220 // Generate a COMPILED_METHOD_LOAD event for each nnmethod
221 jvmtiError JvmtiCodeBlobEvents::generate_compiled_method_load_events(JvmtiEnv* env) {
222 HandleMark hm;
223
224 // Walk the CodeCache notifying for live nmethods. The code cache
225 // may be changing while this is happening which is ok since newly
226 // created nmethod will notify normally and nmethods which are freed
227 // can be safely skipped.
228 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
229 // Iterate over non-profiled and profiled nmethods
230 NMethodIterator iter(true /* only_alive */, true /* only_not_unloading */);
231 while(iter.next()) {
232 nmethod* current = iter.method();
233 // Lock the nmethod so it can't be freed
234 nmethodLocker nml(current);
235
236 // Don't hold the lock over the notify or jmethodID creation
237 MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
238 current->get_and_cache_jmethod_id();
239 JvmtiExport::post_compiled_method_load(current);
240 }
241 return JVMTI_ERROR_NONE;
242 }
243
244
245 // create a C-heap allocated address location map for an nmethod
246 void JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nmethod *nm,
247 jvmtiAddrLocationMap** map_ptr,
248 jint *map_length_ptr)
249 {
250 ResourceMark rm;
|