Skip to content

Commit

Permalink
JDK-8300098 : java/util/concurrent/ConcurrentHashMap/ConcurrentAssoci…
Browse files Browse the repository at this point in the history
…ateTest.java fails with internal timeout when executed with TieredCompilation1/3
  • Loading branch information
viktorklang-ora committed Jan 31, 2023
1 parent 041a12e commit d132973
Showing 1 changed file with 10 additions and 10 deletions.
Expand Up @@ -2862,22 +2862,20 @@ private final void unlockRoot() {
* 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);
}
}
Expand Down Expand Up @@ -3296,6 +3294,8 @@ static <K,V> boolean checkInvariants(TreeNode<K,V> t) {

private static final long LOCKSTATE
= U.objectFieldOffset(TreeBin.class, "lockState");
private static final long WAITERTHREAD
= U.objectFieldOffset(TreeBin.class, "waiter");
}

/* ----------------Table Traversal -------------- */
Expand Down

0 comments on commit d132973

Please sign in to comment.