Skip to content

8355574: Fatal error in abort_verify_int_in_range due to Invalid CastII #25284

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

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

Conversation

merykitty
Copy link
Member

@merykitty merykitty commented May 17, 2025

Hi,

The issue here is that the CastLLNode is created before the actual check that ensures the range of the input. This patch fixes it by moving the creation to the correct place, which is under inline_block. I also noticed that the code there seems incorrect and confusing. ArrayCopyNode::get_partial_inline_vector_lane_count takes the length of the array, not the size in bytes. If you look into the method it will multiply const_len with type2aelementbytes(bt) to get the size in bytes of the array. In the runtime test, we compare length << log2(type2bytes(bt)) with ArrayOperationPartialInlineSize. This seems confusing, why don't we just compare length with ArrayOperationPartialInlineSize / type2bytes(bt), it also unifies the test with the actual cast.

Please take a look and leave your reviews, thanks a lot.


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

Warnings

 ⚠️ Patch contains a binary file (src/java.desktop/share/classes/java/awt/doc-files/BorderLayout-1.gif)
 ⚠️ Patch contains a binary file (src/java.desktop/share/classes/java/awt/doc-files/FlowLayout-1.gif)
 ⚠️ Patch contains a binary file (src/java.desktop/share/classes/java/awt/doc-files/GridBagLayout-1.gif)
 ⚠️ Patch contains a binary file (src/java.desktop/share/classes/java/awt/doc-files/GridBagLayout-2.gif)
 ⚠️ Patch contains a binary file (src/java.desktop/share/classes/java/awt/doc-files/GridLayout-1.gif)
 ⚠️ Patch contains a binary file (src/java.desktop/share/classes/java/awt/doc-files/GridLayout-2.gif)

Issue

  • JDK-8355574: Fatal error in abort_verify_int_in_range due to Invalid CastII (Bug - P4)(⚠️ The fixVersion in this issue is [26] but the fixVersion in .jcheck/conf is 25, a new backport will be created when this pr is integrated.)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 25284

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 17, 2025

👋 Welcome back qamai! 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 17, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Pull request is ready for review label May 17, 2025
@openjdk
Copy link

openjdk bot commented May 17, 2025

@merykitty 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.

@mlbridge
Copy link

mlbridge bot commented May 17, 2025

Webrevs

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.

CastLL related change looks good to me. ArrayCopyNode::get_partial_inline_vector_lane_count() looks reasonable but let's see what @jatin-bhateja thinks.

}
return lane_count;
// As an optimization, choose the optimal vector size for bounded copy length
int ArrayCopyNode::get_partial_inline_vector_lane_count(BasicType type, jlong max_len) {
Copy link
Contributor

@rwestrel rwestrel May 20, 2025

Choose a reason for hiding this comment

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

@jatin-bhateja you wrote this code. What do you think of the proposed change?

Copy link
Contributor

@iwanowww iwanowww left a comment

Choose a reason for hiding this comment

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

Overall, looks good.

const_len = lty->get_con() << shift;
int inline_limit = ArrayOperationPartialInlineSize / type2aelembytes(type);

const TypeLong* length_type = _igvn.type(length)->isa_long();
Copy link
Contributor

Choose a reason for hiding this comment

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

Any particular benefit in eagerly pruning the block? It duplicates post-expansion GVN checks of the branch condition. (If it were normal parsing with prompt GVN analysis, you could detect the branch is dead right after generate_guard call.)

Alternatively, the checks are equivalent to checking that join of length_type with [0...inline_limit] is not empty. But I prefer to let GVN handle it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it is a trivial check and it is much more efficient than creating a bunch of nodes and removing them later.

@TobiHartmann
Copy link
Member

Just a reminder that since this is a P4, the fix would need to be integrated until RDP 2 on Thursday (June 5) this week (or we need to raise the priority).

@openjdk
Copy link

openjdk bot commented Jun 4, 2025

@merykitty this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout misplacedcastll
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-compiler [email protected] merge-conflict Pull request has merge conflict with target branch rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

4 participants