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

8303466: C2: failed: malformed control flow. Limit type made precise with MaxL/MinL #529

Closed
wants to merge 1 commit into from

Conversation

martinuy
Copy link
Contributor

@martinuy martinuy commented Jun 27, 2024

Hi,

I would like to propose a backport of 8303466 [1] to jdk8u. jdk8u can benefit from this fix and having more accurate limit type information.

This pull request contains a backport of commit 8578e12c423ed61618e0b3ef81e5be3d18be1da2 from the openjdk/jdk11u-dev repository.

This backport depends on JDK-8262017.

The jdk11u patch does not apply cleanly because of the following:

  • hotspot/src/share/vm/opto/addnode.hpp

    • 8u does not have 8212043. Manually applied the change.
  • hotspot/src/share/vm/runtime/vmStructs.cpp

    • 8u does not have 8212043. Manually applied the change.
  • hotspot/src/share/vm/opto/macro.cpp

    • 8u does not have 8204210. Manually applied the change.
    • 8u does not have 8186027. Manually applied the change.
  • hotspot/src/share/vm/opto/loopTransform.cpp

    • 8u does not have 8223142. In addition, 8u does not have 8034812. Manually applied the change.
    • 8u does not have 8182299. Manually applied the change.

In addition, the following changes were made:

  • Nodes allocation follows the pattern "new (C) ..." instead of "new ...".

  • File locations were adjusted.

  • In addnode.cpp, 8u does not have 8284358 so the function "Node::set_req_X(uint i, Node *n, PhaseGVN *gvn)" is not available. Picked this function (declaration and definition) from 8284358.

  • In 8u, the jtreg VM prop vm.compiler2.enabled does not exist. C2 will likely be available and if the test were executed without C2, it should be harmless.

No regressions observed in hotspot:tier1.

Thanks,
Martin.-

--
[1] - https://bugs.openjdk.org/browse/JDK-8303466


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
  • JDK-8303466 needs maintainer approval

Issue

  • JDK-8303466: C2: failed: malformed control flow. Limit type made precise with MaxL/MinL (Bug - P3 - Approved)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk8u-dev.git pull/529/head:pull/529
$ git checkout pull/529

Update a local copy of the PR:
$ git checkout pull/529
$ git pull https://git.openjdk.org/jdk8u-dev.git pull/529/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 529

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk8u-dev/pull/529.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 27, 2024

👋 Welcome back mbalao! A progress list of the required criteria for merging this PR into pr/528 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 Jun 27, 2024

@martinuy This change now passes all automated pre-integration checks.

After integration, the commit message for the final commit will be:

8303466: C2: failed: malformed control flow. Limit type made precise with MaxL/MinL

Reviewed-by: andrew, roland

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 no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential 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 changed the title Backport cc894d849aa5f730d5a806acfc7a237cf5170af1 8303466: C2: failed: malformed control flow. Limit type made precise with MaxL/MinL Jun 27, 2024
@openjdk
Copy link

openjdk bot commented Jun 27, 2024

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added the backport label Jun 27, 2024
@openjdk-notifier openjdk-notifier bot changed the base branch from pr/528 to master June 28, 2024 16:06
@openjdk-notifier
Copy link

The parent pull request that this pull request depends on has now been integrated and the target branch of this pull request has been updated. This means that changes from the dependent pull request can start to show up as belonging to this pull request, which may be confusing for reviewers. To remedy this situation, simply merge the latest changes from the new target branch into this pull request by running commands similar to these in the local repository for your personal fork:

git checkout JDK-8303466
git fetch https://git.openjdk.org/jdk8u-dev.git master
git merge FETCH_HEAD
# if there are conflicts, follow the instructions given by git merge
git commit -m "Merge master"
git push

@martinuy martinuy marked this pull request as ready for review June 28, 2024 16:28
@openjdk openjdk bot added the rfr Pull request is ready for review label Jun 28, 2024
@mlbridge
Copy link

mlbridge bot commented Jun 28, 2024

Webrevs

@martinuy
Copy link
Contributor Author

GHA test failures notes:

The GHA test CheckAllocateAndSystemGC doesn't seem to be stable in Linux x86: it has failed before (see PR #427 and run here) and the failure looks unrelated to this change.

The GHA test TestCMSHeapSizeFlags doesn't seem to be stable either in Linux x86: in the previous run of this PR (before the rebase made after the integration of 8262017 to 8u-dev) it was passing for example, and no code changes were introduced between the two.

Copy link
Member

@gnu-andrew gnu-andrew 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 to me. The change is largely the same as 11u; if we ignore whitespace differences, most of the changes come down to the need for additional casts in 8u. Adding the set_req_X helper function here seems fine, without backporting an unrelated fix and the consequential risk.

@openjdk
Copy link

openjdk bot commented Jun 29, 2024

⚠️ @martinuy This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

@martinuy
Copy link
Contributor Author

/approval request jdk8u is affected by this bug and would benefit from its fix. The patch does not apply cleanly but has been reviewed.

@openjdk
Copy link

openjdk bot commented Jun 29, 2024

@martinuy
8303466: The approval request has been created successfully.

@openjdk openjdk bot added the approval label Jun 29, 2024
Copy link
Contributor

@rwestrel rwestrel 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 to me.

@gnu-andrew
Copy link
Member

/approve yes

@openjdk
Copy link

openjdk bot commented Jul 1, 2024

@gnu-andrew
8303466: The approval request has been approved.

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed approval labels Jul 1, 2024
@martinuy
Copy link
Contributor Author

martinuy commented Jul 1, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Jul 1, 2024

Going to push as commit 54f7734.

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

openjdk bot commented Jul 1, 2024

@martinuy Pushed as commit 54f7734.

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

virtual const Type* add_id() const { return TypeLong::make(min_jlong); }
virtual const Type* bottom_type() const { return TypeLong::LONG; }
virtual uint ideal_reg() const { return Op_RegL; }
virtual Node* Identity(PhaseGVN* phase);
Copy link

Choose a reason for hiding this comment

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

Is it OK that MaxLNode::Identity has different signature than AddNode::Identity?

  virtual Node *Identity( PhaseTransform *phase );

Tha same question is for MinLNode and ConvI2LNode.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, as JDK-8146629 (openjdk/jdk11u@69b52aa) doesn't have a 8u backport, it would have been neater to have PhaseTransform* phase.

What happened here is that neither the patch application nor the compilation failed, since PhaseGVN inherits from PhaseValues, which inherits from PhaseTransform.

However, there shouldn't be any issue, as the C++ type system is ensuring that all the callers are passing a PhaseGVN pointer.

Copy link

@wkia wkia Jul 2, 2024

Choose a reason for hiding this comment

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

Compilation didn't fail because not all the warnings are enabled.

Enabling -Woverloaded-virtual causes a number of warnings like the following:

hotspot/src/share/vm/opto/addnode.hpp:50:17: error: ‘virtual Node* AddNode::Identity(PhaseTransform*)’ was hidden [-Werror=overloaded-virtual]
   50 |   virtual Node *Identity( PhaseTransform *phase );
hotspot/src/share/vm/opto/addnode.hpp:312:17: error:   by ‘virtual Node* MinLNode::Identity(PhaseGVN*)’ [-Werror=overloaded-virtual]
  312 |   virtual Node* Identity(PhaseGVN* phase);

that may point to a serious bug.

In few words, MinLNode::Identity may be never called in case:

AddNode *obj = new MinLNode;
obj->Identity(...); // AddNode::Identity() is called.

Copy link
Contributor

Choose a reason for hiding this comment

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

You are right, I was missing the MaxLNodeMaxNodeAddNode inheritance and the fact that MaxLNode::Identity(PhaseGVN* phase) doesn't override but hides AddNode::Identity(PhaseTransform* phase), sorry for the confusion.

After my comment, we continued analyzing it with @martinuy and arrived to similar conclusions. We'll be proposing a fix for this later today.

Copy link
Contributor

Choose a reason for hiding this comment

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

As this pull request is already integrated, I have created the JDK-8335552: [8u] JDK-8303466 backport to 8u requires 3 ::Identity signature fixes follow up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

5 participants