Mercurial > hg > truffle
diff src/share/vm/runtime/vframe.cpp @ 17965:4a1062dc52d1
8036823: Stack trace sometimes shows 'locked' instead of 'waiting to lock'
Summary: Add a !owner check for 'waiting to lock' to catch current_pending_monitor corner cases.
Reviewed-by: dholmes, sspitsyn, kmo, zgu
Contributed-by: rednaxelafx@gmail.com, zhengyu.gu@oracle.com, daniel.daugherty@oracle.com
author | dcubed |
---|---|
date | Wed, 04 Jun 2014 06:25:53 -0700 |
parents | 78bbf4d43a14 |
children | 52b4284cb496 c204e2044c29 |
line wrap: on
line diff
--- a/src/share/vm/runtime/vframe.cpp Fri May 30 10:43:51 2014 +0200 +++ b/src/share/vm/runtime/vframe.cpp Wed Jun 04 06:25:53 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"; } }