RFR: 8347431: Update ObjectMonitor comments [v2]

Coleen Phillimore coleenp at openjdk.org
Mon Jan 13 13:06:11 UTC 2025


On Mon, 13 Jan 2025 06:40:55 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add @dholmes comment
>
> src/hotspot/share/runtime/objectMonitor.hpp line 92:
> 
>> 90: //   means that ObjectMonitor cannot inherit from any other class nor can
>> 91: //   it use any virtual member functions. This restriction is critical to
>> 92: //   the proper functioning of the VM.
> 
> So having it at offset zero is no longer a restriction but we still keep it there because of performance. That in turn means we still can't inherit from any other class, so that is still a restriction. Suggestion:
> 
> // For performance reasons we ensure the _metadata field is located at offset 0, which in turn
> // means that ObjectMonitor can't inherit from any other class nor use any virtual member functions.

Allegedly for performance.  I should do an experiment because it seems like _owner might be more frequently accessed, except maybe with UseObjectMonitorTable that needs the hashcode.  I'm sort of dubious it makes a difference at all which is why I didn't keep that part of the comment.  But I'll add your comment as suggested.

> src/hotspot/share/runtime/objectMonitor.hpp line 124:
> 
>> 122: //   in synchronizer.cpp. Also see TEST_VM(SynchronizerTest, sanity) gtest.
>> 123: //
>> 124: // Futures notes:
> 
> Aren't the following items still future items to be potentially addressed?

I believe they are true in the current implementation.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23042#discussion_r1913155703
PR Review Comment: https://git.openjdk.org/jdk/pull/23042#discussion_r1913147977


More information about the hotspot-runtime-dev mailing list