JDK-8317266 : Move nmethod::check_all_dependencies to codeCache.cpp and mark it NOT_PRODUCT
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 22
  • Priority: P5
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-09-28
  • Updated: 2023-10-12
  • Resolved: 2023-10-12
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 22
22 masterFixed
Related Reports
Relates :  
Description
The static `nmethod::check_all_dependencies` has the following code:

```
  // Turn off dependency tracing while actually testing dependencies.
  NOT_PRODUCT( FlagSetting fs(Dependencies::_verify_in_progress, true));
```

which is critical for it. In a release build, the code will not be available and there will be significant performance impact. See https://bugs.openjdk.org/browse/JDK-7194669 for details.

There is only one use of the function in `CodeCache::mark_for_deoptimization`:

```
#ifndef PRODUCT
  if (VerifyDependencies) {
    // Object pointers are used as unique identifiers for dependency arguments. This
    // is only possible if no safepoint, i.e., GC occurs during the verification code.
    dependentCheckTime.start();
    nmethod::check_all_dependencies(changes);
    dependentCheckTime.stop();
  }
#endif

As `VerifyDependencies` is a develop option, there are no uses of `check_all_dependencies` in a release build.

`check_all_dependencies` does not use any private/protected members of nmethod.

As there are no other uses of `check_all_dependencies` but in codeCache.cpp, we propose to move the function in codeCache.cpp and make it a static function. Also the new function must be guarded by `#ifndef PRODUCT` because it is not intended for release builds.
Comments
Changeset: 64ee3c99 Author: Evgeny Astigeevich <eastigeevich@openjdk.org> Date: 2023-10-12 19:56:18 +0000 URL: https://git.openjdk.org/jdk/commit/64ee3c99908964a7fa4475084ca4cade14fabef8
12-10-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/16152 Date: 2023-10-11 14:12:52 +0000
11-10-2023