--- a/hotspot/src/share/vm/runtime/vframe.cpp Thu May 29 08:58:51 2014 -0400
+++ b/hotspot/src/share/vm/runtime/vframe.cpp Fri May 30 07:20:51 2014 -0700
@@ -199,6 +199,7 @@
continue;
}
if (monitor->owner() != NULL) {
+ // the monitor is associated with an object, i.e., it is locked
// First, assume we have the monitor locked. If we haven't found an
// owned monitor before and this is the first frame, then we need to
@@ -209,7 +210,11 @@
if (!found_first_monitor && frame_count == 0) {
markOop mark = monitor->owner()->mark();
if (mark->has_monitor() &&
- mark->monitor() == thread()->current_pending_monitor()) {
+ ( // we have marked ourself as pending on this monitor
+ mark->monitor() == thread()->current_pending_monitor() ||
+ // we are not the owner of this monitor
+ !mark->monitor()->is_entered(thread())
+ )) {
lock_state = "waiting to lock";
}
}