RFR: 8316233: VirtualThreadStart events should not be thread-filtered
Serguei Spitsyn
sspitsyn at openjdk.org
Fri Oct 6 18:21:06 UTC 2023
On Wed, 4 Oct 2023 21:55:21 GMT, Leonid Mesnik <lmesnik 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()` which have a little bit more optimized 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.
>
> src/hotspot/share/prims/jvmtiExport.cpp line 1582:
>
>> 1580: // Do not post virtual thread start event for hidden java thread.
>> 1581: if (JvmtiEventController::is_enabled(JVMTI_EVENT_VIRTUAL_THREAD_START) &&
>> 1582: !thread->is_hidden_from_external_view()) {
>
> Do we need this check? I'm not sure that JavaThread executing a virtual thread. Might be better to replace it with assertion?
Good suggestion, thanks! Will make it an assertion.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16019#discussion_r1349174060
More information about the hotspot-dev
mailing list