On Thu, 31 Aug 2023 10:37:26 GMT, Markus Grönlund <mgron...@openjdk.org> wrote:

>> In the virtual thread implementation, thread identity switches to the 
>> carrier before freezing and switches back to the virtual thread after 
>> thawing. This was a forced move due to issues getting JVMTI to work with 
>> virtual threads. JVMTI can now hide events during transitions so we can 
>> invert the sequence back to mounting before running the continuation, 
>> unmounting after freezing, and re-mounting after thawing. This sequence is 
>> important for future changes that will initiate the freezing from the VM.
>> 
>> The change requires an update to the JFR thread sampler to skip sampling 
>> when it samples during a transition.
>> 
>> Testing: tier1-5
>
> src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp line 415:
> 
>> 413:   } else {
>> 414:     assert(NATIVE_SAMPLE == type, "invariant");
>> 415:     if (thread_state_in_native(thread) && 
>> !is_vthread_in_transition(thread)) {
> 
> Is this possible? I assume the thread is in _thread_in_Java during the 
> transition?

There are some native methods that we execute during mount/unmount transitions. 
From what I see they all seem to be defined as `@IntrinsicCandidate`, but if 
for some reason we don't execute the intrinsic version (interp only mode for 
instance) then we would call a normal native method.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15492#discussion_r1311970316

Reply via email to