On Wed, 17 Dec 2025 20:04:48 GMT, Ioi Lam <[email protected]> wrote:

>> In legacy CDS, Java objects used by certain classes are computed ahead of 
>> time using "object subgraphs"
>> 
>> https://github.com/openjdk/jdk/blob/1bbbce75c5e68429c2a32519eb3c36d964dcdf57/src/hotspot/share/cds/heapShared.cpp#L168-L171
>> 
>> Examples of subgraphs:
>> 
>> - `java.lang.Integer$IntegerCache::cache`
>> - `jdk.internal.module.ArchivedBootLayer::bootLayer`
>> 
>> The implementation requires special code (in both Java and C++) to be 
>> executed when a CDS archive is created or loaded. As a result, we have an 
>> execution model that's difficult to implement/extend and the behavior is 
>> hard to understand.
>> 
>> To move towards the AOT Cache Snapshot Model 
>> ([JDK-8365645](https://bugs.openjdk.org/browse/JDK-8365645)) we should 
>> replace the subgraphs with the use of `@AOTSafeClassInitializer`, and if 
>> necessary, `@AOTRuntimeSetup`. This will simplify the current 
>> implementation, and make it possible to extend AOT-initializations to more 
>> core classes.
>> 
>> Note, the use of `@AOTSafeClassInitializer` requires `-XX:+AOTClassLinking`. 
>> For the time being, we retain the old CDS object subgraph code to cover the 
>> `-XX:-AOTClassLinking` cases. Such code will be marked with comments like 
>> `/* Legacy CDS archive support (to be deprecated) */`. All future AOT 
>> creation of Java objects will be done with  `@AOTSafeClassInitializer`.
>
> Ioi Lam has updated the pull request incrementally with one additional commit 
> since the last revision:
> 
>   Fixed test case -- the regexp pattern could match the stats for the 
> subgraphs table, which now has a single entry

I have to fix the SharedSymbolTableBucketSize.java test. With this PR and 
testing with `-vmoptions:-XX:+AOTClassLinking -vmoptions:-XX:+UseZGC`, the 
first block of "table stats" has a single entry.

I fixed the test case to look for "Shared symbol table stats", which is the 
info that the test case intends to check.


[...]
[0.591s][info][cds]     type array classes =     9
[0.591s][info][cds]                symbols = 46244
[0.681s][info][aot,hashtables] Shared subgraphs table stats -------- base: 
0x0000000800000000
[0.681s][info][aot,hashtables] Number of entries       :         1
[0.681s][info][aot,hashtables] Total bytes used        :        24
[0.681s][info][aot,hashtables] Average bytes per entry :    24.000
[0.681s][info][aot,hashtables] Average bucket size     :     1.000
[0.681s][info][aot,hashtables] Variance of bucket size :     0.000
[0.681s][info][aot,hashtables] Std. dev. of bucket size:     0.000
[0.681s][info][aot,hashtables] Maximum bucket size     :         1
[0.681s][info][aot,hashtables] Empty buckets           :         0
[0.681s][info][aot,hashtables] Value_Only buckets      :         1
[0.681s][info][aot,hashtables] Other buckets           :         0
[0.688s][info][aot,hashtables] Shared symbol table stats -------- base: 
0x0000000800000000
[0.688s][info][aot,hashtables] Number of entries       :     46244
[0.688s][info][aot,hashtables] Total bytes used        :    393792
[0.688s][info][aot,hashtables] Average bytes per entry :     8.516
[0.688s][info][aot,hashtables] Average bucket size     :     7.734
[0.688s][info][aot,hashtables] Variance of bucket size :     7.513
[0.688s][info][aot,hashtables] Std. dev. of bucket size:     2.741
[0.688s][info][aot,hashtables] Maximum bucket size     :        20
[0.688s][info][aot,hashtables] Empty buckets           :         2
[0.688s][info][aot,hashtables] Value_Only buckets      :        24
[0.688s][info][aot,hashtables] Other buckets           :      5953

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

PR Comment: https://git.openjdk.org/jdk/pull/28736#issuecomment-3666964418

Reply via email to