< prev index next >

src/share/vm/services/threadService.cpp

Print this page




 580     // Iterate inflated monitors and find monitors locked by this thread
 581     // not found in the stack
 582     InflatedMonitorsClosure imc(_thread, this);
 583     ObjectSynchronizer::monitors_iterate(&imc);
 584   }
 585 }
 586 
 587 
 588 bool ThreadStackTrace::is_owned_monitor_on_stack(oop object) {
 589   assert(SafepointSynchronize::is_at_safepoint(), "all threads are stopped");
 590 
 591   bool found = false;
 592   int num_frames = get_stack_depth();
 593   for (int depth = 0; depth < num_frames; depth++) {
 594     StackFrameInfo* frame = stack_frame_at(depth);
 595     int len = frame->num_locked_monitors();
 596     GrowableArray<oop>* locked_monitors = frame->locked_monitors();
 597     for (int j = 0; j < len; j++) {
 598       oop monitor = locked_monitors->at(j);
 599       assert(monitor != NULL && monitor->is_instance(), "must be a Java object");
 600       if (monitor == object) {
 601         found = true;
 602         break;
 603       }
 604     }
 605   }
 606   return found;
 607 }
 608 
 609 Handle ThreadStackTrace::allocate_fill_stack_trace_element_array(TRAPS) {
 610   Klass* k = SystemDictionary::StackTraceElement_klass();
 611   assert(k != NULL, "must be loaded in 1.4+");
 612   instanceKlassHandle ik(THREAD, k);
 613 
 614   // Allocate an array of java/lang/StackTraceElement object
 615   objArrayOop ste = oopFactory::new_objArray(ik(), _depth, CHECK_NH);
 616   objArrayHandle backtrace(THREAD, ste);
 617   for (int j = 0; j < _depth; j++) {
 618     StackFrameInfo* frame = _frames->at(j);
 619     methodHandle mh(THREAD, frame->method());
 620     oop element = java_lang_StackTraceElement::create(mh, frame->bci(), CHECK_NH);




 580     // Iterate inflated monitors and find monitors locked by this thread
 581     // not found in the stack
 582     InflatedMonitorsClosure imc(_thread, this);
 583     ObjectSynchronizer::monitors_iterate(&imc);
 584   }
 585 }
 586 
 587 
 588 bool ThreadStackTrace::is_owned_monitor_on_stack(oop object) {
 589   assert(SafepointSynchronize::is_at_safepoint(), "all threads are stopped");
 590 
 591   bool found = false;
 592   int num_frames = get_stack_depth();
 593   for (int depth = 0; depth < num_frames; depth++) {
 594     StackFrameInfo* frame = stack_frame_at(depth);
 595     int len = frame->num_locked_monitors();
 596     GrowableArray<oop>* locked_monitors = frame->locked_monitors();
 597     for (int j = 0; j < len; j++) {
 598       oop monitor = locked_monitors->at(j);
 599       assert(monitor != NULL && monitor->is_instance(), "must be a Java object");
 600       if (oopDesc::equals(monitor, object)) {
 601         found = true;
 602         break;
 603       }
 604     }
 605   }
 606   return found;
 607 }
 608 
 609 Handle ThreadStackTrace::allocate_fill_stack_trace_element_array(TRAPS) {
 610   Klass* k = SystemDictionary::StackTraceElement_klass();
 611   assert(k != NULL, "must be loaded in 1.4+");
 612   instanceKlassHandle ik(THREAD, k);
 613 
 614   // Allocate an array of java/lang/StackTraceElement object
 615   objArrayOop ste = oopFactory::new_objArray(ik(), _depth, CHECK_NH);
 616   objArrayHandle backtrace(THREAD, ste);
 617   for (int j = 0; j < _depth; j++) {
 618     StackFrameInfo* frame = _frames->at(j);
 619     methodHandle mh(THREAD, frame->method());
 620     oop element = java_lang_StackTraceElement::create(mh, frame->bci(), CHECK_NH);


< prev index next >