src/share/vm/prims/jvmtiImpl.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8055008_2 Sdiff src/share/vm/prims

src/share/vm/prims/jvmtiImpl.cpp

Print this page




 265 }
 266 
 267 bool JvmtiBreakpoint::equals(JvmtiBreakpoint& bp) {
 268   return _method   == bp._method
 269     &&   _bci      == bp._bci;
 270 }
 271 
 272 bool JvmtiBreakpoint::is_valid() {
 273   // class loader can be NULL
 274   return _method != NULL &&
 275          _bci >= 0;
 276 }
 277 
 278 address JvmtiBreakpoint::getBcp() {
 279   return _method->bcp_from(_bci);
 280 }
 281 
 282 void JvmtiBreakpoint::each_method_version_do(method_action meth_act) {
 283   ((Method*)_method->*meth_act)(_bci);
 284 
 285   // add/remove breakpoint to/from versions of the method that
 286   // are EMCP. Directly or transitively obsolete methods are
 287   // not saved in the PreviousVersionNodes.
 288   Thread *thread = Thread::current();
 289   instanceKlassHandle ikh = instanceKlassHandle(thread, _method->method_holder());
 290   Symbol* m_name = _method->name();
 291   Symbol* m_signature = _method->signature();
 292 
 293   // search previous versions if they exist
 294   PreviousVersionWalker pvw(thread, (InstanceKlass *)ikh());
 295   for (PreviousVersionNode * pv_node = pvw.next_previous_version();
 296        pv_node != NULL; pv_node = pvw.next_previous_version()) {
 297     GrowableArray<Method*>* methods = pv_node->prev_EMCP_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 
 313     for (int i = methods->length() - 1; i >= 0; i--) {
 314       Method* method = methods->at(i);
 315       // obsolete methods that are running are not deleted from
 316       // previous version array, but they are skipped here.
 317       if (!method->is_obsolete() &&
 318           method->name() == m_name &&
 319           method->signature() == m_signature) {
 320         RC_TRACE(0x00000800, ("%sing breakpoint in %s(%s)",
 321           meth_act == &Method::set_breakpoint ? "sett" : "clear",
 322           method->name()->as_C_string(),
 323           method->signature()->as_C_string()));
 324 
 325         (method->*meth_act)(_bci);
 326         break;
 327       }
 328     }
 329   }
 330 }
 331 
 332 void JvmtiBreakpoint::set() {
 333   each_method_version_do(&Method::set_breakpoint);
 334 }
 335 
 336 void JvmtiBreakpoint::clear() {
 337   each_method_version_do(&Method::clear_breakpoint);
 338 }
 339 
 340 void JvmtiBreakpoint::print() {
 341 #ifndef PRODUCT




 265 }
 266 
 267 bool JvmtiBreakpoint::equals(JvmtiBreakpoint& bp) {
 268   return _method   == bp._method
 269     &&   _bci      == bp._bci;
 270 }
 271 
 272 bool JvmtiBreakpoint::is_valid() {
 273   // class loader can be NULL
 274   return _method != NULL &&
 275          _bci >= 0;
 276 }
 277 
 278 address JvmtiBreakpoint::getBcp() {
 279   return _method->bcp_from(_bci);
 280 }
 281 
 282 void JvmtiBreakpoint::each_method_version_do(method_action meth_act) {
 283   ((Method*)_method->*meth_act)(_bci);
 284 
 285   // add/remove breakpoint to/from versions of the method that are EMCP.


 286   Thread *thread = Thread::current();
 287   instanceKlassHandle ikh = instanceKlassHandle(thread, _method->method_holder());
 288   Symbol* m_name = _method->name();
 289   Symbol* m_signature = _method->signature();
 290 
 291   // search previous versions if they exist
 292   for (InstanceKlass* pv_node = ikh->previous_versions();
 293        pv_node != NULL;
 294        pv_node = pv_node->previous_versions()) {
 295     Array<Method*>* methods = pv_node->methods();














 296 
 297     for (int i = methods->length() - 1; i >= 0; i--) {
 298       Method* method = methods->at(i);
 299       // Only set breakpoints in running EMCP methods.
 300       if (method->is_running_emcp() &&

 301           method->name() == m_name &&
 302           method->signature() == m_signature) {
 303         RC_TRACE(0x00000800, ("%sing breakpoint in %s(%s)",
 304           meth_act == &Method::set_breakpoint ? "set" : "clear",
 305           method->name()->as_C_string(),
 306           method->signature()->as_C_string()));
 307 
 308         (method->*meth_act)(_bci);
 309         break;
 310       }
 311     }
 312   }
 313 }
 314 
 315 void JvmtiBreakpoint::set() {
 316   each_method_version_do(&Method::set_breakpoint);
 317 }
 318 
 319 void JvmtiBreakpoint::clear() {
 320   each_method_version_do(&Method::clear_breakpoint);
 321 }
 322 
 323 void JvmtiBreakpoint::print() {
 324 #ifndef PRODUCT


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