On Thu, 2 Apr 2026 14:00:57 GMT, Matthias Baesken <[email protected]> wrote:
> When using "dead" code linktime elimination (linker flag -Wl,--gc-sections) / > LTGC we see a number of hotspot jtreg tests fail. > They are related to the serviceability agent. > > Example serviceability/sa/CDSJMapClstats > > > [2026-02-26T15:48:28.867332189Z] Gathering output for process 2349301 > [2026-02-26T15:48:28.867983029Z] Waiting for completion for process 2349301 > [2026-02-26T15:48:29.341213744Z] Waiting for completion finished for process > 2349301 > Output and diagnostic info for process 2349301 was saved into > 'pid-2349301-output.log' > Attaching to process ID 2341040, please wait... > Debugger attached successfully. > Server compiler detected. > JVM version is 27.0.0.1-internal-adhoc.jdk > 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 this happens because LTGC eliminates the vtable of class Metadata. > This can be shown > when adding --print-gc-sections to the linker steps, then with LTGC I see > this section gets removed ( the _ZTV prefix seems to be about vtable ) > > `removing unused section from '.data.rel.ro._ZTV8Metadata' in file > '/mybuild/hotspot/variant-server/libjvm/objs/metadata.o'` Thanks for the reviews ! If you want I can create a follow up issue to do some 'research' on keeping the needed vtables (especially the Metadata vtable) with C++ language features. That would maybe be 'nicer' and hopefully less tool (linker) - dependent. ------------- PR Comment: https://git.openjdk.org/jdk/pull/30553#issuecomment-4223957998
