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

8306667: RISC-V: Fix storeImmN0 matching rule by using zr register #13577

Closed
wants to merge 3 commits into from

Conversation

zhengxiaolinX
Copy link
Contributor

@zhengxiaolinX zhengxiaolinX commented Apr 21, 2023

The storeImmN0 in the RISC-V backend missed a CompressedOops::base() == NULL predication. Under non-zero-based compressed oops mode, the xheapbase can be a non-zero value and crashes the VM.

Reproduced by <JDK>/bin/java -Xcomp -XX:HeapBaseMinAddress=72030M -version simply. A hs_err file is attached in the JBS issue.

x86 uses r12 as a zero register in storeImmN0, but RISC-V has a zero register so we can use it to implement the matching rule.

Testing in progress.

Thanks,
Xiaolin


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8306667: RISC-V: Fix storeImmN0 matching rule by using zr register

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/13577/head:pull/13577
$ git checkout pull/13577

Update a local copy of the PR:
$ git checkout pull/13577
$ git pull https://git.openjdk.org/jdk.git pull/13577/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 13577

View PR using the GUI difftool:
$ git pr show -t 13577

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/13577.diff

Webrev

Link to Webrev Comment

@zhengxiaolinX zhengxiaolinX changed the title 8306667: RISC-V: Fix storeImmN0 matching rule by removing xheapbase 8306667: RISC-V: Fix storeImmN0 matching rule by using zr register Apr 21, 2023
@bridgekeeper
Copy link

bridgekeeper bot commented Apr 21, 2023

👋 Welcome back xlinzheng! 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
Copy link

openjdk bot commented Apr 21, 2023

@zhengxiaolinX The following label will be automatically applied to this pull request:

  • hotspot-compiler

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

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Apr 21, 2023
@VladimirKempik
Copy link

btw, should this also be backported to 17u-riscv ? after this PR is done

Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

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

Looks reasonable.

@zhengxiaolinX
Copy link
Contributor Author

btw, should this also be backported to 17u-riscv ? after this PR is done

Sure, I can do that after verifying and merging this patch.

@zhengxiaolinX
Copy link
Contributor Author

Looks reasonable.

Thanks for the review, Aleksey!

@lgxbslgx
Copy link
Member

lgxbslgx commented May 5, 2023

A potential issue in the comment of iRegIHeapbase:

// heap base register -- used for encoding immN0
operand iRegIHeapbase()

And unfortunately, aarch64 has the same issue in iRegIHeapbase since JDK-8242449.

They can be fixed together in a follow-up patch. Or only fix the riscv64 part in this patch and fix the aarch64 part in another patch.

@zhengxiaolinX
Copy link
Contributor Author

A potential issue in the comment of iRegIHeapbase:

// heap base register -- used for encoding immN0
operand iRegIHeapbase()

And unfortunately, aarch64 has the same issue in iRegIHeapbase since JDK-8242449.

They can be fixed together in a follow-up patch. Or only fix the riscv64 part in this patch and fix the aarch64 part in another patch.

Indeed, iRegIHeapbase gets used nowhere in both backends and thanks for the catching. I can file one patch to clean them up after this.

Though, I think the AArch64 backend does not have this issue because it has the CompressedOops::base() == NULL && CompressedKlassPointers::base() == NULL guard before JDK-8242449 - if I understand your comments correctly?

P.S. Sorry for the delay in this fix - I have tested hotspot tier1~4 on QEMU but still not yet on an unmatched board since mine has other jobs to test. Will carry this fix on soon.

@lgxbslgx
Copy link
Member

lgxbslgx commented May 5, 2023

And unfortunately, aarch64 has the same issue in iRegIHeapbase since JDK-8242449.

Though, I think the AArch64 backend does not have this issue because it has the CompressedOops::base() == NULL && CompressedKlassPointers::base() == NULL guard before JDK-8242449 - if I understand your comments correctly?

the same issue I mentioned means the same unnecessary comments. Sorry for the ambiguity.

@zhengxiaolinX
Copy link
Contributor Author

Verified hotspot tier1~2 (fastdebug) on my machine.

@zhengxiaolinX zhengxiaolinX marked this pull request as ready for review May 11, 2023 23:10
@openjdk
Copy link

openjdk bot commented May 11, 2023

@zhengxiaolinX 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:

8306667: RISC-V: Fix storeImmN0 matching rule by using zr register

Reviewed-by: shade, gli, fyang

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 4 new commits pushed to the master branch:

  • 73491fa: 8306996: Open source Swing MenuItem related tests
  • 33d9a85: 8307572: AArch64: Vector registers are clobbered by some macroassemblers
  • 9a7b443: 8307966: ProblemList java/util/concurrent/locks/Lock/OOMEInAQS.java on linux-x64
  • 54c06d2: 8307559: Add better checking in com/sun/jdi tests for debuggee exiting unexpectedly with an exception

Please see this link for an up-to-date comparison between the source branch of this pull request and 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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@shipilev, @lgxbslgx, @RealFYang) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 11, 2023
@mlbridge
Copy link

mlbridge bot commented May 11, 2023

Webrevs

Copy link
Member

@lgxbslgx lgxbslgx left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@RealFYang RealFYang left a comment

Choose a reason for hiding this comment

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

Nice catch. Looks good.

@zhengxiaolinX
Copy link
Contributor Author

Thanks for reviewing! @lgxbslgx @RealFYang

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label May 12, 2023
@openjdk
Copy link

openjdk bot commented May 12, 2023

@zhengxiaolinX
Your change (at version 754a130) is now ready to be sponsored by a Committer.

@RealFYang
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented May 12, 2023

Going to push as commit e32de7e.
Since your change was applied there have been 7 commits pushed to the master branch:

  • f3bd031: 8307891: ProblemList gtest/NMTGtest.java subtests on aix
  • 5f1f946: 8307520: set minimum supported CPU architecture to Power8 on AIX
  • ccb4dd6: 8307969: [zgc] Missing includes in gc/z/zTracer.cpp
  • 73491fa: 8306996: Open source Swing MenuItem related tests
  • 33d9a85: 8307572: AArch64: Vector registers are clobbered by some macroassemblers
  • 9a7b443: 8307966: ProblemList java/util/concurrent/locks/Lock/OOMEInAQS.java on linux-x64
  • 54c06d2: 8307559: Add better checking in com/sun/jdi tests for debuggee exiting unexpectedly with an exception

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 12, 2023
@openjdk openjdk bot closed this May 12, 2023
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label May 12, 2023
@openjdk openjdk bot removed rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels May 12, 2023
@openjdk
Copy link

openjdk bot commented May 12, 2023

@RealFYang @zhengxiaolinX Pushed as commit e32de7e.

💡 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
Labels
hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
5 participants