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

Co-authored-by: Doug Lea <dl@openjdk.org>
Reviewed-by: jpai, alanb
  • Loading branch information
2 people authored and Alan Bateman committed Feb 6, 2023
1 parent 7ae447f commit ecf8842
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

3 comments on commit ecf8842

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@TheRealMDoerr
Copy link
Contributor

Choose a reason for hiding this comment

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

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on ecf8842 Jun 29, 2023

Choose a reason for hiding this comment

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

@TheRealMDoerr the backport was successfully created on the branch TheRealMDoerr-backport-ecf8842c in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit ecf8842c from the openjdk/jdk repository.

The commit being backported was authored by Viktor Klang on 6 Feb 2023 and was reviewed by Jaikiran Pai and Alan Bateman.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev.git TheRealMDoerr-backport-ecf8842c:TheRealMDoerr-backport-ecf8842c
$ git checkout TheRealMDoerr-backport-ecf8842c
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev.git TheRealMDoerr-backport-ecf8842c

Please sign in to comment.