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

8287801: Fix test-bugs related to stress flags #9186

Closed
wants to merge 3 commits into from

Conversation

eme64
Copy link
Contributor

@eme64 eme64 commented Jun 16, 2022

I recently ran many tests with additional stress flags. While there were a few bugs I found, most of the issues were test bugs.

I found a list of tests that are problematic with specific stress flags, I adjusted the tests so that they can now be run with the flag. Often I just fix the flag at the default value, so that setting it from the outside does not affect the test.

Below I explain for each test how and why I adjusted the test.

  • test/hotspot/jtreg/compiler/arraycopy/TestArrayCopyNoInitDeopt.java
    • Problem Flags: -XX:+UnlockExperimentalVMOptions -XX:PerMethodSpecTrapLimit=0 -XX:PerMethodTrapLimit=0
      • Disabling traps by setting limit of traps to zero, means some optimistic optimizations are not made, and can therefore not lead to deoptimization. The test expects deoptimization due to traps, so we need to have them on.
  • test/hotspot/jtreg/compiler/c2/cr7200264/TestDriver.java
    • used by TestSSE2IntVect.java and TestSSE4IntVect.java
  • test/hotspot/jtreg/compiler/c2/cr7200264/TestSSE2IntVect.java
    • Problem Flags: -XX:StressLongCountedLoop=2000000
      • Test checks the IR, and if we convert loops to long loops, some operations will not show up anymore, the test fails. Disable StressLongCountedLoop.
  • test/hotspot/jtreg/compiler/c2/cr7200264/TestSSE4IntVect.java
    • See TestSSE2IntVect.java
  • test/hotspot/jtreg/compiler/c2/irTests/blackhole/BlackholeStoreStoreEATest.java
    • Problem Flags: -XX:-UseTLAB
      • No thread local allocation (TLAB) means IR is changed. Test checks for MemBarStoreStore, which is missing without TLAB. Solution: always have TLAB on.
  • test/hotspot/jtreg/compiler/cha/AbstractRootMethod.java
    • Problem Flags: -XX:+StressMethodHandleLinkerInlining
      • Messes with recompilation, makes assert fail that expects recompilation. Must disable flag.
  • test/hotspot/jtreg/compiler/cha/DefaultRootMethod.java
    • see AbstractRootMethod.java
  • test/hotspot/jtreg/compiler/intrinsics/klass/CastNullCheckDroppingsTest.java
    • Problem Flags: -XX:+UnlockExperimentalVMOptions -XX:PerMethodSpecTrapLimit=0 -XX:PerMethodTrapLimit=0
      • Need traps, otherwise some optimistic optimisations are not made, and then they also are not trapped and deoptimized.
    • Problem Flags: -XX:TypeProfileLevel=222
      • Profiling also messes with optimizations / deoptimization.
    • Problem Flags: -XX:+StressReflectiveCode
      • Messes with types at allocation, which messes with optimizations.
    • Problem Flags: -XX:-UncommonNullCast
      • Is required for trapping in null checks.
    • Problem Flags: -XX:+StressMethodHandleLinkerInlining
      • Messes with inlining / optimization - turn it off.
  • test/hotspot/jtreg/compiler/jvmci/compilerToVM/IsMatureVsReprofileTest.java
    • Problem Flags: -XX:Tier4BackEdgeThreshold=1 -Xbatch -XX:-TieredCompilation
    • Lead to OSR compilation in loop calling testMethod, which is expected to be compiled. But with the OSR compilation, that function is inlined, and never compiled. Solution was to make sure we only compile testMethod.
  • test/hotspot/jtreg/compiler/jvmci/compilerToVM/ReprofileTest.java
    • Problem Flags: -XX:TypeProfileLevel=222
      • Changing profile flags messes with test, which assumes default behavior.
  • test/hotspot/jtreg/compiler/profiling/TestTypeProfiling.java
    • Problem Flags: -XX:+UnlockExperimentalVMOptions -XX:PerMethodSpecTrapLimit=0 -XX:PerMethodTrapLimit=0
      • Need traps to check for optimistic optimizations.
  • test/hotspot/jtreg/compiler/rangechecks/TestExplicitRangeChecks.java
    • Problem Flags: -XX:+UnlockExperimentalVMOptions -XX:PerMethodSpecTrapLimit=0 -XX:PerMethodTrapLimit=0
      • Need traps to check for optimistic optimizations.
  • test/hotspot/jtreg/compiler/rangechecks/TestLongRangeCheck.java
    • Problem Flags: -XX:+UnlockExperimentalVMOptions -XX:PerMethodSpecTrapLimit=0 -XX:PerMethodTrapLimit=0
      • Need traps to check for optimistic optimizations.
  • test/hotspot/jtreg/compiler/rangechecks/TestRangeCheckSmearing.java
    • Problem Flags: -XX:TieredStopAtLevel=3 -XX:+StressLoopInvariantCodeMotion
      • Test expects to be run at compilation tier 4 / C2, so must fix it at that in requirement.
  • test/hotspot/jtreg/compiler/uncommontrap/Decompile.java
    • Problem Flags: -XX:+UnlockExperimentalVMOptions -XX:PerMethodSpecTrapLimit=0 -XX:PerMethodTrapLimit=0 -XX:PerBytecodeTrapLimit=0
    • The tests if we trap and decompile after we call member functions of a class that we did not use before. If we disable traps, then internally it uses a virtual call, and no deoptimization is required - but the test expects trapping and deoptimization. Solution: set trap limits to default.
    • Problem Flags: -XX:TypeProfileLevel=222
    • Changing profiling behavior also messes with deoptimization - disable it.
  • test/hotspot/jtreg/compiler/uncommontrap/TestUnstableIfTrap.java
    • Problem Flags: -XX:+UnlockExperimentalVMOptions -XX:PerMethodSpecTrapLimit=0 -XX:PerMethodTrapLimit=0
      • Test expects traps, so we must ensure the limits are at default.

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

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9186

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 16, 2022

👋 Welcome back epeter! 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 Jun 16, 2022

@eme64 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 Jun 16, 2022
@eme64 eme64 marked this pull request as ready for review June 17, 2022 06:42
@openjdk openjdk bot added the rfr Pull request is ready for review label Jun 17, 2022
@mlbridge
Copy link

mlbridge bot commented Jun 17, 2022

Webrevs

Copy link
Member

@chhagedorn chhagedorn left a comment

Choose a reason for hiding this comment

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

Nice analysis and summary of the failures! The test fixes look good to me!

@@ -39,6 +39,7 @@ public class BlackholeStoreStoreEATest {

public static void main(String[] args) {
TestFramework.runWithFlags(
"-XX:+UseTLAB",
Copy link
Member

Choose a reason for hiding this comment

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

Just as a side note: As this example shows, treating UseTLAB as having no effect on the IR (i.e. on the IR framework whitelist) is incorrect. We should think about removing it from the whitelist at some point. But fixing this test like that is perfectly fine.

@openjdk
Copy link

openjdk bot commented Jun 17, 2022

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

8287801: Fix test-bugs related to stress flags

Reviewed-by: chagedorn, thartmann

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

  • 5cdb4b1: 8288011: StringConcatFactory: Split application of stringifiers
  • 46d5b68: 8288685: JFR: Use static methods for Active Recording and Active Setting events
  • 68bff04: 8288673: Reduce runtime of java.time microbenchmarks
  • d917e18: 8288667: Reduce runtime of java.text microbenchmarks
  • 695d865: 8284672: Collapse identical catch branches in java.desktop
  • 7acdcc1: 8288329: Avoid redundant TreeMap.containsKey call in PolicyParser.read
  • f62b2bd: 8288480: IGV: toolbar action is not applied to the focused graph
  • 02da5f9: 8263384: IGV: Outline should highlight the Graph that has focus
  • 7d4df6a: 8284404: Too aggressive sweeping with Loom
  • 47b8669: 8288573: Make Executable.getParameterCount() actually abstract
  • ... and 13 more: https://git.openjdk.org/jdk/compare/cf4a4966a846ebea7e07c4ee6387fbf1081ea385...master

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 Jun 17, 2022
Copy link
Member

@TobiHartmann TobiHartmann left a comment

Choose a reason for hiding this comment

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

Nice analysis. Please make sure to run all affected tests with a product VM build.

@eme64
Copy link
Contributor Author

eme64 commented Jun 20, 2022

Thanks at @TobiHartmann and @chhagedorn for the help, feedback and reviews!
/integrate

@openjdk
Copy link

openjdk bot commented Jun 20, 2022

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

  • a7df5a4: 8288663: JFR: Disabling the JfrThreadSampler commits only a partially disabled state
  • 406cf61: 8287771: Remove useless G1 After GC summary refinement and sampling thread times
  • 5cdb4b1: 8288011: StringConcatFactory: Split application of stringifiers
  • 46d5b68: 8288685: JFR: Use static methods for Active Recording and Active Setting events
  • 68bff04: 8288673: Reduce runtime of java.time microbenchmarks
  • d917e18: 8288667: Reduce runtime of java.text microbenchmarks
  • 695d865: 8284672: Collapse identical catch branches in java.desktop
  • 7acdcc1: 8288329: Avoid redundant TreeMap.containsKey call in PolicyParser.read
  • f62b2bd: 8288480: IGV: toolbar action is not applied to the focused graph
  • 02da5f9: 8263384: IGV: Outline should highlight the Graph that has focus
  • ... and 15 more: https://git.openjdk.org/jdk/compare/cf4a4966a846ebea7e07c4ee6387fbf1081ea385...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jun 20, 2022

@eme64 Pushed as commit 302a6c0.

💡 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