RFR: 8376402: Dependencies::print_statistics() and AbstractClassHierarchyWalker::print_statistics() are not called from PRODUCT code [v2]

Matthias Baesken mbaesken at openjdk.org
Tue Jan 27 14:39:03 UTC 2026


On Tue, 27 Jan 2026 14:29:52 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> Dependencies::print_statistics() and AbstractClassHierarchyWalker::print_statistics() are not called from PRODUCT code but seems they still end up in the product build JVM, at least when using standard build settings.
>> (This can be observed when enabling link time gc and verbose info printing - in this case the methods are eliminated).
>> 
>> linuxx86_64
>> product build without those methods
>> 
>> ls -alL images/jdk/lib/server/libjvm.so
>> size 2.859.5144
>> 
>> 
>> unchanged product build :
>> 
>> ls -alL images/jdk/lib/server/libjvm.so
>> size 2.859.9464
>> 
>> 
>> (so we see a little size difference)
>
> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Adjust COPYRIGHT year

With
`-Wl,--gc-sections -Wl,--print-gc-sections`
I see (because of print-gc-sections) this output in the linker output of libjvm


/usr/lib64/gcc/x86_64-suse-linux/14/../../../../x86_64-suse-linux/bin/ld: removing unused section '.text._ZN12Dependencies16print_statisticsEv' in file '(/build/hotspot/variant-server/libjvm/objs/dependencies.o'
/usr/lib64/gcc/x86_64-suse-linux/14/../../../../x86_64-suse-linux/bin/ld: removing unused section '.text._ZN28AbstractClassHierarchyWalker16print_statisticsEv' in file '/build/hotspot/variant-server/libjvm/objs/dependencies.o'


I could also add the whole output of the libjvm linkage but it gets really huge and a number of removals need more analysis .

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

PR Comment: https://git.openjdk.org/jdk/pull/29449#issuecomment-3805573289


More information about the hotspot-compiler-dev mailing list