On Fri, 28 Aug 2026 11:39:54 GMT, Fredrik Bredberg <[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).

Changes requested by dcubed (Reviewer).

Generally look good to me. The first padding block can go (I think).

src/hotspot/share/runtime/objectMonitor.cpp line 2593:

> 2591: //     ...
> 2592: //     [55] = '\0'
> 2593: //   }

If you remove the padding after `_object`, then `_pad_buf0` can go.

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/MonitorCacheDumpPanel.java
 line 68:

> 66:     if (raw) tty.print("(Raw Monitor)");
> 67:     tty.println();
> 68:     tty.println("  _header: 0x" + Long.toHexString(mon.header().value()));

Missed in the rename from `_header` to `_metadata`?

test/hotspot/gtest/runtime/test_objectMonitor.cpp line 34:

> 32: 
> 33:     EXPECT_GE((size_t) in_bytes(ObjectMonitor::owner_offset() - 
> ObjectMonitor::object_offset()), cache_line_size)
> 34:         << "the _object and _owner fields are closer "

If you remove the padding after `_object`, then this test also needs to be 
removed.

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

PR Review: https://git.openjdk.org/jdk/pull/32573#pullrequestreview-5081965546
PR Comment: https://git.openjdk.org/jdk/pull/32573#issuecomment-5499136408
PR Review Comment: https://git.openjdk.org/jdk/pull/32573#discussion_r3907543283
PR Review Comment: https://git.openjdk.org/jdk/pull/32573#discussion_r3907484326
PR Review Comment: https://git.openjdk.org/jdk/pull/32573#discussion_r3907471228

Reply via email to