Skip to content

Conversation

TheRealMDoerr
Copy link
Contributor

@TheRealMDoerr TheRealMDoerr commented Oct 17, 2025

Like the aarch64 fix (#27748).
PPC64 has additional requirements:

  • It implements fast_invokevfinal which uses ResolvedMethodEntry.
  • Speculative loads need to get prevented by memory barrier instructions (even on control dependent paths).

I've refactored load_field_entry and load_method_entry into a common function and added support for rewritten "fast" Bytecodes. I'm using isync instructions because we already have a control dependency (via Bytecode dispatch).

The isync instruction is relatively cheap in comparison to other memory barriers, but still introduces some performance loss. SPEC jvm98 with -Xint shows about 5% regression in compress sub-benchmark. The other sub-benchmarks are not significantly impacted. However, switching off RewriteBytecodes would cause a much higher performance loss.

Note: I had also ported the verify_field_offset check and used it in the fastdebug and product build for testing, but couldn't catch any issue. Not included in this PR. I'm not planning to contribute it.


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-8369946: Bytecode rewriting causes Java heap corruption on PPC (Bug - P2)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 27867

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 17, 2025

👋 Welcome back mdoerr! 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 Oct 17, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Oct 17, 2025

@TheRealMDoerr 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 rfr Pull request is ready for review label Oct 17, 2025
@mlbridge
Copy link

mlbridge bot commented Oct 17, 2025

Webrevs

Copy link
Member

@reinrich reinrich left a comment

Choose a reason for hiding this comment

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

Hi Martin,
nasty bug this is. Thanks for doing the fixing on ppc. And great work by Justin finding it!
I see that we've missed porting previous fixes to ppc that prevent reordering of the bytecode load with loads from ResolvedFieldEntry and -MethodEntry (JDK-8248219 and JDK-8327647). Now this is done in load_field_or_method_entry().
The change is good. The comment could be improved a little bit.
Thanks, Richard.

Co-authored-by: Richard Reingruber <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-compiler [email protected] rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants