-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8316186: RISC-V: Remove PlatformCmpxchg<4> #15715
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
Conversation
👋 Welcome back rehn! A progress list of the required criteria for merging this PR into |
Webrevs
|
The first instruction of the inline asm in this function will make a difference here.
|
So we basically have some rubbish in top 32 bits, we clear them, right. Checking for when/where the bug was/is in tool-chain. |
I asked around, there is no known bug. The compare value is passed as pointer, the normal generate code is: gcc 8.2 seems to generate the same code as gcc 13/tip. |
Try this test:
|
But that test should be using MacroAssembler::cmpxchg_ ? Testing whats wrong.... |
GC barrier may use that Atomic::cmpxchg, depending on compiled or not, etc, so that test uses this cmpxchg The case we are talking seems to be the narrow oop. According to RV calling convention specs:
This means any 4-bytes passed in integer register must be sign extended by caller. I added this 'assert':
And tested gcc 12 and 13, in qemu and on VF2 (gcc 12) it do not fire, hence I cannot reproduce. AFAICT this extra sign extension is actually hiding a deeper bug! Are you building with normal upstream gcc (12/13)? This made me realize that the call_VM with Register must always be manually check for proper sign extension. |
I agree with your understanding about RISC-V C/C++ ABI calling conversion. I am suspecting that this might be related how narrow oop are loaded for template interpreter, C1 and C2. Normally we use BTW: I am using native GCC-11.4.0 shipped with Ubuntu 22.04.3 LTS on Unmatched board. I can try GCC-12 later. [1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/riscv.ad#L4684 |
PS: I can reproduce the test failure with GCC version 10 and 11. But it does not trigger with GCC 12. (GCC 13 is not shipped with the distro) |
This look like the bug you are hitting:
EDIT: Ignore above, was never meant to send that.
I can't reproduce with gcc 11.4.0-1ubuntu1~23.04 (testing with fastdebug). Can you add 'assert' code above and check hs_err which case this is? |
You might want to try openjdk release build from GCC 10 or 11.
Yeah, I have added code change from this pull request and your 'assert' code and doing a native release build with GCC 11. |
Turns out that the issue won't reproduce if adding your 'assert' code. |
I can now reproduce using gcc 11.3 + this branch with no changes. |
Fix for the bug here: |
Merge with master, retested the problematic tests, we are all green now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. So far my local regression tests with release build from GCC-11 are fine.
PS: Tier1-3 and hotspot:tier4 test good on hifive unmatched.
@robehn This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
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 30 new commits pushed to the
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 |
Thanks you, and extra thanks for testing! |
@Hamlin-Li thanks! /integrate |
Going to push as commit b8fa6c2.
Your commit was automatically rebased without conflicts. |
Hi, please consider.
I don't know the history behind the Cmpxhg<4>, but it is not needed anymore.
Using compiler as in 8 byte case is just fine.
Passes hotspot-tier (qemu, vf2 still running), some manual extra testing via gtest, looked at compiler: output, e.g. https://godbolt.org/z/a31Gdqn8q
If you know the history please share, and if you have a reason why we should keep it please speak up!
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15715/head:pull/15715
$ git checkout pull/15715
Update a local copy of the PR:
$ git checkout pull/15715
$ git pull https://git.openjdk.org/jdk.git pull/15715/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 15715
View PR using the GUI difftool:
$ git pr show -t 15715
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15715.diff
Webrev
Link to Webrev Comment