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

8299721: [Vector API] assert in switch-default of LibraryCallKit::arch_supports_vector_rotate is too weak to catch bugs #11877

Closed
wants to merge 1 commit into from

Conversation

DamonFool
Copy link
Member

@DamonFool DamonFool commented Jan 6, 2023

Hi all,

The switch-default path of LibraryCallKit::arch_supports_vector_rotate means runtime error.
This is because lshiftopc@Line136 and rshiftopc@Line137 would be undefined if the switch-default path is taken.

 115   int lshiftopc, rshiftopc;
 116   switch(elem_bt) {
 117     case T_BYTE:
 118       lshiftopc = Op_LShiftI;
 119       rshiftopc = Op_URShiftB;
 120       break;
 121     case T_SHORT:
 122       lshiftopc = Op_LShiftI;
 123       rshiftopc = Op_URShiftS;
 124       break;
 125     case T_INT:
 126       lshiftopc = Op_LShiftI;
 127       rshiftopc = Op_URShiftI;
 128       break;
 129     case T_LONG:
 130       lshiftopc = Op_LShiftL;
 131       rshiftopc = Op_URShiftL;
 132       break;
 133     default:
 134       assert(false, "Unexpected type");
 135   }
 136   int lshiftvopc = VectorNode::opcode(lshiftopc, elem_bt);   <--- lshiftopc is undefine with the default path
 137   int rshiftvopc = VectorNode::opcode(rshiftopc, elem_bt);   <--- rshiftopc is undefine with the default path

So to prevent potential bugs, it would be better to stop and print an error msg even with release VMs, which is done by other switch-default statements in the file.

Thanks.
Best regards,
Jie


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-8299721: [Vector API] assert in switch-default of LibraryCallKit::arch_supports_vector_rotate is too weak to catch bugs

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11877

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

Using diff file

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

…h_supports_vector_rotate is too weak to catch bugs
@bridgekeeper
Copy link

bridgekeeper bot commented Jan 6, 2023

👋 Welcome back jiefu! 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 Jan 6, 2023
@openjdk
Copy link

openjdk bot commented Jan 6, 2023

@DamonFool 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 Jan 6, 2023
@mlbridge
Copy link

mlbridge bot commented Jan 6, 2023

Webrevs

Copy link
Member

@jatin-bhateja jatin-bhateja left a comment

Choose a reason for hiding this comment

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

Rotate operation only works on integral type vectors. But its good to add a fatal msg.
Thanks!

@openjdk
Copy link

openjdk bot commented Jan 6, 2023

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

8299721: [Vector API] assert in switch-default of LibraryCallKit::arch_supports_vector_rotate is too weak to catch bugs

Reviewed-by: jbhateja

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

  • b5b7948: 8298240: Replace the usage of ImageLayoutException by the CMMException
  • 99be740: 8299306: Test "javax/swing/JFileChooser/FileSystemView/CustomFSVLinkTest.java" fails on Windows 10 x64 because there are some buttons did not display button name

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 Jan 6, 2023
@DamonFool
Copy link
Member Author

Rotate operation only works on integral type vectors. But its good to add a fatal msg. Thanks!

Thanks @jatin-bhateja for your quick review.
In real workloads with release VMs, the assert isn't enough to catch the bug since it would just fallback to un-inlined version.
Do you think it is trivial?

@jatin-bhateja
Copy link
Member

Rotate operation only works on integral type vectors. But its good to add a fatal msg. Thanks!

Thanks @jatin-bhateja for your quick review. In real workloads with release VMs, the assert isn't enough to catch the bug since it would just fallback to un-inlined version. Do you think it is trivial?

Yes, I agree fatal is correct alternative, your fix look correct, if you see an assertion failure it will be good to capture it in a test.
Best Regards.

@DamonFool
Copy link
Member Author

Yes, I agree fatal is correct alternative, your fix look correct, if you see an assertion failure it will be good to capture it in a test.

Thanks @jatin-bhateja .

We don't have a jtreg test.
It was discovered in our internal weekly code review discussion.
Thanks.

/integrate

@openjdk
Copy link

openjdk bot commented Jan 6, 2023

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

  • 5598acc: 8294403: [REDO] make test should report only on executed tests
  • 88f0ea7: 8299726: [cleanup] Some code cleanup in opto/compile.hpp
  • 0234f81: 8298447: Unnecessary Vector usage in DocPrintJob implementations
  • cc4936a: 8298720: Insufficient error handling when CodeBuffer is exhausted
  • b5b7948: 8298240: Replace the usage of ImageLayoutException by the CMMException
  • 99be740: 8299306: Test "javax/swing/JFileChooser/FileSystemView/CustomFSVLinkTest.java" fails on Windows 10 x64 because there are some buttons did not display button name

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jan 6, 2023

@DamonFool Pushed as commit 8cc1669.

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

@DamonFool DamonFool deleted the JDK-8299721 branch January 6, 2023 12:58
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
2 participants