RFR: 8373114: Redundant MethodCounters in the preimage generated by training run [v3]
Vladimir Kozlov
kvn at openjdk.org
Wed Jan 14 19:58:19 UTC 2026
On Tue, 9 Dec 2025 02:39:41 GMT, Ashutosh Mehra <asmehra at openjdk.org> wrote:
>> Details are mentioned in the bug report and this mail thread https://mail.openjdk.org/pipermail/leyden-dev/2025-December/002843.html
>> After this patch the number of MethodCounters in the preimage are much less than before this patch. Also the number of MethodCounters in the preimage is the same as in the final AOTCache (these numbers are obtained using -Xlog:aot=trace).
>>
>> Before this patch for the training run:
>>
>> [18.610s][debug ][aot ] ro_cnt ro_bytes % | rw_cnt rw_bytes % | all_cnt all_bytes %
>> [18.610s][debug ][aot ] MethodCounters : 0 0 0.0 | 22471 1438144 6.2 | 22471 1438144 2.6
>>
>> Before this patch for the assembly phase:
>>
>> [6.680s][debug][aot ] ro_cnt ro_bytes % | rw_cnt rw_bytes % | all_cnt all_bytes %
>> [6.680s][debug][aot ] MethodCounters : 0 0 0.0 | 8588 549632 2.5 | 8588 549632 1.0
>>
>>
>> After this patch for the training run:
>>
>> [49.371s][debug ][aot ] ro_cnt ro_bytes % | rw_cnt rw_bytes % | all_cnt all_bytes %
>> [49.371s][debug ][aot ] MethodTrainingData : 0 0 0.0 | 4658 521696 2.1 | 4658 521696 0.9
>>
>>
>> After this patch for the assembly phase:
>>
>> [12.580s][debug][aot ] ro_cnt ro_bytes % | rw_cnt rw_bytes % | all_cnt all_bytes %
>> [12.580s][debug][aot ] MethodTrainingData : 0 0 0.0 | 4658 521696 2.1 | 4658 521696 0.9
>
> Ashutosh Mehra has updated the pull request incrementally with one additional commit since the last revision:
>
> Remove blank line
>
> Signed-off-by: Ashutosh Mehra <asmehra at redhat.com>
src/hotspot/share/oops/trainingData.cpp line 122:
> 120: MethodTrainingData* MethodTrainingData::make(const methodHandle& method, bool null_if_not_found, bool use_cache) {
> 121: MethodTrainingData* mtd = nullptr;
> 122: if ((!have_data() && !need_data()) || (assembling_data() && !CDSConfig::is_at_aot_safepoint())) {
@ashu-mehra and @veresov from what I see `MethodTrainingData::make()` should be called only during training run when CTD is set: https://github.com/openjdk/jdk/blob/master/src/hotspot/share/compiler/compileBroker.cpp#L356C21-L356C30
Am I missing path where it is called in assembly phase or production?
`need_data()` is true only during training:
https://github.com/openjdk/jdk/blob/master/src/hotspot/share/oops/trainingData.hpp#L290
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28670#discussion_r2691838019
More information about the hotspot-dev
mailing list