RFR: 8347431: Update ObjectMonitor comments [v2]
David Holmes
dholmes at openjdk.org
Tue Jan 14 06:44:38 UTC 2025
On Mon, 13 Jan 2025 12:59:30 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> 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.
Thanks. I think for contended monitors this could be important - it always was in the past.
>> 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.
Recursions is still 64-bit (intx).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23042#discussion_r1914321059
PR Review Comment: https://git.openjdk.org/jdk/pull/23042#discussion_r1914320049
More information about the hotspot-runtime-dev
mailing list