There are two ways MethodCounters can get into the cache:
1. through Method (see Method::metaspace_pointers_do)
2. through MethodTrainingData
(see MethodTrainingData::metaspace_pointers_do)
MethodCounters added through Method seem to be redundant because we severe the Method->MethodCounter link in Method::unlink_method() when writing the archive. This means the Methods adopted from the preimage in the assembly phase do not have MethodCounters. And since we don't execute the application, we don't create MethodCounters for the Methods loaded from the preimage. Only the MethodCounters discoverable via MethodTrainingData seep into the AOTCache.
Ideally we should only be adding MethodCounters
through the MethodTrainingData and not through Method.
More details in this thread: https://mail.openjdk.org/pipermail/leyden-dev/2025-December/002843.html
1. through Method (see Method::metaspace_pointers_do)
2. through MethodTrainingData
(see MethodTrainingData::metaspace_pointers_do)
MethodCounters added through Method seem to be redundant because we severe the Method->MethodCounter link in Method::unlink_method() when writing the archive. This means the Methods adopted from the preimage in the assembly phase do not have MethodCounters. And since we don't execute the application, we don't create MethodCounters for the Methods loaded from the preimage. Only the MethodCounters discoverable via MethodTrainingData seep into the AOTCache.
Ideally we should only be adding MethodCounters
through the MethodTrainingData and not through Method.
More details in this thread: https://mail.openjdk.org/pipermail/leyden-dev/2025-December/002843.html
- links to
-
Review(master)
openjdk/jdk/28670