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

8300247: Harden C1 xchg on AArch64 and PPC #12065

Closed
wants to merge 2 commits into from

Conversation

fisk
Copy link
Contributor

@fisk fisk commented Jan 18, 2023

In the C1 xchg operation, AArch64 and PPC don't deal well with the input register and output register being the same. In some new code, that can happen. This change aims at solving that issue.

As for AArch64, the xchg implementation in the macro assembler already deals well with the input and output register being the same. So we just need to remove an assert. As for the PPC implementation, @TheRealMDoerr has written a variation that uses a temp operand ensuring that they are not the same register.


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

Reviewers

Contributors

  • Martin Doerr <mdoerr@openjdk.org>

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12065

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

Using diff file

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

@fisk
Copy link
Contributor Author

fisk commented Jan 18, 2023

/contributor add @TheRealMDoerr

@fisk
Copy link
Contributor Author

fisk commented Jan 18, 2023

/contributor @xmas92

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 18, 2023

👋 Welcome back eosterlund! 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 Pull request is ready for review label Jan 18, 2023
@openjdk
Copy link

openjdk bot commented Jan 18, 2023

@fisk
Contributor Martin Doerr <mdoerr@openjdk.org> successfully added.

@openjdk
Copy link

openjdk bot commented Jan 18, 2023

@fisk Syntax: /contributor (add|remove) [@user | openjdk-user | Full Name <email@address>]. For example:

  • /contributor add @openjdk-bot
  • /contributor add duke
  • /contributor add J. Duke <duke@openjdk.org>

User names can only be used for users in the census associated with this repository. For other contributors you need to supply the full name and email address.

@openjdk
Copy link

openjdk bot commented Jan 18, 2023

@fisk 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 Jan 18, 2023
@mlbridge
Copy link

mlbridge bot commented Jan 18, 2023

Webrevs

@openjdk
Copy link

openjdk bot commented Jan 18, 2023

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

8300247: Harden C1 xchg on AArch64 and PPC

Co-authored-by: Martin Doerr <mdoerr@openjdk.org>
Reviewed-by: aph, rcastanedalo

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

  • 3f63381: 8300913: ZGC: assert(to_addr != 0) failed: Should be forwarded
  • da80e7a: 8300962: Parallel: Remove PSParallelCompact::_total_invocations
  • 7725fe8: 8299953: Merge ContiguousSpaceDCTOC into DirtyCardToOopClosure
  • a9b8acb: 8300652: Parallel: Refactor oop marking stack in Full GC
  • 15a1488: 8297437: javadoc cannot link to old docs (with old style anchors)
  • b0376a5: 8301069: Replace NULL with nullptr in share/libadt/
  • 7328182: 8300958: Parallel: Remove unused MutableNUMASpace::capacity_in_words
  • 30cb305: 8292170: Convert CodeRootSetTable to use ResourceHashtable
  • 3589b80: 8300127: Serial: Remove unnecessary from-space iteration in DefNewGeneration::oop_since_save_marks_iterate
  • 48152ef: 8287134: HttpURLConnection chunked streaming mode doesn't enforce specified size
  • ... and 194 more: https://git.openjdk.org/jdk/compare/a734285314a34ed61583132f2fc6be9d9c861af4...master

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 Pull request is ready to be integrated label Jan 18, 2023
@TheRealMDoerr
Copy link
Contributor

Thanks for including my PPC64 code!

@fisk
Copy link
Contributor Author

fisk commented Jan 18, 2023

Thanks for the review, @theRealAph!

@RealFYang
Copy link
Member

RealFYang commented Jan 20, 2023

Hi, I think we could also relax the same assertion for riscv too.
The ultimate 'amoswap.w/d' instruction emitted in this case does not require that 'dst' and 'obj' must be different registers.
Could you please also add this extra small change while are you at it? Thanks.

diff --git a/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp b/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp
index aec62aba489..d960d64522c 100644
--- a/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp
+++ b/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp
@@ -1967,7 +1967,8 @@ void LIR_Assembler::atomic_op(LIR_Code code, LIR_Opr src, LIR_Opr data, LIR_Opr
           __ encode_heap_oop(t0, obj);
           obj = t0;
         }
-        assert_different_registers(obj, addr.base(), tmp, dst);
+        assert_different_registers(obj, addr.base(), tmp);
+        assert_different_registers(dst, addr.base(), tmp);
         __ la(tmp, addr);
         (_masm->*xchg)(dst, obj, tmp);
         if (is_oop && UseCompressedOops) {

@fisk
Copy link
Contributor Author

fisk commented Jan 23, 2023

@RealFYang Sure - fixed!

Copy link
Contributor

@robcasloz robcasloz left a comment

Choose a reason for hiding this comment

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

Looks good.

@fisk
Copy link
Contributor Author

fisk commented Jan 26, 2023

Looks good.

Thanks for the review!

@fisk
Copy link
Contributor Author

fisk commented Jan 26, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Jan 26, 2023

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

  • 3f63381: 8300913: ZGC: assert(to_addr != 0) failed: Should be forwarded
  • da80e7a: 8300962: Parallel: Remove PSParallelCompact::_total_invocations
  • 7725fe8: 8299953: Merge ContiguousSpaceDCTOC into DirtyCardToOopClosure
  • a9b8acb: 8300652: Parallel: Refactor oop marking stack in Full GC
  • 15a1488: 8297437: javadoc cannot link to old docs (with old style anchors)
  • b0376a5: 8301069: Replace NULL with nullptr in share/libadt/
  • 7328182: 8300958: Parallel: Remove unused MutableNUMASpace::capacity_in_words
  • 30cb305: 8292170: Convert CodeRootSetTable to use ResourceHashtable
  • 3589b80: 8300127: Serial: Remove unnecessary from-space iteration in DefNewGeneration::oop_since_save_marks_iterate
  • 48152ef: 8287134: HttpURLConnection chunked streaming mode doesn't enforce specified size
  • ... and 194 more: https://git.openjdk.org/jdk/compare/a734285314a34ed61583132f2fc6be9d9c861af4...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jan 26, 2023

@fisk Pushed as commit 28545dc.

💡 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
Development

Successfully merging this pull request may close these issues.

6 participants