133 oop obj = monitor->owner(); |
133 oop obj = monitor->owner(); |
134 if (obj == NULL) continue; // skip unowned monitor |
134 if (obj == NULL) continue; // skip unowned monitor |
135 // |
135 // |
136 // Skip the monitor that the thread is blocked to enter or waiting on |
136 // Skip the monitor that the thread is blocked to enter or waiting on |
137 // |
137 // |
138 if (!found_first_monitor && (oopDesc::equals(obj, pending_obj) || oopDesc::equals(obj, waiting_obj))) { |
138 if (!found_first_monitor && (obj == pending_obj || obj == waiting_obj)) { |
139 continue; |
139 continue; |
140 } |
140 } |
141 found_first_monitor = true; |
141 found_first_monitor = true; |
142 result->append(monitor); |
142 result->append(monitor); |
143 } |
143 } |
209 for (int index = (mons->length()-1); index >= 0; index--) { |
209 for (int index = (mons->length()-1); index >= 0; index--) { |
210 MonitorInfo* monitor = mons->at(index); |
210 MonitorInfo* monitor = mons->at(index); |
211 if (monitor->eliminated() && is_compiled_frame()) { // Eliminated in compiled code |
211 if (monitor->eliminated() && is_compiled_frame()) { // Eliminated in compiled code |
212 if (monitor->owner_is_scalar_replaced()) { |
212 if (monitor->owner_is_scalar_replaced()) { |
213 Klass* k = java_lang_Class::as_Klass(monitor->owner_klass()); |
213 Klass* k = java_lang_Class::as_Klass(monitor->owner_klass()); |
214 // format below for lockbits matches this one. |
|
215 st->print("\t- eliminated <owner is scalar replaced> (a %s)", k->external_name()); |
214 st->print("\t- eliminated <owner is scalar replaced> (a %s)", k->external_name()); |
216 } else { |
215 } else { |
217 Handle obj(THREAD, monitor->owner()); |
216 Handle obj(THREAD, monitor->owner()); |
218 if (obj() != NULL) { |
217 if (obj() != NULL) { |
219 print_locked_object_class_name(st, obj, "eliminated"); |
218 print_locked_object_class_name(st, obj, "eliminated"); |
222 continue; |
221 continue; |
223 } |
222 } |
224 if (monitor->owner() != NULL) { |
223 if (monitor->owner() != NULL) { |
225 // the monitor is associated with an object, i.e., it is locked |
224 // the monitor is associated with an object, i.e., it is locked |
226 |
225 |
227 markOop mark = NULL; |
|
228 const char *lock_state = "locked"; // assume we have the monitor locked |
226 const char *lock_state = "locked"; // assume we have the monitor locked |
229 if (!found_first_monitor && frame_count == 0) { |
227 if (!found_first_monitor && frame_count == 0) { |
230 // If this is the first frame and we haven't found an owned |
228 // If this is the first frame and we haven't found an owned |
231 // monitor before, then we need to see if we have completed |
229 // monitor before, then we need to see if we have completed |
232 // the lock or if we are blocked trying to acquire it. Only |
230 // the lock or if we are blocked trying to acquire it. Only |
233 // an inflated monitor that is first on the monitor list in |
231 // an inflated monitor that is first on the monitor list in |
234 // the first frame can block us on a monitor enter. |
232 // the first frame can block us on a monitor enter. |
235 mark = monitor->owner()->mark(); |
233 markWord mark = monitor->owner()->mark(); |
236 if (mark->has_monitor() && |
234 if (mark.has_monitor() && |
237 ( // we have marked ourself as pending on this monitor |
235 ( // we have marked ourself as pending on this monitor |
238 mark->monitor() == thread()->current_pending_monitor() || |
236 mark.monitor() == thread()->current_pending_monitor() || |
239 // we are not the owner of this monitor |
237 // we are not the owner of this monitor |
240 !mark->monitor()->is_entered(thread()) |
238 !mark.monitor()->is_entered(thread()) |
241 )) { |
239 )) { |
242 lock_state = "waiting to lock"; |
240 lock_state = "waiting to lock"; |
243 } else { |
|
244 // We own the monitor which is not as interesting so |
|
245 // disable the extra printing below. |
|
246 mark = NULL; |
|
247 } |
241 } |
248 } |
242 } |
249 print_locked_object_class_name(st, Handle(THREAD, monitor->owner()), lock_state); |
243 print_locked_object_class_name(st, Handle(THREAD, monitor->owner()), lock_state); |
250 |
244 |
251 found_first_monitor = true; |
245 found_first_monitor = true; |