On Mon, 15 Jun 2026 07:20:20 GMT, Matthias Baesken <[email protected]> wrote:

>> When building hotspot on linuxx86_64/gcc with LTO enabled 
>> (--enable-jvm-feature-link-time-opt), we get various test errors in the 
>> serviceability/sa area.
>> Example serviceability/sa/CDSJMapClstats.java
>> 
>> 
>> finding class loader instances ..java.lang.InternalError: Metadata does not 
>> appear to be polymorphic
>> at 
>> jdk.hotspot.agent/sun.jvm.hotspot.types.basic.BasicTypeDataBase.findDynamicTypeForAddress(BasicTypeDataBase.java:223)
>> at 
>> jdk.hotspot.agent/sun.jvm.hotspot.runtime.VirtualBaseConstructor.instantiateWrapperFor(VirtualBaseConstructor.java:104)
>> at 
>> jdk.hotspot.agent/sun.jvm.hotspot.oops.Metadata.instantiateWrapperFor(Metadata.java:77)
>> at 
>> jdk.hotspot.agent/sun.jvm.hotspot.memory.SystemDictionary.getClassLoaderKlass(SystemDictionary.java:102)
>> at 
>> jdk.hotspot.agent/sun.jvm.hotspot.tools.ClassLoaderStats.printClassLoaderStatistics(ClassLoaderStats.java:93)
>> at 
>> jdk.hotspot.agent/sun.jvm.hotspot.tools.ClassLoaderStats.run(ClassLoaderStats.java:78)
>> at jdk.hotspot.agent/sun.jvm.hotspot.tools.JMap.run(JMap.java:121)
>> at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:278)
>> at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.start(Tool.java:241)
>> at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.execute(Tool.java:134)
>> at jdk.hotspot.agent/sun.jvm.hotspot.tools.JMap.main(JMap.java:202)
>> at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.runJMAP(SALauncher.java:344)
>> at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:507)
>> 
>> 
>> Seems we have to avoid elimination of the Metadata vtable ; this can be 
>> achieved by linker flags or by modifying class Metadata.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Matthias Baesken has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   metadata: just add a comment, only rely on the linker setting

src/hotspot/share/oops/metadata.hpp line 40:

> 38:   // for serviceability tests to work.
> 39:   // This can be done by linker settings or modifications to the Metadata 
> class.
> 40: 

Sorry I haven't been keeping up with this thread. I believe I ask about PRODUCT 
builds before. How does all this work with PRODUCT builds since there is no 
is_valid() method forcing there to be a Metadata vtable? Can you also expand 
the comment a bit to explain why we need both is_valid() and the linker option?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30771#discussion_r3415602163

Reply via email to