215 |
215 |
216 // Support class to describe a nmethod in the CodeCache |
216 // Support class to describe a nmethod in the CodeCache |
217 |
217 |
218 class nmethodDesc: public CHeapObj { |
218 class nmethodDesc: public CHeapObj { |
219 private: |
219 private: |
220 methodHandle _method; |
220 jmethodID _jmethod_id; |
221 address _code_begin; |
221 address _code_begin; |
222 address _code_end; |
222 address _code_end; |
223 jvmtiAddrLocationMap* _map; |
223 jvmtiAddrLocationMap* _map; |
224 jint _map_length; |
224 jint _map_length; |
225 public: |
225 public: |
226 nmethodDesc(methodHandle method, address code_begin, address code_end, |
226 nmethodDesc(jmethodID jmethod_id, address code_begin, address code_end, |
227 jvmtiAddrLocationMap* map, jint map_length) { |
227 jvmtiAddrLocationMap* map, jint map_length) { |
228 _method = method; |
228 _jmethod_id = jmethod_id; |
229 _code_begin = code_begin; |
229 _code_begin = code_begin; |
230 _code_end = code_end; |
230 _code_end = code_end; |
231 _map = map; |
231 _map = map; |
232 _map_length = map_length; |
232 _map_length = map_length; |
233 } |
233 } |
234 methodHandle method() const { return _method; } |
234 jmethodID jmethod_id() const { return _jmethod_id; } |
235 address code_begin() const { return _code_begin; } |
235 address code_begin() const { return _code_begin; } |
236 address code_end() const { return _code_end; } |
236 address code_end() const { return _code_end; } |
237 jvmtiAddrLocationMap* map() const { return _map; } |
237 jvmtiAddrLocationMap* map() const { return _map; } |
238 jint map_length() const { return _map_length; } |
238 jint map_length() const { return _map_length; } |
239 }; |
239 }; |
321 jvmtiAddrLocationMap* map; |
321 jvmtiAddrLocationMap* map; |
322 jint map_length; |
322 jint map_length; |
323 JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nm, &map, &map_length); |
323 JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nm, &map, &map_length); |
324 |
324 |
325 // record the nmethod details |
325 // record the nmethod details |
326 methodHandle mh(nm->method()); |
326 nmethodDesc* snm = new nmethodDesc(nm->get_and_cache_jmethod_id(), |
327 nmethodDesc* snm = new nmethodDesc(mh, |
|
328 nm->code_begin(), |
327 nm->code_begin(), |
329 nm->code_end(), |
328 nm->code_end(), |
330 map, |
329 map, |
331 map_length); |
330 map_length); |
332 _global_nmethods->append(snm); |
331 _global_nmethods->append(snm); |
365 } |
364 } |
366 |
365 |
367 // iterate over the list and post an event for each nmethod |
366 // iterate over the list and post an event for each nmethod |
368 nmethodDesc* nm_desc = collector.first(); |
367 nmethodDesc* nm_desc = collector.first(); |
369 while (nm_desc != NULL) { |
368 while (nm_desc != NULL) { |
370 methodOop method = nm_desc->method()(); |
369 jmethodID mid = nm_desc->jmethod_id(); |
371 jmethodID mid = method->jmethod_id(); |
|
372 assert(mid != NULL, "checking"); |
370 assert(mid != NULL, "checking"); |
373 JvmtiExport::post_compiled_method_load(env, mid, |
371 JvmtiExport::post_compiled_method_load(env, mid, |
374 (jint)(nm_desc->code_end() - nm_desc->code_begin()), |
372 (jint)(nm_desc->code_end() - nm_desc->code_begin()), |
375 nm_desc->code_begin(), nm_desc->map_length(), |
373 nm_desc->code_begin(), nm_desc->map_length(), |
376 nm_desc->map()); |
374 nm_desc->map()); |