JDK-8349915 : CTW: Lots of level 3 compiles are done at level 2 after JDK-8348570
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 25
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-02-12
  • Updated: 2025-02-16
  • Resolved: 2025-02-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 25
25 masterFixed
Related Reports
Causes :  
Causes :  
Relates :  
Description
Noticed this in manual CTW runs after JDK-8348570 that lots and lots of methods are compiled at level 2 instead of requested level 3:

```
...
[97]	javax.enterprise.deploy.shared.ActionType::getValue()	WARNING compilation level = 2, but not 3
[97]	javax.enterprise.deploy.shared.ActionType::getOffset()	WARNING compilation level = 2, but not 3
[97]	javax.enterprise.deploy.shared.ActionType::getEnumValueTable()	WARNING compilation level = 2, but not 3
[97]	javax.enterprise.deploy.shared.ActionType::getStringTable()	WARNING compilation level = 2, but not 3
[97]	javax.enterprise.deploy.shared.ActionType::getActionType(int)	WARNING compilation level = 2, but not 3
[97]	javax.enterprise.deploy.shared.ActionType::toString()	WARNING compilation level = 2, but not 3
[99]	javax.enterprise.deploy.shared.DConfigBeanVersionType
[98]	javax.enterprise.deploy.shared.CommandType::toString()	WARNING compilation level = 2, but not 3
[98]	javax.enterprise.deploy.shared.CommandType::getOffset()	WARNING compilation level = 2, but not 3
...
```

I narrowed it down to level downgrade in compilation policy here:
 https://github.com/openjdk/jdk/blob/ed17c55ea34b3b6009dab11d64f21e0b7af3d701/src/hotspot/share/compiler/compilationPolicy.cpp#L677

JDK-8348570 enters here, because we mark all methods as having profiles to extend the CTW scope. So now `is_method_profiled(max_method_h)` is `true` and downgrade happens. There is already check for `!Arguments::is_compiler_only()` there, so I think we better exclude CTW from this downgrade as well.
Comments
Changeset: 62345364 Branch: master Author: Aleksey Shipilev <shade@openjdk.org> Date: 2025-02-15 07:22:20 +0000 URL: https://git.openjdk.org/jdk/commit/623453647a8a387b2d8d375cb18b33666abc16ee
15-02-2025

ILW = CTW compiles at wrong level, often, no workaround = LHH = P4
13-02-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/23589 Date: 2025-02-12 14:47:32 +0000
12-02-2025