On Mon, 31 Aug 2026 03:55:26 GMT, David Holmes <[email protected]> wrote:
>> Since [JDK-8389325](https://bugs.openjdk.org/browse/JDK-8389325) >> `ObjectMonitor::_metadata` only contains a copy of the object’s hash code. >> But: >> >> 1. A `ObjectMonitorTable` lookup get the hash directly from the object’s >> mark word, and ... >> 2. ... no synchronization code uses the copy stored in the monitor. >> >> Therefore this PR removes the redundant `_metadata` field and its related >> metadata/hash accessors, diagnostics, and serviceability support. >> >> Passes tier1-5 tests successfully on supported platforms. >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > src/hotspot/share/runtime/objectMonitor.hpp line 100: > >> 98: // >> 99: // - The _object and _owner fields should be separated by enough space >> 100: // to avoid false sharing due to parallel access by different threads. > > Not sure this is really true and this now suggests we've seen a false sharing > problem, which we haven't. So probably better to delete the comment. If you remove the padding after `_object`, then this comment can go. > src/hotspot/share/runtime/objectMonitor.hpp line 157: > >> 155: // put it on a different cache line than the _object field. The >> 156: // _object does not change, but it's frequently read during >> 157: // ObjectMonitorTable lookups. > > Again this seems not be be actually known. If _object and _owner were an > issue then the existing padding would not have worked. `_metadata`, formerly known as `_header`, was a hot field and `_owner` was a hot field. More than a decade ago we added padding between `_header` and `_owner` and we had targeted microbenchmarks that proved the padding prevented false sharing on X64 (and SPARC64). I don't remember testing aarch64 back then. For the more general benchmarks, I think there were minor improvements at most. `_object` was not a hot field and we put it adjacent to `_header` as a lightly used field. I believe `_object` is still lightly used. With the removal of `_header` AKA `_metadata`, we no longer need this padding: DEFINE_PAD_MINUS_SIZE(0, OM_CACHE_LINE_SIZE, sizeof(_object)); ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/32573#discussion_r3907535837 PR Review Comment: https://git.openjdk.org/jdk/pull/32573#discussion_r3907442863
