JDK-8296945 : PublicMethodsTest is slow due to dependency verification with debug builds
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,19,20
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-11-14
  • Updated: 2022-11-22
  • Resolved: 2022-11-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 20
20 masterFixed
Related Reports
Relates :  
Description
The runtime of the PublicMethodsTest [1] increases from 24 to 58 seconds on our test system using a fastdebug variant of the OpenJDK. The increase is less pronounced for other tests.

We suspect that the problematic part of the change are the additions to the dependency checking in nmethods [2]: The flamegraphs created by the async-profilers shows clearly that the `nmethods::check_all_dependencies` method dominates the runtime of the program with a fastdebug build after the change.
The two flamegraphs are appended.

[1] https://github.com/openjdk/jdk/blob/master/test/jdk/java/lang/reflect/PublicMethods/PublicMethodsTest.java
[2] https://github.com/openjdk/jdk/commit/127bfe44f7d09f272a08f97bfc5d168eb22474a2#diff-2e8c9df3ee96f0ac67ca9ce82524c6132e5e9bbf828269cd81f160de15bc438fL551

The issue was brought up by Matthias Baesken.
Comments
jdk17 backport request I would like to have the patch also in jdk17u-dev, because the issue has been observed there. The patch applies cleanly and is low risk.
22-11-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk17u-dev/pull/911 Date: 2022-11-21 15:14:18 +0000
21-11-2022

Changeset: bcc6b12b Author: Matthias Baesken <mbaesken@openjdk.org> Date: 2022-11-21 07:41:11 +0000 URL: https://git.openjdk.org/jdk/commit/bcc6b12b711a9c5007d963123fb38a7e72aaf8e5
21-11-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/11234 Date: 2022-11-18 09:19:26 +0000
18-11-2022

I think that's reasonable.
17-11-2022

Would it be okay to set "-XX:-VerifyDependencies" for this test , like it has been done here already: https://github.com/openjdk/jdk/commit/6843576c95a70bffad95df278d5f5be29371bca4 ? Or is there anything specific about PublicMethodsTest that we want to run it "at all costs" with the deps verification enabled ? Ideas about speeding up checking, or making it switchable in a more fine granular way probably need some more time.
16-11-2022

> Is there potential to make these added checks faster? Or to make the checks more fine-granular switchable? The verification logic iterates over the whole code cache and ensures all dependencies are still valid. Probably, there are ways to speed it up, but only by omitting some nmethods/dependencies during the pass or checking them less often. -XX:+VerifyDependencies was already expensive, but not too expensive (at least, we perceived it as such) to have it turned on by default. Probably, it's time to reconsider that decision and switch it off in debug builds on platforms where the overhead is prohibitive.
15-11-2022

> The bug can be repurposed to speed up PublicMethodsTest We have a bad slowdown in fastdebug also in various other tests because of JDK-8266074 Vtable-based CHA implementation , not only PublicMethodsTest . Additionally I want to point out that on ppc64le , the performance hit is even worse than on x86_64 ( 62s vs. 187 s / jdk17). Is there potential to make these added checks faster? Or to make the checks more fine-granular switchable ? Completely switching off the checks because of bad performance does not really sound like a great idea .
15-11-2022

I agree with [~vlivanov]. Converting this to a test bug. ILW = Test is slow due to dependency verification, single test but other tests might be affected as well, -XX:-VerifyDependencies = MML = P4
15-11-2022

The bug can be repurposed to speed up PublicMethodsTest (by specifying -XX:-VerifyDependencies) if it is desireable. Otherwise, there's not much to be done and the bug can be closed as WNF.
14-11-2022

JDK-8266074 makes dependency verification more expensive (-XX:+VerifyDependencies, turned on by default in debug builds). The proper way to address it when it leads to test failures is either to explicitly disable verification (-XX:-VerifyDependencies) or increase timeout factor for a particular test.
14-11-2022

Moving from hotspot/runtime to hotspot/compiler for initial triage since JDK-8266074 Vtable-based CHA implementation is in hotspot/compiler.
14-11-2022