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

8271276: C2: Wrong JVM state used for receiver null check #5150

Closed
wants to merge 2 commits into from

Conversation

iwanowww
Copy link

@iwanowww iwanowww commented Aug 17, 2021

JDK-8257211 enabled call devirtualization during post-parse phase. When a virtual call is replaced, there is a receiver null check inserted, but wrong JVM state is picked up (arguments vs locals). (GraphKit::null_check_receiver_before_call() should have been used instead).

Instead of fixing the problematic null check, I decided to completely remove it because it is redundant: all relevant CallGenerators already issue a receiver null check when one is required.

Testing: hs-tier1 - hs-tier6


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8271276: C2: Wrong JVM state used for receiver null check

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5150/head:pull/5150
$ git checkout pull/5150

Update a local copy of the PR:
$ git checkout pull/5150
$ git pull https://git.openjdk.java.net/jdk pull/5150/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5150

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5150.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Aug 17, 2021

👋 Welcome back vlivanov! 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 openjdk bot commented Aug 17, 2021

@iwanowww 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 label Aug 17, 2021
@iwanowww iwanowww marked this pull request as ready for review Aug 17, 2021
@openjdk openjdk bot added the rfr label Aug 17, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Aug 17, 2021

Webrevs

Copy link
Contributor

@vnkozlov vnkozlov left a comment

Good.

I assume you are talking about this existing null check code for virtual call receiver:
callGenerator.cpp#L242

@vnkozlov
Copy link
Contributor

@vnkozlov vnkozlov commented Aug 17, 2021

I don't see link to testing in bug report.

@openjdk
Copy link

@openjdk openjdk bot commented Aug 17, 2021

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

8271276: C2: Wrong JVM state used for receiver null check

Reviewed-by: kvn, thartmann

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

  • 5189047: 8272558: IR Test Framework README misses some flags
  • ec63957: 8272398: Update DockerTestUtils.buildJdkDockerImage()
  • 14623cd: 8270835: regression after JDK-8261006
  • fe72197: 8272551: mark hotspot runtime/modules tests which ignore external VM flags
  • 05d64da: 8272291: mark hotspot runtime/logging tests which ignore external VM flags
  • a68b5b9: 8272369: java/io/File/GetXSpace.java failed with "RuntimeException: java.nio.file.NoSuchFileException: /run/user/0"
  • a199ebc: 8272581: sun/security/pkcs11/Provider/MultipleLogins.sh fails after JDK-8266182
  • 1cbf41a: 8225083: Remove Google certificate that is expiring in December 2021
  • cf64c3e: 8272326: java/util/Random/RandomTestMoments.java had two Gaussian fails
  • 2ed7b70: 8272521: Remove unused PSPromotionManager::_claimed_stack_breadth
  • ... and 2 more: https://git.openjdk.java.net/jdk/compare/0e3fde6c3c2f5c05777b79ff5eb1188014269b0f...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 label Aug 17, 2021
@iwanowww
Copy link
Author

@iwanowww iwanowww commented Aug 17, 2021

I assume you are talking about this existing null check code for virtual call receiver:
callGenerator.cpp#L242

No, the relevant places are callGenerator.cpp#L166, callGenerator.cpp#L924, callGenerator.cpp#L1291, and parse1.cpp#L1130.

My observation is if there's a fresh CallGenerator constructed in LateInlineVirtualCallGenerator::do_late_inline_check(), it always handles receiver null check itself.

@vnkozlov
Copy link
Contributor

@vnkozlov vnkozlov commented Aug 17, 2021

I thought VirtualCallGenerator::generate() will be call by following inline_cg()->generate(jvms) at line #740 (for virtual calls) and it will generate null check I pointed.

The lines you pointed are for other types of calls.

Anyway, changes are fine since all *CallGenerator::generate() methods do null check as we see.

Copy link
Member

@TobiHartmann TobiHartmann left a comment

Looks good.

@iwanowww
Copy link
Author

@iwanowww iwanowww commented Aug 18, 2021

Thanks for the reviews, Vladimir and Tobias.

/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Aug 18, 2021

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

  • 79a06df: 8272567: [IR Framework] Make AbstractInfo.getRandom() static
  • 481c1f0: 8269951: [macos] Focus not painted in JButton when setBorderPainted(false) is invoked
  • 5189047: 8272558: IR Test Framework README misses some flags
  • ec63957: 8272398: Update DockerTestUtils.buildJdkDockerImage()
  • 14623cd: 8270835: regression after JDK-8261006
  • fe72197: 8272551: mark hotspot runtime/modules tests which ignore external VM flags
  • 05d64da: 8272291: mark hotspot runtime/logging tests which ignore external VM flags
  • a68b5b9: 8272369: java/io/File/GetXSpace.java failed with "RuntimeException: java.nio.file.NoSuchFileException: /run/user/0"
  • a199ebc: 8272581: sun/security/pkcs11/Provider/MultipleLogins.sh fails after JDK-8266182
  • 1cbf41a: 8225083: Remove Google certificate that is expiring in December 2021
  • ... and 4 more: https://git.openjdk.java.net/jdk/compare/0e3fde6c3c2f5c05777b79ff5eb1188014269b0f...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Aug 18, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Aug 18, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Aug 18, 2021

@iwanowww Pushed as commit e8f1219.

💡 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 integrated
3 participants