A proposal advertising asynchronous stack traces in Java is advancing as a result of the OpenJDK’s Java improvement course of action.
The approach, Asynchronous Stack Trace VM API, would define an
AsyncGetStackTrace API to accumulate stack traces asynchronously and include knowledge on both of those Java and indigenous stack frames. Aims of the hard work include things like provision of a nicely-analyzed API for profilers, which would get hold of the Java indigenous stack frames facts, and assist for asynchronous utilization, this kind of as contacting from signal handlers.
As for each the proposal, general performance would not be affected when the API is not in use and memory requirements would not be significantly improved as opposed to the existing
AsyncGetCallTrace API. The new API would not be suggested for creation use, because it could crash the JVM. Designs connect with for minimizing the odds of that by way of intensive screening and fuzzing.
AsyncGetCallTrace is utilised by most offered profilers, both open up resource and commercial, including async-profiler. But it has two key drawbacks. It is an internal API, not exported in any header, and it only returns data about Java frames, particularly their system and bytecode indices. These concerns make applying profilers and linked applications a lot more challenging. Although more details can be extracted from the HotSpot VM via sophisticated code, other practical information stays concealed, these as whether or not a compiled Java frame is inlined, the compilation level of a Java frame, and information on C/C++ frames not at the prime of the stack. This details can be valuable for profiling and tuning a VM for a provided software and for profiling code that greatly employs JNI (Java Indigenous Interface).
AsyncGetStackTrace API would be modeled on the
AsyncGetCallTrace API. The new API has not however been proposed for a specific edition of typical Java. The upcoming model of Java is Java Enhancement Package (JDK) 20, which is envisioned in March 2023.
Copyright © 2022 IDG Communications, Inc.