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

8318015: Lock inflation not needed for OSR or Deopt for new locking modes #16165

Closed

Conversation

TheRealMDoerr
Copy link
Contributor

@TheRealMDoerr TheRealMDoerr commented Oct 12, 2023

Only LockingMode "LM_LEGACY" requires inflation before lock transfers because it is the only one which uses stack addresses in the mark word. I think we should treat the displaced header as stale data because it may be uninitialized.


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-8318015: Lock inflation not needed for OSR or Deopt for new locking modes (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 16165

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 12, 2023

👋 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 openjdk bot added the rfr Pull request is ready for review label Oct 12, 2023
@openjdk
Copy link

openjdk bot commented Oct 12, 2023

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

  • hotspot

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 hotspot-dev@openjdk.org label Oct 12, 2023
@mlbridge
Copy link

mlbridge bot commented Oct 12, 2023

Webrevs

Copy link
Contributor

@pchilano pchilano 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 to me.

@@ -66,7 +66,7 @@ void BasicLock::move_to(oop obj, BasicLock* dest) {
// is small (given the support for inflated fast-path locking in the fast_lock, etc)
// we'll leave that optimization for another time.

if (displaced_header().is_neutral()) {
if (LockingMode == LM_LEGACY && displaced_header().is_neutral()) {
// The object is locked and the resulting ObjectMonitor* will also be
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't the set_displaced_header() below also unnecessary for other locking modes, i.e shouldn't it be if (LockingMode != LM_LEGACY) { return; }?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct. We can skip copying the displaced header completely (also for OSR). I've updated the PR.

Copy link
Contributor

@pchilano pchilano 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 to me, thanks.

@openjdk
Copy link

openjdk bot commented Oct 13, 2023

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

8318015: Lock inflation not needed for OSR or Deopt for new locking modes

Reviewed-by: pchilanomate, dlong

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

  • 56aa1e8: 8317683: Add JIT memory statistics
  • f7d6d7a: 8266242: java/awt/GraphicsDevice/CheckDisplayModes.java failing on macOS 11 ARM
  • e942f36: 8317535: Shenandoah: Remove unused code
  • 7cb2e6d: 8317514: Ensure MemorySegment is initialized before touching NativeMemorySegmentImpl
  • 9622de2: 8317372: Refactor some NumberFormat tests to use JUnit
  • 72c4dcb: 8317970: Bump target macosx-x64 version to 11.00.00
  • 32a60cf: 8317824: Beef up javadoc for base offset in var handles derived from layouts (mainline)
  • b12c471: 8317837: Leftover FFM implementation-only changes
  • 605c976: 8318039: GHA: Bump macOS and Xcode versions
  • 6273ab9: 8317808: HTTP/2 stream cancelImpl may leave subscriber registered
  • ... and 58 more: https://git.openjdk.org/jdk/compare/ad7a8e86e0334390f87ae44cf749d2b47f1409a1...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 Oct 13, 2023
@dean-long
Copy link
Member

In debug builds, it might be useful to write an illegal value into the displaced header instead of just skipping it.

@TheRealMDoerr
Copy link
Contributor Author

TheRealMDoerr commented Oct 13, 2023

That may help debugging. I've added illegal values: 0x 05A looks a bit like OSR and 0x DE0BD sounds a bit like deopt :-)

dest->set_displaced_header(displaced_header());
#ifdef ASSERT
else {
dest->set_displaced_header(markWord(0xde0bd000)); // eye-catcher

Choose a reason for hiding this comment

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

Such constants for debugging purposes are usually defined in a central place:
https://github.com/openjdk/jdk/blob/master/src/hotspot/share/utilities/globalDefinitions.hpp#L1023

It makes sense to follow that practice here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Thanks!
We may remove the displaced header slots and all related code when removing LM_LEGACY.

@TheRealMDoerr
Copy link
Contributor Author

I'm planning to integrate tomorrow if there are no further comments.

@TheRealMDoerr
Copy link
Contributor Author

Thanks for the reviews and the suggestions!
/integrate

@openjdk
Copy link

openjdk bot commented Oct 17, 2023

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

  • 6aa837e: 8316927: JFR: Move shouldCommit check earlier for socket events
  • 5ca1beb: 8317300: javac erroneously allows "final" in front of a record pattern
  • 2bf1863: 8315588: JShell does not accept underscore from JEP 443 even with --enable-preview
  • 15588e0: 8314578: Non-verifiable code is emitted when two guards declare pattern variables in colon-switch
  • e649c56: 8316410: GC: Make TestCompressedClassFlags use createTestJvm
  • 5f4be8c: 8316973: GC: Make TestDisableDefaultGC use createTestJvm
  • a949824: 8317188: G1: Make TestG1ConcRefinementThreads use createTestJvm
  • 7e39e66: 8317042: G1: Make TestG1ConcMarkStepDurationMillis use createTestJvm
  • 75b37e6: 8317218: G1: Make TestG1HeapRegionSize use createTestJvm
  • 34653c1: 8249832: java/util/zip/DataDescriptorSignatureMissing.java uses @ignore w/o bug-id
  • ... and 99 more: https://git.openjdk.org/jdk/compare/ad7a8e86e0334390f87ae44cf749d2b47f1409a1...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Oct 17, 2023

@TheRealMDoerr Pushed as commit d0ea2a5.

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

@TheRealMDoerr TheRealMDoerr deleted the 8318015_no_lock_inflation branch October 17, 2023 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated
4 participants