On Mon, 31 Aug 2026 03:59:34 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/objectMonitorTable.cpp line 571: > >> 569: Table* curr = _curr.load_acquire(); >> 570: >> 571: assert(hash != 0, "must be"); > > Seems unrelated to the cleanup. Why must it be? All our `put` methods expect the hash to have been installed in the markWord (I think the get has the same expectation, but there it is not a correctness issue if it is missing) Right now we only ever interact with the ObjectMonitorTable if we have encountered an object with the monitor lock bits. And it is invariant that an object where we once have seen the monitor lock bits also must have a hash installed in the header. I think we could and probably should rewrite this so that our `get` short-circuits objects without a hash, and that our `put` uses `oopDesc::identity_hash` which ensures that we have an identity hash for the object. And remove the `(void)object->identity_hash(...);` calls inside `ObjectSynchronizer::inflate_*` ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/32573#discussion_r3891874392
