RFR: 8347431: Update ObjectMonitor comments

David Holmes dholmes at openjdk.org
Mon Jan 13 06:50:50 UTC 2025


On Fri, 10 Jan 2025 16:19:15 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> Please review this change that removes a couple of comments that are not true (verified with testing metadata at offset 8).  There are no functional changes.

Changes requested by dholmes (Reviewer).

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.

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?

src/hotspot/share/runtime/objectMonitor.hpp line 144:

> 142:   static ParkEvent* _vthread_unparker_ParkEvent;
> 143: 
> 144:   // Because of frequent access, the the metadata field is at offset zero (0).

Suggestion:

  // Because of frequent access, the metadata field is at offset zero (0).

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

PR Review: https://git.openjdk.org/jdk/pull/23042#pullrequestreview-2545768879
PR Review Comment: https://git.openjdk.org/jdk/pull/23042#discussion_r1912728823
PR Review Comment: https://git.openjdk.org/jdk/pull/23042#discussion_r1912735046
PR Review Comment: https://git.openjdk.org/jdk/pull/23042#discussion_r1912700663


More information about the hotspot-runtime-dev mailing list