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

8266480: Implicit null check optimization does not update control of hoisted memory operation #4093

Closed
wants to merge 1 commit into from

Conversation

TobiHartmann
Copy link
Member

@TobiHartmann TobiHartmann commented May 18, 2021

C2 replaces explicit null checks by hoisting a nearby memory operation to the null check and using it as implicit null check. In some cases, control of that memory operation is not updated correctly, leading to assert failures during PhaseCFG::verify() because a use is no longer dominated by its definition.

After matching, the graph looks like this:

64 testP_reg is an explicit null check and 78 loadD, 73 storeD and 77 storeImmI are candidates for an implicit null check because they are operating on the same oop. PhaseCFG::implicit_null_check decides to hoist the 77 storeImmI from the not_null_block B12 to the null check in B11/B13:

Now the problem is that control of 77 storeImmI was not updated and still points into the non-dominating block B15. The following code is supposed to fix this:

// Move the control dependence if it is pinned to not-null block.
// Don't change it in other cases: NULL or dominating control.
if (best->in(0) == not_null_block->head()) {
// Set it to control edge of null check.
best->set_req(0, proj->in(0)->in(0));
}

However, it does not trigger because control is not the not_null_block->head() but 59 MachProj which is the control projection from 60 CallLeafDirect emitted by a drem. The fix is to simply check get_block_for_node(ctrl) instead.

This is an old issue that was only caught by the assert recently introduced by JDK-8263227.

Thanks,
Tobias


Progress

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

Issue

  • JDK-8266480: Implicit null check optimization does not update control of hoisted memory operation

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4093

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented May 18, 2021

👋 Welcome back thartmann! 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 May 18, 2021

@TobiHartmann 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 May 18, 2021
@TobiHartmann TobiHartmann marked this pull request as ready for review May 18, 2021 14:20
@openjdk openjdk bot added the rfr Pull request is ready for review label May 18, 2021
@mlbridge
Copy link

mlbridge bot commented May 18, 2021

Webrevs

@neliasso
Copy link

Does nodes 73, 77 and 78 touch different memory slices? Otherwise 78 should be anti-dependent on 73 and 77.

@TobiHartmann
Copy link
Member Author

Yes, exactly. They are accessing the double and int slices corresponding to dFld and iFld accesses.

Copy link

@neliasso neliasso 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!

@openjdk
Copy link

openjdk bot commented May 18, 2021

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

8266480: Implicit null check optimization does not update control of hoisted memory operation

Reviewed-by: neliasso, kvn

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

  • 10236e7: 8263242: serviceability/sa/ClhsdbFindPC.java cannot find MaxJNILocalCapacity with ASLR
  • e6705c0: 8266949: Check possibility to disable OperationTimedOut on Unix
  • b92c5a4: 8265292: [macos_aarch64] java/foreign/TestDowncall.java crashes with SIGBUS
  • fadf580: 8262952: [macos_aarch64] os::commit_memory failure
  • f8f40ab: 8230486: G1BarrierSetAssembler::g1_write_barrier_post unnecessarily pushes/pops new_val
  • 9d168e2: 8266973: Migrate to ClassHierarchyIterator when enumerating subclasses
  • 02507bc: 8267166: Remove test file vmTestbase/vm/mlvm/tools/LoadClass.java
  • ce88b33: 8266615: C2 incorrectly folds subtype checks involving an interface array

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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 May 18, 2021
@TobiHartmann
Copy link
Member Author

Thanks, Nils!

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.

@TobiHartmann
Copy link
Member Author

Thanks, Vladimir!

@TobiHartmann
Copy link
Member Author

/integrate

@openjdk openjdk bot closed this May 19, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 19, 2021
@openjdk
Copy link

openjdk bot commented May 19, 2021

@TobiHartmann Since your change was applied there have been 15 commits pushed to the master branch:

  • 3f883e8: 8267351: runtime/cds/SharedBaseAddress.java fails on x86_32 due to Unrecognized VM option 'UseCompressedOops'
  • 7aa6568: 8256973: Intrinsic creation for VectorMask query (lastTrue,firstTrue,trueCount) APIs
  • 65a8bf5: 8265126: [REDO] unified handling for VectorMask object re-materialization during de-optimization
  • ff84577: 8267098: AArch64: C1 StubFrames end confusingly
  • 0daec49: 8267246: -XX:MaxRAMPercentage=0 is unreasonable for jtreg tests on many-core machines
  • 324defe: 8267212: test/jdk/java/util/Collections/FindSubList.java intermittent crash with "no reachable node should have no use"
  • bdbe23b: 8265462: Handle multiple slots in the NSS Internal Module from SunPKCS11's Secmod
  • 10236e7: 8263242: serviceability/sa/ClhsdbFindPC.java cannot find MaxJNILocalCapacity with ASLR
  • e6705c0: 8266949: Check possibility to disable OperationTimedOut on Unix
  • b92c5a4: 8265292: [macos_aarch64] java/foreign/TestDowncall.java crashes with SIGBUS
  • ... and 5 more: https://git.openjdk.java.net/jdk/compare/894547d2c102dcbe1f9ec8a1edb11c6b31e4270e...master

Your commit was automatically rebased without conflicts.

Pushed as commit c2b50f9.

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

3 participants