Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8255401: Shenandoah: Allow oldval and newval registers to overlap in cmpxchg_oop() #871

wants to merge 1 commit into from


Copy link

@rkennke rkennke commented Oct 26, 2020

We encountered a failure in testing:

Internal Error (/home/jenkins/workspace/nightly/jdk-jdk/src/hotspot/share/asm/register.hpp:141), pid=15470, tid=15611
assert(a != b && a != c && a != d && b != c && b != d && c != d) failed: registers must be different: a=0x0000000000000000, b=0x0000000000000000, c=0x000000000000000b, d=0x000000000000000a


Stack: [0x00007fb8fa2e3000,0x00007fb8fa3e4000], sp=0x00007fb8fa3deca0, free space=1007k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [] ShenandoahBarrierSetAssembler::cmpxchg_oop(MacroAssembler*, RegisterImpl*, Address, RegisterImpl*, RegisterImpl*, bool, RegisterImpl*, RegisterImpl*)+0xde
V [] compareAndSwapN_shenandoahNode::emit(CodeBuffer&, PhaseRegAlloc*) const+0x571

It seems to appear very rarely.

The failure is that both newval and oldval are the same register (rax). I believe it is ok for the two registers to overlap:

  • It is not expected that newval is preserved across the cmpxchg
  • The CAS will override newval, but:
    • The first CAS is unaffected by the overlap
    • The retry-loop is only entered when previous-value == old-value, and thus newval will still hold the same value

For aarch64 it matters even less, because newval is never overridden.

Testing: hotspot_gc_shenandoah (x86 & aarch64).


  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed


Linux x32 Linux x64 Windows x64 macOS x64
Build ✔️ (1/1 passed) ✔️ (5/5 passed) (1/2 failed) ✔️ (2/2 passed)
Test (tier1) ✔️ (9/9 passed) ✔️ (9/9 passed)

Failed test task


  • JDK-8255401: Shenandoah: Allow oldval and newval registers to overlap in cmpxchg_oop()



$ git fetch pull/871/head:pull/871
$ git checkout pull/871

Copy link

@bridgekeeper bridgekeeper bot commented Oct 26, 2020

👋 Welcome back rkennke! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr label Oct 26, 2020
Copy link

@openjdk openjdk bot commented Oct 26, 2020

@rkennke The following labels will be automatically applied to this pull request:

  • hotspot
  • shenandoah

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added hotspot shenandoah labels Oct 26, 2020
Copy link

@mlbridge mlbridge bot commented Oct 26, 2020


Copy link

@rwestrel rwestrel left a comment

Looks good to me

Copy link

@openjdk openjdk bot commented Nov 2, 2020

@rkennke This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file for details.

After integration, the commit message for the final commit will be:

8255401: Shenandoah: Allow oldval and newval registers to overlap in cmpxchg_oop()

Reviewed-by: roland

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 112 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Nov 2, 2020
Copy link
Contributor Author

@rkennke rkennke commented Nov 2, 2020


@openjdk openjdk bot closed this Nov 2, 2020
@openjdk openjdk bot added integrated and removed ready rfr labels Nov 2, 2020
Copy link

@openjdk openjdk bot commented Nov 2, 2020

@rkennke Since your change was applied there have been 113 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

Pushed as commit 0e19ded.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
hotspot integrated shenandoah
2 participants