8300098: java/util/concurrent/ConcurrentHashMap/ConcurrentAssociateTest.java fails with internal timeout when executed with TieredCompilation1/3

Co-authored-by: Doug Lea <dl@openjdk.org>
Reviewed-by: jpai, alanb
This commit is contained in:
Viktor Klang 2023-02-06 15:26:32 +00:00 committed by Alan Bateman
parent 7ae447f4eb
commit ecf8842cd2

View file

@ -2862,22 +2862,20 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* Possibly blocks awaiting root lock.
*/
private final void contendedLock() {
boolean waiting = false;
Thread current = Thread.currentThread(), w;
for (int s;;) {
if (((s = lockState) & ~WAITER) == 0) {
if (U.compareAndSetInt(this, LOCKSTATE, s, WRITER)) {
if (waiting)
waiter = null;
if (waiter == current)
U.compareAndSetReference(this, WAITERTHREAD, current, null);
return;
}
}
else if ((s & WAITER) == 0) {
if (U.compareAndSetInt(this, LOCKSTATE, s, s | WAITER)) {
waiting = true;
waiter = Thread.currentThread();
}
}
else if (waiting)
else if ((s & WAITER) == 0)
U.compareAndSetInt(this, LOCKSTATE, s, s | WAITER);
else if ((w = waiter) == null)
U.compareAndSetReference(this, WAITERTHREAD, null, current);
else if (w == current)
LockSupport.park(this);
}
}
@ -3296,6 +3294,8 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
private static final long LOCKSTATE
= U.objectFieldOffset(TreeBin.class, "lockState");
private static final long WAITERTHREAD
= U.objectFieldOffset(TreeBin.class, "waiter");
}
/* ----------------Table Traversal -------------- */