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

8267399: C2: java/text/Normalizer/ConformanceTest.java test failed with assertion #4388

Closed
wants to merge 2 commits into from

Conversation

rwestrel
Copy link
Contributor

@rwestrel rwestrel commented Jun 7, 2021

This was found with Shenandoah but has nothing specific to Shenandoah.

For the inner loop of the test case:

  • the loop limit, len, is known to be either 1 or 2. As a consequence
    the type of the iv phi is set to [0..2].

  • range check elimination is applied which causes the pre/main/post
    loops to be added and the limit of the main loop to be adjusted. C2
    computes the limit of the main loop as TypeINT:INT.

  • the main loop is peeled. So now the type of the iv phi is 2 and it
    constant folds. Because the main loop limit has type TypeInt::INT,
    the exit condition of the loop doesn't constant fold. But the loop
    no longer has the shape of a counted loop because the iv phi doesn't
    exist anymore.

The crash then occurs when some other loop opts is attempted and loop
strip mining verification code checks that the shape of the main loop
is that of a counted loop.

The fix I propose is to add a CastII at range elimination time that
captures the bounds of the limit before RC is applied. This way the
type of the limit is not lost and the main loop backbranch can be
properly eliminated in the chain of events above.


Progress

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

Issue

  • JDK-8267399: C2: java/text/Normalizer/ConformanceTest.java test failed with assertion

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4388

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

Using diff file

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Jun 7, 2021

👋 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 openjdk bot added the rfr label Jun 7, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Jun 7, 2021

@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 label Jun 7, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Jun 7, 2021

Webrevs

main_limit = new CastIINode(main_limit, TypeInt::make(upward ? min_jint : orig_limit_t->_lo,
upward ? orig_limit_t->_hi : max_jint, Type::WidenMax));
Copy link
Contributor

@vnkozlov vnkozlov Jun 14, 2021

Choose a reason for hiding this comment

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

First, need comment.
Second, why you used min_jint and max_jint instead of main_limit->_lo and main_limit->_hi?

Copy link
Contributor Author

@rwestrel rwestrel Jun 15, 2021

Choose a reason for hiding this comment

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

Thanks for the reviewing this.

Second, why you used min_jint and max_jint instead of main_limit->_lo and main_limit->_hi?

Range check elimination changes the main loop's limit. For a loop going up, the new limit is less or equal to the initial limit. So it's less than main_limit->_hi. But it's not guaranteed to be greater or equal to main_limit->_lo. Say, main_limit is a constant, then main_limit->_lo = main_limit->_hi. The new limit can't be >= main_limit->_lo otherwise the new limit is main_limit->_lo = main_limit->_hi and the limit is unchanged.

Copy link
Contributor Author

@rwestrel rwestrel Jun 15, 2021

Choose a reason for hiding this comment

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

First, need comment.

Comment added.

Copy link
Contributor

@vnkozlov vnkozlov Jun 15, 2021

Choose a reason for hiding this comment

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

What are you saying is that low limit does not matter when stride > 0 and we can use min_jint instead of complex expression (if we want correct value). Is it right?

Copy link
Contributor Author

@rwestrel rwestrel Jun 16, 2021

Choose a reason for hiding this comment

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

Yes, right.

Copy link
Contributor

@vnkozlov vnkozlov left a comment

Good.

@openjdk
Copy link

@openjdk openjdk bot commented Jun 16, 2021

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

8267399: C2: java/text/Normalizer/ConformanceTest.java test failed with assertion

Reviewed-by: kvn, neliasso

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 230 new commits pushed to 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 label Jun 16, 2021
Copy link

@neliasso neliasso left a comment

The bug is filed with fix version 17, but the PR is on 18. I suggest moving this to the 17-repo before pushing.

Otherwise looks good! Reviewed.

@rwestrel
Copy link
Contributor Author

@rwestrel rwestrel commented Jun 21, 2021

@vnkozlov @neliasso thanks for the review. Will open a jdk 17 PR. I think I can even add reviewers with /review so you don't have to review it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-compiler ready rfr
3 participants