Navigation Menu

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

8283641: Large value for CompileThresholdScaling causes assert #7944

Conversation

iklam
Copy link
Member

@iklam iklam commented Mar 24, 2022

Please review this trivial fix that checks for overflow of (intx)(threshold * scale)

Before:

$ java -XX:CompileThresholdScaling=12345678901234567890.0 -version
...
# Internal Error (/jdk/open/src/hotspot/share/utilities/powerOfTwo.hpp:54), pid=4147940, tid=4147941
# assert(value > T(0)) failed: value must be > 0

After:

$ java -XX:CompileThresholdScaling=12345678901234567890.0 -version
intx Tier0InvokeNotifyFreqLog=32 is outside the allowed range [ 0 ... 30 ]
...
OnStackReplacePercentage cannot be validated because CompileThreshold value is invalid
CompileThreshold (9223372036854775807) must be between 0 and 1073741823
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Tested with tiers 1-2.


Progress

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

Issue

  • JDK-8283641: Large value for CompileThresholdScaling causes assert

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 7944

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 24, 2022

👋 Welcome back iklam! 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 Mar 24, 2022

@iklam 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 Mar 24, 2022
@iklam iklam marked this pull request as ready for review March 24, 2022 17:22
@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 24, 2022
@mlbridge
Copy link

mlbridge bot commented Mar 24, 2022

Webrevs

double v = threshold * scale;
if (v > max_intx) {
return max_intx;
} else if (v < min_intx) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This check is meaningless since v can't be negative. If you want you can add assert.

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 removed the min_intx check and added the asserts. I ran with the following tests and it didn't trigger the asserts. I'll rerun tiers 1-3 again.

java -XX:CompileThreshold=-1         -XX:CompileThresholdScaling=1 -version
java -XX:Tier0InvokeNotifyFreqLog=-2 -XX:CompileThresholdScaling=1 -version
java -XX:Tier4BackEdgeThreshold=-2   -XX:CompileThresholdScaling=1 -version

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, there is range() checks for these flags declarations:

java -XX:CompileThreshold=-1         -XX:CompileThresholdScaling=1 -version
OnStackReplacePercentage cannot be validated because CompileThreshold value is invalid
CompileThreshold (-1) must be between 0 and 1073741823
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

You can't specify negative Threshold values on command line. The assert is for some future case if we pass incorrect value.

Copy link
Contributor

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

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

Good.

@openjdk
Copy link

openjdk bot commented Mar 24, 2022

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

8283641: Large value for CompileThresholdScaling causes assert

Reviewed-by: kvn

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 1 new commit pushed to the master branch:

  • a7e9883: 8283467: runtime/Thread/StopAtExit.java needs updating

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 Mar 24, 2022
@iklam
Copy link
Member Author

iklam commented Mar 24, 2022

Thanks @vnkozlov for the review.
/integrate

@openjdk
Copy link

openjdk bot commented Mar 24, 2022

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

  • dc5a65a: 8283426: Fix 'exeption' typo
  • f162445: 8283416: Update java.lang.invoke.MethodHandle to use sealed classes
  • 90750de: 8272477: Additional cleanup of test/jdk/java/nio/file/spi/SetDefaultProvider.java
  • a7e9883: 8283467: runtime/Thread/StopAtExit.java needs updating

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Mar 24, 2022

@iklam Pushed as commit c104802.

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

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
3 participants