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

8346184: C2: assert(has_node(i)) failed during split thru phi #22818

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rwestrel
Copy link
Contributor

@rwestrel rwestrel commented Dec 18, 2024

The assert fires during split thru phi because a call to Identity
returns a new node (a constant null pointer). That happens because a
Load, once pushed thru phi, can be constant folded because it loads
from a newly allocated array. Identity shouldn't return new
nodes. When split thru phi runs, in this case, Value should be the
one returning constant null, not Identity. There is logic for that
in LoadNode::Value but it's after some other checks that cause
Value to return too early.

To fix this, I propose reordering checks in LoadNode::Value.


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-8346184: C2: assert(has_node(i)) failed during split thru phi (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22818

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 18, 2024

👋 Welcome back roland! 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 Dec 18, 2024

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

8346184: C2: assert(has_node(i)) failed during split thru phi

Reviewed-by: chagedorn

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

  • f6e7713: 8339356: Test javax/net/ssl/SSLSocket/Tls13PacketSize.java failed with java.net.SocketException: An established connection was aborted by the software in your host machine
  • 23d6f74: 8346463: Add test coverage for deploying the default provider as a module
  • 484229e: 8346306: Unattached thread can cause crash during VM exit if it calls wait_if_vm_exited
  • b0c40aa: 8340401: DcmdMBeanPermissionsTest.java and SystemDumpMapTest.java fail with assert(_stack_base != nullptr) failed: Sanity check
  • 6b89954: 8346475: RISC-V: Small improvement for MacroAssembler::ctzc_bit
  • 00d8407: 8346016: Problemlist vm/mlvm/indy/func/jvmti/mergeCP_indy2manyDiff_a in virtual thread mode
  • 5db0a13: 8346132: fallbacklinker.c failed compilation due to unused variable
  • 5590669: 8346570: SM cleanup of tests for Beans and Serialization
  • c8e94ab: 8346532: XXXVector::rearrangeTemplate misses null check
  • f7f2b42: 8346300: Add @test annotation to TCKZoneId.test_constant_OLD_IDS_POST_2024b test
  • ... and 80 more: https://git.openjdk.org/jdk/compare/0ad64234e2fd19ec0435fb00340120153b928f9c...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 Dec 18, 2024
@openjdk
Copy link

openjdk bot commented Dec 18, 2024

@rwestrel 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 Dec 18, 2024
@mlbridge
Copy link

mlbridge bot commented Dec 18, 2024

Webrevs

Copy link
Member

@chhagedorn chhagedorn left a comment

Choose a reason for hiding this comment

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

Looks reasonable. Does the new node come from here?

if (ReduceBulkZeroing || find_array_copy_clone(ld_alloc, in(MemNode::Memory)) == nullptr) {
// If ReduceBulkZeroing is disabled, we need to check if the allocation does not belong to an
// ArrayCopyNode clone. If it does, then we cannot assume zero since the initialization is done
// by the ArrayCopyNode.
return phase->zerocon(memory_type());

Should we generally add some verification code that Identity() does not create new nodes? Hard to do it at all places but it could, for example, be done in the transform() methods of GVN and IGVN when calling Identity(). But of course, should probably be done in a separate RFE.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 19, 2024
@chhagedorn
Copy link
Member

The new test is failing with the following flags on linux-x64-debug:

-XX:-TieredCompilation -XX:+StressReflectiveCode -XX:-ReduceInitialCardMarks -XX:-ReduceBulkZeroing -XX:-ReduceFieldZeroing

Failure:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/49f0d299-805f-43f1-8a74-e67c7385a574-S24/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/7236421f-9d14-4db4-8d55-50f4b96324bd/runs/a8cf3c0e-8858-4049-aa6b-7542a0f8b292/workspace/open/src/hotspot/share/opto/loopnode.hpp:1003), pid=763505, tid=763528
#  Error: assert(has_node(i)) failed
..........
C2:196   46 %  b        TestLoadSplitThruPhiNull::test1 @ 18 (108 bytes)

Stack: [0x00007f92584f2000,0x00007f92585f2000],  sp=0x00007f92585ecd90,  free space=1003k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x12f7d54]  PhaseIdealLoop::get_ctrl(Node const*)+0x3e4  (loopnode.hpp:1003)
V  [libjvm.so+0x1340cc4]  PhaseIdealLoop::split_thru_phi(Node*, Node*, int)+0x524  (loopopts.cpp:192)
V  [libjvm.so+0x1345cb4]  PhaseIdealLoop::split_if_with_blocks_pre(Node*)+0x2a4  (loopopts.cpp:1226)
V  [libjvm.so+0x134abf5]  PhaseIdealLoop::split_if_with_blocks(VectorSet&, Node_Stack&)+0x1f5  (loopopts.cpp:1982)
V  [libjvm.so+0x133c5d6]  PhaseIdealLoop::build_and_optimize()+0x10a6  (loopnode.cpp:4889)
V  [libjvm.so+0xa58e58]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x3a8  (loopnode.hpp:1113)

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 ready Pull request is ready to be integrated rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

2 participants