RFR: 8316233: VirtualThreadStart events should not be thread-filtered [v2]

Chris Plummer cjplummer at openjdk.org
Fri Oct 6 23:28:02 UTC 2023


On Fri, 6 Oct 2023 18:46:42 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:

>> The JVMTI VirtualThreadStart events have to follow the ThreadStart events pattern and so, should not be thread-filtered.
>> The fix includes:
>>  - `jvmti.xml`: remov the attribute `filtered="thread"` in the `VirtuallThreadStart` event spec
>>  - `jvmtiEventController.cpp`: remove the `VTHREAD_START_BIT` from the `THREAD_FILTERED_EVENT_BITS` mask and and it to the `NEED_THREAD_LIFE_EVENTS` mask
>>  - `jvmtiExport.cpp`: rearrangements in the `JvmtiExport::post_vthread_start()` function
>> 
>> The fix also includes a couple of minor unification tweaks:
>>  - to align `JvmtiExport::post_thread_end()` with `JvmtiExport::post_vthread_end()` to have a unified check for the `JVMTI_PHASE_PRIMORDIAL`.
>>  -  to rename the local variable `cur_thread` as `thread` to follow the common pattern in `JvmtiExport::post_vthread_start()` and `JvmtiExport::post_vthread_end()`
>>  
>>  Testing: ran mach5 tiers 1-6. All tests are passed.
>
> Serguei Spitsyn has updated the pull request incrementally with one additional commit since the last revision:
> 
>   review: convert check for is_hidden_from_external_view check() into assert

src/hotspot/share/prims/jvmti.xml line 13044:

> 13042: 
> 13043:  <event label="Virtual Thread Start"
> 13044:          id="VirtualThreadStart" const="JVMTI_EVENT_VIRTUAL_THREAD_START" num="87" phase="start" since="21">

Does "filtered" mean that the event can be enabled or disabled on a per thread basis, and therefore by removing this it means the event can only be enabled or disabled globally?

src/hotspot/share/prims/jvmtiExport.cpp line 1581:

> 1579:   assert(!thread->is_hidden_from_external_view(), "carrier threads can't be hidden");
> 1580: 
> 1581:   // Do not post virtual thread start event for hidden java thread.

Why would we ever have a hidden virtual thread? Also, why is this comment here. It is also below, which seems to be the more appropriate location.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16019#discussion_r1349381024
PR Review Comment: https://git.openjdk.org/jdk/pull/16019#discussion_r1349379751


More information about the serviceability-dev mailing list