RFR: 8320318: ObjectMonitor Responsible thread [v2]
Coleen Phillimore
coleenp at openjdk.org
Tue Sep 17 13:15:08 UTC 2024
On Tue, 17 Sep 2024 12:03:57 GMT, Fredrik Bredberg <fbredberg at openjdk.org> wrote:
>> src/hotspot/share/runtime/objectMonitor.hpp line 360:
>>
>>> 358:
>>> 359: enum class TryLockResult { Interference = -1, HasOwner = 0, Success = 1 };
>>> 360: TryLockResult TryLock(JavaThread* current);
>>
>> This CamelCase syntax is used for private methods. We should change it to try_lock now that we are calling it from SharedRuntime code. Another alternative is to keep it private and just use the already available try_enter(). That has the benefit of not having to make TryLockResult public either. If we want to skip the checks after TryLock in try_enter we could add a check_owner_already boolean.
>
> Good suggestion! I'll go with the "Another alternative...".
Yes, that's a good suggestion. try_enter() is already exported. Also change the comment in try_enter():
// TryLock avoids the CAS and handles deflation.
because it used to be a try_set_owner_from(), and now there's two reasons it can't go back.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19454#discussion_r1763225745
More information about the hotspot-dev
mailing list