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

JDK-8292561: Make "ReplayCompiles" a diagnostic product switch #9935

Closed

Conversation

tstuefe
Copy link
Member

@tstuefe tstuefe commented Aug 19, 2022

See discussion: https://mail.openjdk.org/pipermail/hotspot-compiler-dev/2022-August/057988.html

Making ReplayCompiles a (diagnostic) runtime switch can help when facing problems with shipped release VMs:

  • Investigate the effects of compiler errors in shipped VMs to estimate the bug impact
  • Investigate if a given build is affected by a compiler bug

Making the option product increases libjvm.so text size by 54kb (Linux x64). No measurable runtime overhead.

Tests: Almost all tests in compiler/ciReplay generate replay files by inducing a crash with -XX:CICrashAt. That won't work in release builds. I added a simple test that checks that invalid replay files are correctly refused, and that test can also be done on a release VM. So we at least have a test for release that checks argument parsing.

(Note: I have #9891 open, which could in the future serve as an alternative to CICrashAt by limiting the compiler arena).


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

  • JDK-8292561: Make "ReplayCompiles" a diagnostic product switch

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9935

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 19, 2022

👋 Welcome back stuefe! 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 Aug 19, 2022

@tstuefe The following label will be automatically applied to this pull request:

  • hotspot

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 hotspot-dev@openjdk.org label Aug 19, 2022
@tstuefe tstuefe marked this pull request as ready for review August 19, 2022 08:12
@tstuefe
Copy link
Member Author

tstuefe commented Aug 19, 2022

/label remove hotspot
/label add hotspot-compiler

@openjdk openjdk bot added rfr Pull request is ready for review and removed hotspot hotspot-dev@openjdk.org labels Aug 19, 2022
@openjdk
Copy link

openjdk bot commented Aug 19, 2022

@tstuefe
The hotspot label was successfully removed.

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Aug 19, 2022
@openjdk
Copy link

openjdk bot commented Aug 19, 2022

@tstuefe
The hotspot-compiler label was successfully added.

@mlbridge
Copy link

mlbridge bot commented Aug 19, 2022

Webrevs

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.

Current ciReplay tests requires vm.debug == true - that is why they can use debug flags.
I don't think we need to modify them. For new tests which you want to run in product VM we can use new NMT feature you are proposing.

Comment on lines 194 to 200
#ifndef PRODUCT
if (ReplayCompiles && o->is_klass()) {
Klass* k = (Klass*)o;
if (k->is_instance_klass() && ciReplay::is_klass_unresolved((InstanceKlass*)k)) {
// Klass was unresolved at replay dump time. Simulate this case.
return ciEnv::_unloaded_ciinstance_klass;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

May be make this part of code as ciReplay method and place it into ciReplay.cpp to reduce code in .hpp file.

Copy link
Member Author

Choose a reason for hiding this comment

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

@vnkozlov , I moved the code into ciObjectFactory::get_metadata() since it seemed to fit there very well. Is that okay or do you really want it to live in ciReplay.cpp?

@@ -3871,9 +3871,12 @@ bool Arguments::handle_deprecated_print_gc_flags() {
}

static void apply_debugger_ergo() {
#ifdef ASSERT
Copy link
Contributor

Choose a reason for hiding this comment

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

Use #ifndef PRODUCT as other UseDebuggerErgo* code.

@tstuefe
Copy link
Member Author

tstuefe commented Aug 20, 2022

Current ciReplay tests requires vm.debug == true - that is why they can use debug flags.

What I meant was I first attempted to remove the vm.debug == true restriction and run the tests on the release VM. But then found the missing CICrashAt option to be the issue that made them fail with "did not crash, expected it to crash" errors. So I assumed that was the only issue, and if that were solved, we could just reuse all tests for the release VM.

I don't think we need to modify them. For new tests which you want to run in product VM we can use new NMT feature you are proposing.

Okay.

Copy link
Member

@navyxliu navyxliu left a comment

Choose a reason for hiding this comment

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

LGTM. I am not a reviewer.

I tried this feature and it works as expected.
I dump 4 replay files using this option -XX:CompileCommand=DumpReplay,java.util.HashMap::putVal.

2 of them are c1 and 2 are c2. I see ReplayCompiles works in release build and it also accepts unresolved klasses. eg.

Warning: entry was unresolved in the replay data: jdk/internal/misc/VM
Warning: entry was unresolved in the replay data: jdk/internal/loader/ClassLoaders
Warning: entry was unresolved in the replay data: jdk/internal/misc/Unsafe
Warning: entry was unresolved in the replay data: java/lang/invoke/StringConcatFactory
Warning: entry was unresolved in the replay data: java/lang/ClassLoader
Warning: entry was unresolved in the replay data: java/lang/Thread
Warning: entry was unresolved in the replay data: jdk/internal/loader/ClassLoaders
Warning: entry was unresolved in the replay data: jdk/internal/loader/BootLoader
Warning: entry was unresolved in the replay data: jdk/internal/module/ServicesCatalog
Warning: entry was unresolved in the replay data: java/lang/module/ModuleDescriptor$Opens
Warning: entry was unresolved in the replay data: java/lang/System
Warning: entry was unresolved in the replay data: java/util/concurrent/ConcurrentHashMap$ForwardingNode
    272   26    b  3       java.util.HashMap::putVal (300 bytes)

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.

Yes. Looks good.

@openjdk
Copy link

openjdk bot commented Aug 21, 2022

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

8292561: Make "ReplayCompiles" a diagnostic product switch

Reviewed-by: kvn, xliu

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

  • 2fbb936: 8292691: Move CompilerConfig::is_xxx() inline functions out of compilerDefinitions.hpp
  • 3601e30: 8290909: MemoryPoolMBean/isUsageThresholdExceeded tests failed with "isUsageThresholdExceeded() returned false, and is still false, while threshold = MMMMMMM and used peak = NNNNNNN"
  • 37c0a13: 8292350: Use static methods for hashCode/toString primitives
  • 4453200: 8292628: x86: Improve handling of constants in trigonometric stubs
  • 07c9ba7: 8292686: runtime/cds/appcds/TestWithProfiler.java SIGSEGV in TableStatistics ctr
  • 235151e: 8292676: Remove two kerberos tests from problem list
  • df5209e: 8292683: Remove BadKeyUsageTest.java from Problem List
  • 74d3330: 8292682: Code change of JDK-8282730 not updated to reflect CSR update
  • 57aac2a: 8290981: Enable CDS for zero builds
  • 6a8a531: 8292564: x86: Remove redundant casts in Assembler usages
  • ... and 25 more: https://git.openjdk.org/jdk/compare/2ee9491a60c956da94debfbf0195f9339403ea98...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 Aug 21, 2022
@tstuefe
Copy link
Member Author

tstuefe commented Aug 21, 2022

Thanks @vnkozlov and @navyxliu !

/integrate

@openjdk
Copy link

openjdk bot commented Aug 21, 2022

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

  • 2fbb936: 8292691: Move CompilerConfig::is_xxx() inline functions out of compilerDefinitions.hpp
  • 3601e30: 8290909: MemoryPoolMBean/isUsageThresholdExceeded tests failed with "isUsageThresholdExceeded() returned false, and is still false, while threshold = MMMMMMM and used peak = NNNNNNN"
  • 37c0a13: 8292350: Use static methods for hashCode/toString primitives
  • 4453200: 8292628: x86: Improve handling of constants in trigonometric stubs
  • 07c9ba7: 8292686: runtime/cds/appcds/TestWithProfiler.java SIGSEGV in TableStatistics ctr
  • 235151e: 8292676: Remove two kerberos tests from problem list
  • df5209e: 8292683: Remove BadKeyUsageTest.java from Problem List
  • 74d3330: 8292682: Code change of JDK-8282730 not updated to reflect CSR update
  • 57aac2a: 8290981: Enable CDS for zero builds
  • 6a8a531: 8292564: x86: Remove redundant casts in Assembler usages
  • ... and 25 more: https://git.openjdk.org/jdk/compare/2ee9491a60c956da94debfbf0195f9339403ea98...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Aug 21, 2022

@tstuefe Pushed as commit f9004fe.

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

@tstuefe tstuefe deleted the JDK-8292561-ReplayCompiles-product branch August 24, 2023 08:36
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
Development

Successfully merging this pull request may close these issues.

3 participants