RFR: 8338383: Implement JEP 491: Synchronize Virtual Threads without Pinning [v5]
Patricio Chilano Mateo
pchilanomate at openjdk.org
Thu Oct 24 21:17:14 UTC 2024
On Thu, 24 Oct 2024 06:18:10 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> So the value stored in _owner has to be ANONYMOUS_OWNER. We cannot store the BasicLock* in there as before since it can clash with some other thread's tid. We store it in the new field _stack_locker instead.
>
> Right I understand we can't store the BasicLock* directly in owner, but the naming of this method has me confused as to what it actually does. With the old version we have:
>
> Before: owner = BasicLock* belonging to current
> After: owner = JavaThread* of current
>
> with the new version we have:
>
> Before: owner = ANONYMOUS_OWNER
> After: owner = tid of current
>
> so "BasicLock" doesn't mean anything here any more. Isn't this just `set_owner_from_anonymous` ?
I see your point. I removed this method and had the only caller just call set_owner_from_anonymous() and set_stack_locker(nullptr). There was one other caller in ObjectMonitor::complete_exit() but it was actually not needed so I removed it. ObjectMonitor::complete_exit() is only called today on JavaThread exit to possibly unlock monitors acquired through JNI that where not unlocked.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21565#discussion_r1815697784
More information about the serviceability-dev
mailing list