Enhancements in JDK 6
Java Virtual Machine Tool Interface (JVM TI)
The following functionality has been added to the JVM tool interface (JVM TI) between its initial release in JDK 5.0 and JDK 6.
- Support for transformation of class files - To facilitate dynamic transformation of classes which have already been loaded, the
RetransformClasses
function has been added. It is suited to operations such as adding instrumentation to methods. Support for retransformation means that access to the original class file is no longer required in order to instrument loaded classes. It can easily remove the applied transformation and it is designed to work in a multi-agent environment. - Enhanced heap walking support - More powerful and flexible heap functionality has been added. The new functionality:
- allows access to primitive values (the value of Strings, arrays, and primitive fields)
- allows the tag of the referrer to be set, thus enabling more efficient localized reference graph building
- provides more extensive filtering abilities
- is extensible, allowing abilities to grow in future versions of JVM TI
FollowReferences
andIterateThroughHeap
functions have been added along with supporting types and constants. The previous functionality is still supported but its use is discouraged. - More class information - The new
GetConstantPool
,GetClassVersionNumbers
andIsModifiableClass
functions provide additional information about a class. - Support for instrumenting native methods - The new
SetNativeMethodPrefix
andSetNativeMethodPrefixes
functions allow native methods to be instrumented by providing a JVM-aware mechanism for wrapping the native method. - Enhanced support for instrumentation under the system class loader - The new
AddToSystemClassLoaderSearch
function allows instrumentation support classes to be defined by the system class loader. - Support for early return from a method - The new force early return functions allow debugger-like tools to force a method to return from any point in its execution.
- Monitor stack depth information - The new
GetOwnedMonitorStackDepthInfo
function provides information about the monitors owned by the specified thread and the depth of the stack frame which locked them. - Support for resource exhaustion notification - The new
ResourceExhausted
event notifies the JVM when a critical resource (such as the Java platform heap) has been exhausted.
AddToBootstrapClassLoaderSearch
to be called in the live phase, and considerable specification clean-up and clarification. For detailed information about the changes, see the Change History.