The JVM Tool Interface (JVM TI) has been updated in this release to support virtual threads. Maintainers of agents that use JVM TI are strongly recommended to read [JEP 425](https://openjdk.java.net/jeps/425) and the JVM TI 19.0 specification. The following is a summary of the JVM TI support for virtual threads:
- Most JVM TI functions that are called with a jthread (i.e., a JNI reference to a Thread object) can be called with a reference to a virtual thread. The functions that are not supported on virtual threads are `PopFrame`, `ForceEarlyReturn`, `StopThread`, `AgentStartFunction` and `GetThreadCpuTime`. The `SetLocal*` functions support setting local variables in the top-most frame of virtual threads that are suspended at a breakpoint or single step event but are allowed to fail with `JVMTI_ERROR_OPAQUE_FRAME` in other scenarios.
- All JVM TI events, with the exception of those posted during early VM startup or during heap iteration, can have event callbacks invoked in the context of a virtual thread.
- The `GetAllThreads` and `GetAllStackTraces` functions are specified to return all platform threads rather than all threads.
- New functions `SuspendAllVirtualThreads` and `ResumeAllVirtualThreads` are added to support bulk suspend and resume of virtual threads. New events `VirtualThreadStart` and `VirtualThreadEnd` are added to support tracking of virtual threads. A new capability, `can_support_virtual_threads` is used to enable the use of the new functions and events.
Existing JVM TI agents will mostly work as before, but may encounter errors if they invoke functions that are not supported on virtual threads. These will arise when an agent that is unaware of virtual threads is used with an application that uses virtual threads. The change to `GetAllThreads` to return an array containing only the platform threads may be an issue for some agents. Existing agents that enable the `ThreadStart` and `ThreadEnd` events for all threads may encounter performance issues until they are upgraded to have finer control of these events.