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  ( _ZTV seems to be about vtable )

`removing unused section from '.data.rel.ro._ZTV8Metadata' in file 
'/mybuild/hotspot/variant-server/libjvm/objs/metadata.o'`

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

Commit messages:
 - JDK-8378838

Changes: https://git.openjdk.org/jdk/pull/30553/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=30553&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8378838
  Stats: 12 lines in 2 files changed: 1 ins; 5 del; 6 mod
  Patch: https://git.openjdk.org/jdk/pull/30553.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/30553/head:pull/30553

PR: https://git.openjdk.org/jdk/pull/30553

Reply via email to