280 } |
280 } |
281 |
281 |
282 void JvmtiBreakpoint::each_method_version_do(method_action meth_act) { |
282 void JvmtiBreakpoint::each_method_version_do(method_action meth_act) { |
283 ((Method*)_method->*meth_act)(_bci); |
283 ((Method*)_method->*meth_act)(_bci); |
284 |
284 |
285 // add/remove breakpoint to/from versions of the method that |
285 // add/remove breakpoint to/from versions of the method that are EMCP. |
286 // are EMCP. Directly or transitively obsolete methods are |
|
287 // not saved in the PreviousVersionNodes. |
|
288 Thread *thread = Thread::current(); |
286 Thread *thread = Thread::current(); |
289 instanceKlassHandle ikh = instanceKlassHandle(thread, _method->method_holder()); |
287 instanceKlassHandle ikh = instanceKlassHandle(thread, _method->method_holder()); |
290 Symbol* m_name = _method->name(); |
288 Symbol* m_name = _method->name(); |
291 Symbol* m_signature = _method->signature(); |
289 Symbol* m_signature = _method->signature(); |
292 |
290 |
293 // search previous versions if they exist |
291 // search previous versions if they exist |
294 PreviousVersionWalker pvw(thread, (InstanceKlass *)ikh()); |
292 for (InstanceKlass* pv_node = ikh->previous_versions(); |
295 for (PreviousVersionNode * pv_node = pvw.next_previous_version(); |
293 pv_node != NULL; |
296 pv_node != NULL; pv_node = pvw.next_previous_version()) { |
294 pv_node = pv_node->previous_versions()) { |
297 GrowableArray<Method*>* methods = pv_node->prev_EMCP_methods(); |
295 Array<Method*>* methods = pv_node->methods(); |
298 |
|
299 if (methods == NULL) { |
|
300 // We have run into a PreviousVersion generation where |
|
301 // all methods were made obsolete during that generation's |
|
302 // RedefineClasses() operation. At the time of that |
|
303 // operation, all EMCP methods were flushed so we don't |
|
304 // have to go back any further. |
|
305 // |
|
306 // A NULL methods array is different than an empty methods |
|
307 // array. We cannot infer any optimizations about older |
|
308 // generations from an empty methods array for the current |
|
309 // generation. |
|
310 break; |
|
311 } |
|
312 |
296 |
313 for (int i = methods->length() - 1; i >= 0; i--) { |
297 for (int i = methods->length() - 1; i >= 0; i--) { |
314 Method* method = methods->at(i); |
298 Method* method = methods->at(i); |
315 // obsolete methods that are running are not deleted from |
299 // Only set breakpoints in running EMCP methods. |
316 // previous version array, but they are skipped here. |
300 if (method->is_running_emcp() && |
317 if (!method->is_obsolete() && |
|
318 method->name() == m_name && |
301 method->name() == m_name && |
319 method->signature() == m_signature) { |
302 method->signature() == m_signature) { |
320 RC_TRACE(0x00000800, ("%sing breakpoint in %s(%s)", |
303 RC_TRACE(0x00000800, ("%sing breakpoint in %s(%s)", |
321 meth_act == &Method::set_breakpoint ? "sett" : "clear", |
304 meth_act == &Method::set_breakpoint ? "sett" : "clear", |
322 method->name()->as_C_string(), |
305 method->name()->as_C_string(), |