Summary
Modify the statements in GetCurrentThreadCpuTime
and GetThreadCpuTime
that prohibit calling on virtual threads, so that virtual threads are allowed.
Problem
JDK-8302615 modified GetCurrentThreadCpuTime
and GetThreadCpuTime
so that calling them on virtual threads changed from being not supported to being optional. However, both functions still contain a sentence that declares their use with virtual threads is prohibited. These sentence need to be updated to avoid a conflict in the spec.
Solution
Two sentences in the JVM TI spec need adjustment. In the functions GetCurrentThreadCpuTime
and GetThreadCpuTime
, the fragment:
The current thread may not be a virtual thread. Otherwise, the error code ...
is replaced with:
An implementation is not required to support this function when the current thread is a virtual thread, in which case ...
Specification
The specification diff is:
diff --git a/src/hotspot/share/prims/jvmti.xml b/src/hotspot/share/prims/jvmti.xml
index 5f68fc9a7a9..b0c045f9322 100644
--- a/src/hotspot/share/prims/jvmti.xml
+++ b/src/hotspot/share/prims/jvmti.xml
@@ -11022,7 +11022,8 @@ myInit() {
the current thread (see
<functionlink id="GetCurrentThreadCpuTimerInfo"/> vs
<functionlink id="GetThreadCpuTimerInfo"/>).
- The current thread may not be a virtual thread. Otherwise, the error code
+ An implementation is not required to support this function
+ when the current thread is a virtual thread, in which case
<errorlink id="JVMTI_ERROR_UNSUPPORTED_OPERATION"></errorlink> will be returned.
On many platforms this call will be equivalent to:
<example>
@@ -11125,7 +11126,8 @@ myInit() {
<jthread null="current" impl="noconvert"/>
<description>
The thread to query.
- The <code>thread</code> may not be a virtual thread. Otherwise, the error code
+ An implementation is not required to support this function
+ when the given thread is a virtual thread, in which case
<errorlink id="JVMTI_ERROR_UNSUPPORTED_OPERATION"></errorlink> will be returned.
</description>
</param>
- csr of
-
JDK-8303563 GetCurrentThreadCpuTime and GetThreadCpuTime need further clarification for virtual threads
-
- Resolved
-