Mercurial > hg > truffle
diff agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java @ 702:b9fba36710f2
6699669: Hotspot server leaves synchronized block with monitor in bad state
Summary: Remove usage of _highest_lock field in Thread so that is_lock_owned won't depend on the correct update of that field.
Reviewed-by: never, dice, acorn
author | xlu |
---|---|
date | Mon, 06 Apr 2009 15:47:39 -0700 |
parents | a61af66fc99e |
children | bd02caa94611 |
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java Fri Apr 03 15:59:19 2009 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java Mon Apr 06 15:47:39 2009 -0700 @@ -164,20 +164,11 @@ } } - long leastDiff = 0; - boolean leastDiffInitialized = false; - JavaThread theOwner = null; for (JavaThread thread = first(); thread != null; thread = thread.next()) { - Address addr = thread.highestLock(); - if (addr == null || addr.lessThan(o)) continue; - long diff = addr.minus(o); - if (!leastDiffInitialized || diff < leastDiff) { - leastDiffInitialized = true; - leastDiff = diff; - theOwner = thread; - } + if (thread.isLockOwned(o)) + return thread; } - return theOwner; + return null; } public JavaThread owningThreadFromMonitor(ObjectMonitor monitor) {