RFR: 8320318: ObjectMonitor Responsible thread

Coleen Phillimore coleenp at openjdk.org
Wed Sep 11 13:41:05 UTC 2024


On Wed, 11 Sep 2024 13:20:23 GMT, Fredrik Bredberg <fbredberg at openjdk.org> wrote:

>> src/hotspot/share/runtime/objectMonitor.cpp line 574:
>> 
>>> 572:   for (;;) {
>>> 573:     if (own == DEFLATER_MARKER) {
>>> 574:       if (TryLockI(current)) {
>> 
>> I can't tell the difference between TryLockI and enter_for().  Did I previously object to enter_for() here?  Maybe I should take that back, and there should be a comment above enter_for() like
>>      // Enters a lock in behalf of a non-current thread, or a thread that is exiting and has previously given up the lock.
>>      // and it handles deflation.
>> 
>> You could add a boolean that you expect success for the enter_for() caller from deoptimization (ie. must_succeed).
>> 
>> This code is getting repetitive - it looks the same in all these places only a little bit different and hard to know why.
>
> Yes @coleenp, you did previously object to calling `enter_for()` from `TryLock()`,  which is why it is what it is today.
> I'm not too proud of how it turned out, and as @dholmes-ora also pointed out , the naming is a bit confusing, so that needs to be fixed.

I was actually confused because there's an enter_for() in all of the synchronizer files and didn't realize you were calling the one in ObjectMonitor.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19454#discussion_r1754573519


More information about the hotspot-dev mailing list