RFR: 8369019: Improve timed-park mechanism in ObjectMonitor for virtual thread support [v2]

Patricio Chilano Mateo pchilanomate at openjdk.org
Fri Oct 3 15:29:26 UTC 2025


On Thu, 2 Oct 2025 05:36:14 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Patricio Chilano Mateo has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix typos
>
> src/hotspot/share/runtime/objectMonitor.cpp line 997:
> 
>> 995:   // prevents this load from floating up previous store.
>> 996:   // Note that we can have false positives where timed-park is not necessary.
>> 997:   bool do_timed_parked = has_unmounted_vthreads();
> 
> Don't we still only need the timed-park if the current thread is a pinned vthread?

Yes, except if the monitor is also used in the context of a carrier thread. Currently there are only very few such cases and we disable preemption for them (e.g. `interruptLock`), so it’s likely not needed. With the upcoming changes to preempt on klass initialization, we could also have this situation if a class can be initialized both in the context of a carrier and a vthread. Since code executed in the context of the carriers is limited to library code there will also be very few cases of this, but I’ve seen at least one such case with `LockSupport`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27597#discussion_r2402384724


More information about the hotspot-runtime-dev mailing list