RFR: 8338383: Implement JEP 491: Synchronize Virtual Threads without Pinning [v12]
Dean Long
dlong at openjdk.org
Mon Oct 28 23:13:21 UTC 2024
On Mon, 28 Oct 2024 20:49:45 GMT, Patricio Chilano Mateo <pchilanomate at openjdk.org> wrote:
>> src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp line 2382:
>>
>>> 2380: __ bind(after_transition);
>>> 2381:
>>> 2382: if (LockingMode != LM_LEGACY && method->is_object_wait0()) {
>>
>> It bothers me that we have to add a check for a specific native method in this code (notwithstanding there are already some checks in relation to hashCode). As a follow up I wonder if we can deal with wait-preemption by rewriting the Java code, instead of special casing the wait0 native code?
>
> Not sure. We would have to return from wait0 and immediately clear the physical stack from the frames just copied without safepoint polls in the middle. Otherwise if someone walks the thread's stack it will find the frames appearing twice: in the physical stack and in the heap.
It's conceivable that in the future we might have more native methods we want to preempt. Instead of enumerating them all, we could set a flag on the method.
I was assuming that David was suggesting we have the Java caller do a yield() or something, instead of having the native code call freeze.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21565#discussion_r1819880228
More information about the nio-dev
mailing list