RFR: 8355003: Implement Ahead-of-Time Method Profiling

Ioi Lam iklam at openjdk.org
Sun Apr 27 01:06:00 UTC 2025


On Sun, 27 Apr 2025 00:02:41 GMT, Igor Veresov <iveresov at openjdk.org> wrote:

>> src/hotspot/share/cds/dumpAllocStats.hpp line 151:
>> 
>>> 149:   }
>>> 150: 
>>> 151:   void record_dynamic_proxy_class() {
>> 
>> This is not called. This code seems not related.
>
> True. @iklam, this came with a change you wanted me to take. Ok to cut this out?

Yes, this part is not needed. AOT dynamic proxy classes are only supported in the Leyden repo.

>> src/hotspot/share/oops/methodData.cpp line 1296:
>> 
>>> 1294: 
>>> 1295: MethodData::MethodData() {
>>> 1296:   assert(CDSConfig::is_dumping_static_archive() || UseSharedSpaces, "only for CDS");
>> 
>> 1. Should its code be guarded by `#if INCLUDE_CDS`?
>> 2. Comment where/how it is used.
>> 3. Is it used in all phases or only during TRAINING and ASSEMBLY?
>> 4. Can you add query methods into `CDSConfig` which you can call here and in other places?:
>> 
>>  is_dumping_training_data()
>>  is_using_training_data()
>
> I think those are used for CDS serialization/deserialization, right, @iklam?

This constructor is used by cppVtables.cpp to calculate the size of the vtables for MethodData, and also for finding the address of the vtable of  MethodData. All types in `CPP_VTABLE_TYPES_DO` must have such an empty constructor. E.g., `InstanceKlass::InstanceKlass()`.

We have not been very consistent with comments around these constructors, but I think we can do this:


#if INCLUDE_CDS
MethodData::MethodData() {
  // Used by cppVtables.cpp only
  assert(CDSConfig::is_dumping_static_archive() || UseSharedSpaces, "only for CDS");
}
#endif


This method is called even if we are not dumping training data. The vtables of all types in `CPP_VTABLE_TYPES_DO` are unconditionally computed.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24886#discussion_r2061901400
PR Review Comment: https://git.openjdk.org/jdk/pull/24886#discussion_r2061898996


More information about the hotspot-compiler-dev mailing list