Summary
Make JVM TI functions GetCurrentThreadCpuTime and GetThreadCpuTime optional for virtual threads.
Problem
The following two JVM TI timer functions are currently specified to return JVMTI_ERROR_UNSUPPORTED_OPERATION for virtual threads:
- GetCurrentThreadCpuTime
- GetThreadCpuTime
The support of these two functions must be specified as optional for virtual threads.
Solution
Each function spec should have the following description for JVMTI_ERROR_UNSUPPORTED_OPERATION error:
is a virtual thread and the implementation does not
support getting the thread CPU time of a virtual thread.
Specification
Here is the suggested JVM TI spec patch:
diff --git a/src/hotspot/share/prims/jvmti.xml b/src/hotspot/share/prims/jvmti.xml
index 4baaca503c0..5f68fc9a7a9 100644
--- a/src/hotspot/share/prims/jvmti.xml
+++ b/src/hotspot/share/prims/jvmti.xml
@@ -11058,7 +11058,8 @@ myInit() {
</parameters>
<errors>
<error id="JVMTI_ERROR_UNSUPPORTED_OPERATION">
- Current thread is a virtual thread.
+ The current thread is a virtual thread and the implementation does not support
+ getting the current thread CPU time when the current thread is a virtual thread.
</error>
</errors>
</function>
@@ -11140,7 +11141,8 @@ myInit() {
</parameters>
<errors>
<error id="JVMTI_ERROR_UNSUPPORTED_OPERATION">
- <paramlink id="thread"/> is a virtual thread.
+ <paramlink id="thread"/> is a virtual thread and the implementation does not
+ support getting the thread CPU time of a virtual thread.
</error>
</errors>
</function>
- csr of
-
JDK-8302615 make JVMTI thread cpu time functions optional for virtual threads
- Resolved