Skip to content

Conversation

@feilongjiang
Copy link
Member

@feilongjiang feilongjiang commented Sep 29, 2024

Hi, please consider.

RISC-V does not currently have plain load and store opcodes with aq or rl annotations, load-acquire and
store-release operations are implemented using fences instead. Initially, we followed the RISC-V spec
and placed FENCE RW,RW fence in front of load-acquire operation when porting the template interpreter.
The purpose is to enforce a store-release-to-load-acquire ordering (where there must be a FENCE RW,RW
between the store-release and load-acquire). But it turns out these fences are unnecessary for our use
cases in the template interpreter. In fact, we only need to do a single FENCE R,RW after a normal memory
load in order to implement a load-acquire operation. We should remove those unnecessary fences for both
performance reasons and for consistency with the rest of the port (i.e., C1 and C2 JIT).

Testing:

  • JCstress
  • hs-tier1 - hs-tier4
  • ~5% improvement on SPECJbb2005 score (-Xint -XX:+UseParallelGC)

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-8341146: RISC-V: Unnecessary fences used for load-acquire in template interpreter (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 21248

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 29, 2024

👋 Welcome back fjiang! 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 Sep 29, 2024

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

8341146: RISC-V: Unnecessary fences used for load-acquire in template interpreter

Reviewed-by: fyang, rehn

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

  • 9a7817b: 8340988: Update jdk/jfr/event/gc/collection tests to accept "CodeCache GC Threshold" as valid GC reason
  • f2a767f: 8340907: Open source closed frame tests # 2
  • 7b1e6f8: 8337389: Parallel: Remove unnecessary forward declarations in psScavenge.hpp
  • 2120a84: 8341333: [JVMCI] Export JavaThread::_unlocked_inflated_monitor to JVMCI
  • 684d246: 8341242: Shenandoah: LRB node is not matched as GC barrier after JDK-8340183
  • 7cc7c08: 8337493: [JVMCI] Number of libgraal threads might be too low
  • f7c7958: 8340420: ZGC: Should call vm_shutdown_during_initialization if initialization fails
  • 2dc3b1a: 8341201: Broken link in AbstractAnnotationValueVisitor7 due to extra quotation mark
  • ad5ffcc: 8341168: Cleanup dead code after JDK-8322630
  • 1b46fea: 8341024: [test] build/AbsPathsInImage.java fails with OOM when using ubsan-enabled binaries
  • ... and 24 more: https://git.openjdk.org/jdk/compare/73ebb848fdb66861e912ea747c039ddd1f7a5f48...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 rfr Pull request is ready for review label Sep 29, 2024
@openjdk
Copy link

openjdk bot commented Sep 29, 2024

@feilongjiang 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 Sep 29, 2024
@mlbridge
Copy link

mlbridge bot commented Sep 29, 2024

Webrevs

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.

Looks reasonable. Thanks for the cleanup!

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 30, 2024
Copy link
Contributor

@robehn robehn left a comment

Choose a reason for hiding this comment

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

Thank you!

@feilongjiang
Copy link
Member Author

Thanks! @robehn @RealFYang
/integrate

@openjdk
Copy link

openjdk bot commented Oct 2, 2024

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

  • c8c4ff2: 8341135: Incorrect format string after JDK-8339475
  • efe3573: 8340109: Ubsan: ciEnv.cpp:1660:65: runtime error: member call on null pointer of type 'struct CompileTask'
  • 52c2ea6: 8340732: RISC-V: Refactor crc32 scalar version
  • 90c944f: 8340824: C2: Memory for TypeInterfaces not reclaimed by hashcons()
  • 39c17b3: 8341277: Validate slot argument for instruction factories
  • 0f38113: 8341243: Use ArraySupport.SOFT_MAX_ARRAY_LENGTH for max array size in java.base
  • 8d6d37f: 8320308: C2 compilation crashes in LibraryCallKit::inline_unsafe_access
  • 83dcb02: 8340079: Modify rearrange/selectFrom Vector API methods to perform wrapIndexes instead of checkIndexes
  • d2e7708: 8341367: Problemlist ShapeNotSetSometimes.java on macOS
  • 0314973: 8341060: Cleanup statics in HeapDumper
  • ... and 35 more: https://git.openjdk.org/jdk/compare/73ebb848fdb66861e912ea747c039ddd1f7a5f48...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Oct 2, 2024

@feilongjiang Pushed as commit a4ca626.

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

@feilongjiang feilongjiang deleted the riscv-remove-membar branch October 2, 2024 09:37
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.

3 participants