JDK-8332111 : [BACKOUT] A way to align already compiled methods with compiler directives
  • Type: Sub-task
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 23
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-05-11
  • Updated: 2024-05-23
  • Resolved: 2024-05-15
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 23
23 b24Fixed
Description
JDK-8309271 needs to be backed out because there have been concerns raised about it: https://github.com/openjdk/jdk/commit/c879627dbd7e9295d44f19ef237edb5de10805d5

Found bugs:
- When refreshing CompilerDirectivesAddDCmd::execute will call DirectivesStack::hasMatchingDirectives(mh, true) which only considers the compiler directive which is on the top of the directives stack. As more than one directive can be added, CompilerDirectivesAddDCmd::execute will not behave as expected.
- A Java method with old directives might be in the compilation queue. A request to recompile it with new directives will be ignored.

There are other concerns: bugs and performance issues.

Possible bugs:
- `has_matching_directives` might not be cleared. A nmethod might get into the unloading state before CodeCache::recompile_marked_directives_matches. If the nmethod has been used to mark a Java method and it is the only nmethod, there will be no nmethod in CodeCache to reach the Java method to clear the mark.
- A Java method might have been compiled with new directives before CodeCache::recompile_marked_directives_matches. CodeCache::recompile_marked_directives_matches will recompile it again.
- JIT compiler might be compiling a Java method with old directives.  A request to recompile it with new directives will be ignored.

Performance issues:
- Usually directives are updated for a small number of Java methods. If CodeCache has thousands of nmethods, CodeCache::recompile_marked_directives_matches will be redundantly traversing nmethods which need to be kept in CodeCache.
Comments
Changeset: 1a944478 Author: Evgeny Astigeevich <eastigeevich@openjdk.org> Date: 2024-05-15 09:56:05 +0000 URL: https://git.openjdk.org/jdk/commit/1a944478a26a766f5a573a1236b642d8e7b0685c
15-05-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/19215 Date: 2024-05-13 13:03:26 +0000
13-05-2024