Mercurial > hg > graal-jvmci-8
comparison 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 |
comparison
equal
deleted
inserted
replaced
697:922aedc96ef5 | 702:b9fba36710f2 |
---|---|
162 if (o.equals(thread.threadObjectAddress())) { | 162 if (o.equals(thread.threadObjectAddress())) { |
163 return thread; | 163 return thread; |
164 } | 164 } |
165 } | 165 } |
166 | 166 |
167 long leastDiff = 0; | 167 for (JavaThread thread = first(); thread != null; thread = thread.next()) { |
168 boolean leastDiffInitialized = false; | 168 if (thread.isLockOwned(o)) |
169 JavaThread theOwner = null; | 169 return thread; |
170 for (JavaThread thread = first(); thread != null; thread = thread.next()) { | 170 } |
171 Address addr = thread.highestLock(); | 171 return null; |
172 if (addr == null || addr.lessThan(o)) continue; | |
173 long diff = addr.minus(o); | |
174 if (!leastDiffInitialized || diff < leastDiff) { | |
175 leastDiffInitialized = true; | |
176 leastDiff = diff; | |
177 theOwner = thread; | |
178 } | |
179 } | |
180 return theOwner; | |
181 } | 172 } |
182 | 173 |
183 public JavaThread owningThreadFromMonitor(ObjectMonitor monitor) { | 174 public JavaThread owningThreadFromMonitor(ObjectMonitor monitor) { |
184 return owningThreadFromMonitor(monitor.owner()); | 175 return owningThreadFromMonitor(monitor.owner()); |
185 } | 176 } |