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

8262912: ciReplay: replay does not simulate unresolved classes #5926

Closed
wants to merge 1 commit into from

Conversation

chhagedorn
Copy link
Member

@chhagedorn chhagedorn commented Oct 13, 2021

When trying to replay compile, the JVM will always resolve some classes before actually doing the replay compilation. When finally replay compiling the method, the state of ciInstanceKlasses which are resolved/unresolved could be different compared to the state at which the replay file was dumped. This will even be a bigger problem when tackling JDK-8254110.

This change intends to fix this by only treating a ciInstanceKlass as not unresolved if there is a corresponding entry for it in the replay file. This is achieved by a whitelist (ciInstanceKlassRecord). All accesses to get a pointer to a ciInstanceKlass are eventually routed through ciEnv::get_metadata(). This method is hooked to compare it against the replay compilation whitelist. If the corresponding Klass is not on the list, an unresolved ciInstanceKlass is returned instead.

Finding a way to reliably test this feature was difficult. I therefore came up with a test which first creates a replay file with CICrashAt and then removes the ciInstanceKlass entry for class Foo to simulate that Foo was unresolved at replay dump time. This will result in a different C2 IR which is verified by checking the PrintIdeal output (see comments in test).

Thanks,
Christian


Progress

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

Issue

  • JDK-8262912: ciReplay: replay does not simulate unresolved classes

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5926

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 13, 2021

👋 Welcome back chagedorn! 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 Oct 13, 2021
@openjdk
Copy link

openjdk bot commented Oct 13, 2021

@chhagedorn 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 Oct 13, 2021
@mlbridge
Copy link

mlbridge bot commented Oct 13, 2021

Webrevs

Copy link
Contributor

@vnkozlov vnkozlov left a comment

Looks good.

@openjdk
Copy link

openjdk bot commented Oct 13, 2021

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

8262912: ciReplay: replay does not simulate unresolved classes

Reviewed-by: kvn, dlong

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

  • d9e03e4: 8275244: Suppress warnings on non-serializable array component types in jdk.management
  • 7dc2db4: 8274032: Remove jtreg tag manual=yesno for java/awt/print/PrinterJob/ImagePrinting/ImageTypes.java & show test UI
  • 1e0184d: 8275234: java/awt/GraphicsDevice/DisplayModes/CycleDMImage.java is entered twice in ProblemList
  • d15fbc2: 8275187: Suppress warnings on non-serializable array component types in java.sql.rowset
  • d8f6b6c: 8274718: runtime/cds/appcds/LambdaEagerInit.java fails with -XX:-CompactStrings
  • 451a296: 8275173: testlibrary_tests/ir_framework/tests/TestCheckedTests.java fails after JDK-8274911
  • 5ffb5d1: 8272992: Replace usages of Collections.sort with List.sort call in jdk.* modules
  • b8cb76a: 8273682: Upgrade Jline to 3.20.0
  • dcf428c: 8275075: Remove unnecessary conversion to String in jdk.hotspot.agent
  • c3b75c6: 8274516: [REDO] JDK-8271880: Tighten condition for excluding regions from collecting cards with cross-references
  • ... and 2 more: https://git.openjdk.java.net/jdk/compare/ab34cced3beae765fe9d6b6acfef7e6a7f3082cd...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 Oct 13, 2021
Copy link
Member

@dean-long dean-long left a comment

Looks good. There's a memory leak with the global mirror jobjects that will need to be fixed for JDK-8254110. One way to do this might be to prune your replay white list as klasses are added to _ci_metadata. That would mean moving your white list check until we check for existing klasses in _ci_metadata.
Also, you could reduce the number of JNI global refs needed by putting the mirror objects in an array, then storing the array in a single JNI global ref, or adding it to what gets scanned by CompileTask::metadata_do or ciEnv::metadata_do, but I think that can wait until JDK-8254110 too.

@chhagedorn
Copy link
Member Author

chhagedorn commented Oct 14, 2021

Thanks Vladimir and Dean for your reviews!

@dean-long: Should we already do some of these changes now or should we move forward and eventually fix these in JDK-8254110?

@dean-long
Copy link
Member

dean-long commented Oct 14, 2021

@chhagedorn I suggest pushing what you have now and fixing the leaks in JDK-8254110.

@chhagedorn
Copy link
Member Author

chhagedorn commented Oct 15, 2021

@chhagedorn I suggest pushing what you have now and fixing the leaks in JDK-8254110.

Okay, thanks for your assessment! I will add these comments to JDK-8254110 to keep track of them.

@chhagedorn
Copy link
Member Author

chhagedorn commented Oct 15, 2021

/integrate

@openjdk
Copy link

openjdk bot commented Oct 15, 2021

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

  • 322b130: 8275106: Cleanup Iterator usages in java.desktop
  • c355704: 8041125: ColorConvertOp filter much slower in JDK 8 compared to JDK7
  • 9623d5b: 8275265: java/nio/channels tests needing large heap sizes fail on x86_32
  • 21df412: 8275240: Change nested classes in jdk.attach to static nested classes
  • a16f2d0: 8272908: Missing coverage for certain classes in com.sun.org.apache.xml.internal.security
  • ede3f4e: 8274795: AArch64: avoid spilling and restoring r18 in macro assembler
  • 40d69f0: 8254267: javax/xml/crypto/dsig/LogParameters.java failed with "RuntimeException: Unexpected log output:"
  • 54b8870: 8275035: Clean up worker thread infrastructure
  • 3b0b6ad: 8275226: Shenandoah: Relax memory constraint for worker claiming tasks/ranges
  • 8d9004b: 8274781: Use monospace font for enclosing interface
  • ... and 14 more: https://git.openjdk.java.net/jdk/compare/ab34cced3beae765fe9d6b6acfef7e6a7f3082cd...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Oct 15, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Oct 15, 2021
@openjdk
Copy link

openjdk bot commented Oct 15, 2021

@chhagedorn Pushed as commit 4cb7124.

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

@chhagedorn chhagedorn deleted the JDK-8262912 branch Oct 27, 2021
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