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

8297600: Check current thread in selected JRT_LEAF methods #11359

Closed
wants to merge 2 commits into from

Conversation

shipilev
Copy link
Member

@shipilev shipilev commented Nov 24, 2022

With JDK-8275286, we added the Thread::current() checks for most of the JRT entries. But JRT_LEAF is still not checked, because not every JRT_LEAF carries a JavaThread argument. Having assertions there helps for two reasons. First, these methods can be called from the stub/compiler code, which might be erroneous with thread handling (especially in x86_32 that does not have a dedicated thread register). Second, in the post-Loom world, current thread can change suddenly, as evidenced here: https://mail.openjdk.org/pipermail/hotspot-compiler-dev/2022-November/060779.html.

We can add the thread checks to relevant JRT_LEAF methods that accept JavaThread* too.

Additional testing:

  • Linux x86_64 fastdebug tier1
  • Linux x86_64 fastdebug tier2
  • Linux x86_32 fastdebug tier1
  • Linux x86_32 fastdebug tier2

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-8297600: Check current thread in selected JRT_LEAF methods

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11359

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 24, 2022

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

openjdk bot commented Nov 24, 2022

@shipilev The following labels will be automatically applied to this pull request:

  • hotspot
  • shenandoah

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added hotspot hotspot-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org labels Nov 24, 2022
@mlbridge
Copy link

mlbridge bot commented Nov 24, 2022

Webrevs

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

Unclear for many JVMCI functions that the thread argument is actually intended/required to be the current thread. It seems unused in many cases so why is it passed?

src/hotspot/share/jvmci/jvmciRuntime.cpp Outdated Show resolved Hide resolved
src/hotspot/share/jvmci/jvmciRuntime.cpp Outdated Show resolved Hide resolved
src/hotspot/share/jvmci/jvmciRuntime.cpp Outdated Show resolved Hide resolved
@shipilev
Copy link
Member Author

Unclear for many JVMCI functions that the thread argument is actually intended/required to be the current thread. It seems unused in many cases so why is it passed?

Yes, I agree the initial patch over-reached in some places. Please see new commit, which reduces it. I left thread == JavaThread::current() checks where I can argue the threads are expected to be current.

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

That seems more recognisably correct. It would be even better if thread were named current in those cases where it must be, but that is a separate RFE.

Thanks.

@openjdk
Copy link

openjdk bot commented Nov 29, 2022

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

8297600: Check current thread in selected JRT_LEAF methods

Reviewed-by: dholmes, coleenp

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

  • e2d71c0: 8297481: Create a regression test for JDK-4424517
  • f4063a3: 8297210: Add a @sealedGraph tag to selected java.desktop classes
  • 2084451: 8078471: Backspace does not work in JFileChooser with GTK L&F
  • 7af6b4b: 8296012: jshell crashes on mismatched record pattern
  • ae5b1f7: 8297685: Typo in NullPointerException description specified by Locale.lookup
  • 3ce0042: 8297780: Problem list java/awt/Frame/RestoreToOppositeScreen/RestoreToOppositeScreen.java
  • b778cd5: 8295010: Reduce if required in EC limbs operations
  • 54e6d6a: 8293488: Add EOR3 backend rule for aarch64 SHA3 extension
  • 69ede5b: 8293177: Verify version numbers in legal files
  • cd6bebb: 8247645: ChaCha20 intrinsics
  • ... and 53 more: https://git.openjdk.org/jdk/compare/3c4d5204ff96280b123f42a8cfbaef308e470b69...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 Nov 29, 2022
Copy link
Contributor

@coleenp coleenp left a comment

Choose a reason for hiding this comment

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

I thought this was going to be in the JRT_LEAF macro in interfaceSupport.inline.hpp but this seems fine.

@shipilev
Copy link
Member Author

Thanks! I am integrating then.

/integrate

@openjdk
Copy link

openjdk bot commented Nov 30, 2022

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

  • f05bfb1: 8297515: serialVersionUID fields are not annotated with @serial
  • 22f5d01: 8252584: HotSpot Style Guide should permit alignas
  • 8ffed34: 8297681: Unnecessary color conversion during 4BYTE_ABGR_PRE to INT_ARGB_PRE blit
  • abe532a: 8296924: C2: assert(is_valid_AArch64_address(dest.target())) failed: bad address
  • 5dcaf6c: 8297749: Remove duplicate space in the ProtocolException message being thrown from HttpURLConnection
  • c7a679f: 8297290: Use int indices to reference CDS archived primitive mirrors
  • 37f613b: 8297676: DataBuffer.TYPE_SHORT/TYPE_FLOAT/TYPE_DOUBLE are not placeholders
  • 87f00f4: 8296878: Document Filter attached to JPasswordField and setText("") is not cleared instead inserted characters replaced with unicode null characters
  • 9ced2ea: 8297311: Improve exception message thrown by java.net.HostPortrange::toLowerCase(String s)
  • defe060: 8296905: Replace the native LCMS#getProfileID() method with the accessor
  • ... and 65 more: https://git.openjdk.org/jdk/compare/3c4d5204ff96280b123f42a8cfbaef308e470b69...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Nov 30, 2022

@shipilev Pushed as commit b3501fd.

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

@shipilev shipilev deleted the JDK-8297600-check-jrt-leaf branch January 4, 2023 10:17
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 shenandoah shenandoah-dev@openjdk.org
3 participants