JDK-8339954 : Print JVMCI names with the Compiler.{perfmap,codelist,CodeHeap_Analytics} diagnostic commands
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,21,24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-09-11
  • Updated: 2024-09-23
  • Resolved: 2024-09-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 24
24 b16Fixed
Related Reports
Relates :  
Description
The diagnostic commands `Compiler.codelist`, `Compiler.CodeHeap_Analytics` and `Compiler.perfmap` are handy for analyzing the CodeCache or creating a symbol file for the perf tool. However, with the Truffle framework which uses the GraalVM compiler in "hosted" mode, we can end up with hundreds if not thousands of nmethods which are all linked to the same Java method (most prominently `com.oracle.truffle.runtime.OptimizedCallTarget.profiledPERoot()`). All these nmethods are currently indistinguishable by the two aforementioned diagnostic commands.

But nmethods compiled by the GraalVM compiler have a special "JVMCI name" attached to them, which in the case of Truffle corresponds to the guest language function name. Print this "JVMCI name" in addition to the true Java method name to make it easier to distinguish various nmethods compiled by Truffle or other frameworks which use the GraalVM compiler in hosted mode.

For the `Compiler.perfmap` command, it should be mentioned that the format of the created perfmap file is specified here:
https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/jit-interface.txt

It only mandates that each line starts with a start and size number in hex and interprets the whole rest of the line (which can even include special characters) as a "symbolname". Taking into account that we already today produce "symbol names" as different as "throw_range_check_failed Runtime1 stub", "Signature Handler Temp Buffer", "I2C/C2I adapters" or "boolean java.lang.invoke.VarHandleInts$FieldInstanceReadWrite.compareAndSet(java.lang.invoke.VarHandle, java.lang.Object, int, int)", adding a potential jvmci suffix like "jvmci_name=myFancyJSFunction()#2" will not cause any compatibility issues.

And the output of `Compiler.CodeHeap_Analytics` is unparsable anyway :)
Comments
Changeset: 996790c7 Branch: master Author: Volker Simonis <simonis@openjdk.org> Date: 2024-09-16 14:55:53 +0000 URL: https://git.openjdk.org/jdk/commit/996790c70f902d7840d0649a6b0867bed47c6537
16-09-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/20954 Date: 2024-09-11 18:48:18 +0000
11-09-2024