JDK-8336762 : [JVMCI] Append the jvmci_name to the nmethod name for "hosted" JVMCI compilations
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,21,23
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2024-07-18
  • Updated: 2024-11-10
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.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Description
The GraalVM Truffle framework compiles guest language functions starting from certain well known Truffle AST entry functions like `OptimizedCallTarget::profiledPERoot()`.

Unfortunately, all the nmethods for guest language functions will therefore end up having the same name: `com.oracle.truffle.runtime.OptimizedCallTarget::profiledPERoot`.

This can be quite confusing for tools like profilers, because they will aggregate samples for different instances of  `com.oracle.truffle.runtime.OptimizedCallTarget::profiledPERoot` nmethods under the same name. E.g. if the execution of a JavaScript program triggers the compilation of 100 different JavaScript function they will appear as a single method under the name `OptimizedCallTarget::profiledPERoot()` in the profile.

This behavior is also confusing from a user perspective if using command line flags like `-XX:+PrintCompilation` because it suggests that a single method like  `com.oracle.truffle.runtime.OptimizedCallTarget::profiledPERoot` gets compiled houndreds of times where in realty all these compilations are for different guest language functions.

Fortunately, nmethods created from such "hosted" JVMCI compilations (i.e. JVMCI compilations not triggered by the `CompilerBroker` but e.g. by the Truffle framework) have an addition `jvmci_name` field, which contains the name of the guest language function.

I propose to add this additional `jvmci_name` to the regular nmethod name in the case of "hosted" JVMCI compilations to make them distinguishable in tools and and various logs.