Skip to content

Conversation

@shipilev
Copy link
Member

@shipilev shipilev commented Mar 28, 2025

Noticed this while looking at compiled code density. In C1 PatchingStub code, we always perform a runtime call to Thread::current(), even though we can rely on r15_thread to be available. This currently emits a huge sequence of instructions for register save/restore and the call itself.

Current code calls to MacroAssembler::get_thread(), which is always doing that slowpath. This kind of accident would be less likely / impossible once we cleanup uses of MacroAssembler::get_thread() with JDK-8353174.

Additional testing:

  • Linux x86_64 server fastdebug, tier1
  • Linux x86_64 server fastdebug, tier1 + -XX:TieredStopAtLevel=1
  • Linux x86_64 server fastdebug, all
  • Linux x86_64 server fastdebug, all + -XX:TieredStopAtLevel=1

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-8353176: C1: x86 patching stub always calls Thread::current() (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 24291

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 28, 2025

👋 Welcome back shade! 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 Mar 28, 2025

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

8353176: C1: x86 patching stub always calls Thread::current()

Reviewed-by: mdoerr, kvn, vlivanov

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

  • 3d2c3cd: 8352970: Remove unnecessary Windows version check in Win32ShellFolderManager2
  • c70ad6a: 8352906: stdout/err.encoding on Windows set by incorrect Win32 call
  • da3bb06: 8352685: Opensource JInternalFrame tests - series2
  • d809033: 8341775: Duplicate manifest files are removed by jarsigner after signing
  • a269bef: 8350459: MontgomeryIntegerPolynomialP256 multiply intrinsic with AVX2 on x86_64
  • c029220: 8352896: LambdaExpr02.java runs wrong test class
  • c0b61d3: 8352680: Opensource few misc swing tests
  • 3e9a7a4: 8353063: make/ide/vscode: Invalid Configuration Values
  • 8ef7832: 8350471: Unhandled compilation bailout in GraphKit::builtin_throw
  • ddf326b: 8346888: [ubsan] block.cpp:1617:30: runtime error: 9.97582e+36 is outside the range of representable values of type 'int'
  • ... and 7 more: https://git.openjdk.org/jdk/compare/b73663a2b4fe7049fc0990c1a1e51221640b4e29...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
Copy link

openjdk bot commented Mar 28, 2025

@shipilev 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 Mar 28, 2025
@shipilev
Copy link
Member Author

shipilev commented Mar 28, 2025

Sample code density improvements:

$ for I in 1 2 3; do build/linux-x86_64-server-release/images/jdk/bin/java \ 
  -XX:TieredStopAtLevel=${I} -Xcomp -XX:+CITime \ 
  Hello 2>&1 | grep "nmethod code size"; done

# baseline
tier1:  463424 bytes
tier2:  499456 bytes
tier3: 1051016 bytes

# patched
tier1:  436632 bytes ; -6.1%
tier2:  472808 bytes ; -5.6%
tier3: 1024376 bytes ; -2.6%

@shipilev shipilev marked this pull request as ready for review March 28, 2025 12:31
@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 28, 2025
@mlbridge
Copy link

mlbridge bot commented Mar 28, 2025

Webrevs

Copy link
Contributor

@TheRealMDoerr TheRealMDoerr left a comment

Choose a reason for hiding this comment

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

LGTM.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 28, 2025
Copy link
Contributor

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

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

Good.

Copy link
Contributor

@iwanowww iwanowww 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.

@shipilev
Copy link
Member Author

Thanks! I am in the middle of x86 C1 cleanups, but I believe this does not conflict with anything in flight. So I am integrating.

/integrate

@openjdk
Copy link

openjdk bot commented Mar 31, 2025

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

  • 79d0c94: 8352114: New test runtime/interpreter/CountBytecodesTest.java is failing
  • 23e3b3f: 8351156: C1: Remove FPU stack support after 32-bit x86 removal
  • 2592513: 8350577: Fix missing Assertion Predicates when splitting loops
  • 59629f8: 8351040: [REDO] Protection zone for easier detection of accidental zero-nKlass use
  • 8cbadf7: 8317976: Optimize SIMD sort for AMD Zen 4
  • b9d7a75: 8352879: TestPeriod.java and TestGetContentType.java run wrong test class
  • 895aabc: 8351233: [ASAN] avx2-emu-funcs.hpp:151:20: error: ‘D.82188’ is used uninitialized
  • 3d2c3cd: 8352970: Remove unnecessary Windows version check in Win32ShellFolderManager2
  • c70ad6a: 8352906: stdout/err.encoding on Windows set by incorrect Win32 call
  • da3bb06: 8352685: Opensource JInternalFrame tests - series2
  • ... and 14 more: https://git.openjdk.org/jdk/compare/b73663a2b4fe7049fc0990c1a1e51221640b4e29...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Mar 31, 2025

@shipilev Pushed as commit 6fbaa06.

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

4 participants