Skip to content

8329726: Use non-short forward jumps in lightweight locking #18657

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

Closed
wants to merge 4 commits into from

Conversation

rkennke
Copy link
Contributor

@rkennke rkennke commented Apr 5, 2024

This turns a few short-jumps to long-jumps in x86 lightweight locking code paths. When running with -XX:+ShowMessageBoxOnError, MA::stop() generates more code and jccb is not sufficient to address this.

Two of the jccb are in ASSERT path anyway. However, another is also in a product path. We could generate jccb or jcc conditionally on ShowMessageBoxOnError, however, I don't think it is worth the trouble. WDYT?

Unfortunately, I could not make a simple test-case, because ShowMessageBoxOnError stops and waits on error, which would make jtreg time-out.

Testing:

  • manual test with dacapo as provided in the bug report
  • tier1

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-8329726: Use non-short forward jumps in lightweight locking (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 18657

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 5, 2024

👋 Welcome back rkennke! 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 Apr 5, 2024

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

8329726: Use non-short forward jumps in lightweight locking

Reviewed-by: shade, kvn, aboldtch

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

  • 6439375: 8329533: TestCDSVMCrash fails on libgraal
  • 3ebf8c9: 8329663: hs_err file event log entry for thread adding/removing should print current thread
  • be45de1: 8328627: JShell documentation should be clearer about "remote runtime system"
  • 8648890: 8329749: Obsolete the unused UseNeon flag
  • fc18201: 8327111: Replace remaining usage of create_bool_from_template_assertion_predicate() which requires additional OpaqueLoop*Nodes transformation strategies
  • 7c66465: 8325088: Overloads that differ in type parameters may be lost
  • 6f087cb: 8328698: oopDesc::klass_raw() decodes without a null check
  • d1aad71: 8321204: C2: assert(false) failed: node should be in igvn hash table
  • 51b0abc: 8329340: Remove unused libawt code
  • 3a3b77d: 8329641: RISC-V: Enable some tests related to SHA-2 instrinsic
  • ... and 8 more: https://git.openjdk.org/jdk/compare/27353ad367c2342086d8e56ee2412d796d44b664...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 Apr 5, 2024
@openjdk
Copy link

openjdk bot commented Apr 5, 2024

@rkennke 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 Apr 5, 2024
@mlbridge
Copy link

mlbridge bot commented Apr 5, 2024

Webrevs

Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

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

Sad to give up a short jump in synchronization code just for asserts. Maybe we give up on code readability a bit? E.g.:

#ifdef ASSERT
  // Check that locked label is reached with ZF set.
  Label zf_bad_zero, zf_correct;
  jcc(Assembler::zero, zf_correct);
  jmp(zf_bad_zero)
#endif

  bind(slow_path);

#ifdef ASSERT
  // Check that slow_path label is reached with ZF not set.
  jccb(Assembler::notZero, zf_correct);
  stop("Fast Lock ZF != 0");
  bind(zf_bad_zero);
  stop("Fast Lock ZF != 1");
  bind(zf_correct);
#endif

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.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 5, 2024
@TobiHartmann
Copy link
Member

Unfortunately, I could not make a simple test-case, because ShowMessageBoxOnError stops and waits on error, which would make jtreg time-out.

Although a time out is a bit of a confusing failure mode for the test, I think it would be better than no test at all, right?

@rkennke
Copy link
Contributor Author

rkennke commented Apr 8, 2024

Unfortunately, I could not make a simple test-case, because ShowMessageBoxOnError stops and waits on error, which would make jtreg time-out.

Although a time out is a bit of a confusing failure mode for the test, I think it would be better than no test at all, right?

Right. I added a test-case with a short timeout. It fails without the change, and passes with it.

Copy link
Member

@xmas92 xmas92 left a comment

Choose a reason for hiding this comment

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

lgtm.

@rkennke
Copy link
Contributor Author

rkennke commented Apr 8, 2024

@TobiHartmann could you check the test? I am not sure if the flags are reasonable.

@TobiHartmann
Copy link
Member

Looks good but I think it's safer to use the default timeout because otherwise we risk a false-positive timeout on slow machines when running with additional flags like -XX:+DeoptimizeALot.

@rkennke
Copy link
Contributor Author

rkennke commented Apr 9, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Apr 9, 2024

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

  • e75e1cb: 8329955: Class-File API ClassPrinter does not print bootstrap methods arguments
  • f9bc2db: 8325371: Missing ClassFile.Option in package summary
  • a8fbeec: 8329956: G1: Remove unimplemented collection_set_candidate_short_type_str
  • 3b6629c: 8324673: javacserver failed during build: RejectedExecutionException
  • 5fb5e6c: 8329603: G1: Merge G1BlockOffsetTablePart into G1BlockOffsetTable
  • 2fcb816: 8305072: Win32ShellFolder2.compareTo is inconsistent
  • 635cb3c: 8329745: Update the documentation of ServerSocket and Socket to refer to StandardSocketOptions instead of legacy SocketOptions
  • 5c9f036: 8329858: G1: Make G1VerifyLiveAndRemSetClosure stateless
  • 492b954: 8329750: Change Universe functions to return more specific Klass* types
  • 87131fb: 8329629: GC interfaces should work directly against nmethod instead of CodeBlob
  • ... and 38 more: https://git.openjdk.org/jdk/compare/27353ad367c2342086d8e56ee2412d796d44b664...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Apr 9, 2024

@rkennke Pushed as commit 2e925f2.

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

5 participants