Skip to content

8378838: Fix issues with "dead" code elimination and serviceability agent in libjvm.so on Linux#30553

Open
MBaesken wants to merge 1 commit intoopenjdk:masterfrom
MBaesken:JDK-8378838
Open

8378838: Fix issues with "dead" code elimination and serviceability agent in libjvm.so on Linux#30553
MBaesken wants to merge 1 commit intoopenjdk:masterfrom
MBaesken:JDK-8378838

Conversation

@MBaesken
Copy link
Copy Markdown
Member

@MBaesken MBaesken commented Apr 2, 2026

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'


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8378838: Fix issues with "dead" code elimination and serviceability agent in libjvm.so on Linux (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/30553/head:pull/30553
$ git checkout pull/30553

Update a local copy of the PR:
$ git checkout pull/30553
$ git pull https://git.openjdk.org/jdk.git pull/30553/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 30553

View PR using the GUI difftool:
$ git pr show -t 30553

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/30553.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper bot commented Apr 2, 2026

👋 Welcome back mbaesken! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link
Copy Markdown

openjdk bot commented Apr 2, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title JDK-8378838: Fix issues with "dead" code elimination and serviceability agent in libjvm.so on Linux 8378838: Fix issues with "dead" code elimination and serviceability agent in libjvm.so on Linux Apr 2, 2026
@openjdk openjdk bot added the build build-dev@openjdk.org label Apr 2, 2026
@openjdk
Copy link
Copy Markdown

openjdk bot commented Apr 2, 2026

@MBaesken The following label will be automatically applied to this pull request:

  • build

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 2, 2026
@MBaesken
Copy link
Copy Markdown
Member Author

MBaesken commented Apr 2, 2026

There might also be some C++ 'tricks' / hacks to modify metadata.hpp / cpp and enforce keeping the vtable.
But some use typeid and we get errors when using this because of no-rtti .

@mlbridge
Copy link
Copy Markdown

mlbridge bot commented Apr 2, 2026

Webrevs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build build-dev@openjdk.org rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

1 participant