On Fri, 21 Apr 2023 07:58:45 GMT, Serguei Spitsyn <[email protected]> wrote:
>> src/hotspot/share/prims/jvmtiEnv.cpp line 1200:
>>
>>> 1198: }
>>> 1199: if (java_thread == nullptr) { // unmounted virtual thread
>>> 1200: return JVMTI_ERROR_OPAQUE_FRAME;
>>
>> Where is the check for "suspended at an event" that otherwise results in
>> `JVMTI_ERROR_OPAQUE_FRAME`?
>
> The JVMTI `StopThread` spec has this description:
>> The StopThread function may be used to send an asynchronous
>> exception to a virtual thread when it is suspended at an event.
>> An implementation may support sending an asynchronous exception
>> to a suspended virtual thread in other cases.
>> . . .
>> JVMTI_ERROR_OPAQUE_FRAME:
>> The thread is a suspended virtual thread and the implementation
>> was unable to throw an asynchronous exception from this frame.
>
> This update supports all suspended mounted cases of virtual threads and
> returns OPAQUE_FRAME only if the target virtual thread is suspended and
> unmounted.
> But we avoid using the mount/unmount terms in the JVMTI spec.
What does "suspended at an event" mean? As a programmer trying to use this how
am I supposed to know when it can be used without getting an error?
I find it very surprising that the error would occur with an unmounted thread -
having a VT throw when it was remounted seems the most natural way to implement
this.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13546#discussion_r1173749491