Navigation Menu

Skip to content

Commit

Permalink
8300098: java/util/concurrent/ConcurrentHashMap/ConcurrentAssociateTe…
Browse files Browse the repository at this point in the history
…st.java fails with internal timeout when executed with TieredCompilation1/3

Reviewed-by: mdoerr
Backport-of: ecf8842cd2309210f3d5eee7f9f28a198a860686
  • Loading branch information
RealLucy committed Jul 5, 2023
1 parent 750387b commit dbf8820
Showing 1 changed file with 10 additions and 10 deletions.
Expand Up @@ -2852,22 +2852,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.compareAndSetObject(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.compareAndSetObject(this, WAITERTHREAD, null, current);
else if (w == current)
LockSupport.park(this);
}
}
Expand Down Expand Up @@ -3287,6 +3285,8 @@ static <K,V> boolean checkInvariants(TreeNode<K,V> t) {
private static final Unsafe U = Unsafe.getUnsafe();
private static final long LOCKSTATE
= U.objectFieldOffset(TreeBin.class, "lockState");
private static final long WAITERTHREAD
= U.objectFieldOffset(TreeBin.class, "waiter");
}

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

1 comment on commit dbf8820

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.