RFR: 8298853: JvmtiVTMSTransitionDisabler should support disabling one virtual thread transitions [v2]

David Holmes dholmes at openjdk.org
Tue Dec 20 04:39:53 UTC 2022


On Mon, 19 Dec 2022 12:13:42 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:

>> src/hotspot/share/prims/jvmtiThreadState.cpp line 298:
>> 
>>> 296:   HandleMark hm(thread);
>>> 297:   Handle vth = Handle(thread, JNIHandles::resolve_external_guard(_vthread));
>>> 298:   if (!java_lang_VirtualThread::is_instance(vth())) {
>> 
>> How can this condition not be true? Should it be an assertion?
>
> The JvmtiVTMSTransitionDisabler has to be a no-op for a non-virtual thread. It is to avoid different branches where it is possible for virtual and non-virtual cases and use this in `jvmtiEnv.cpp`:
> `  JvmtiVTMSTransitionDisabler disabler(thread);`
> I've added comments that mark no-op cases.

I see. I assumed the name `_vthread` implied it was actually known to be a vthread. Really the field and parameters should just be called `thread`.

-------------

PR: https://git.openjdk.org/jdk/pull/11690


More information about the hotspot-dev mailing list