On Tue, 8 Sep 2026 09:34:09 GMT, Fredrik Bredberg <[email protected]> wrote:

> This PR removes displaced-mark related code from the Serviceability Agent, 
> which has become obsolete since 
> [JDK-8389325](https://bugs.openjdk.org/browse/JDK-8389325) removed the 
> `UseObjectMonitorTable` flag.
> 
> It also aligns the SA's mark-word related `printOn()` and `hasMonitor()` 
> functions to their respective C++ functions, `markWord::print_on()` and 
> `markWord::has_monitor()`.
> 
> Because the displaced-mark related code was removed, the 
> `identityHashValueFor()` has been reduced to one line, just returning the 
> hash code directly from the object's mark-word.
> 
> Passes tier1-3 on supported platforms. I also successfully ran 
> `TEST="hotspot/jtreg/serviceability/sa"` on my local machine.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Looks good, just some nits, and potentially some more dead locking code we 
could remove.

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Mark.java line 136:

> 134:   public boolean isBeingInflated() {
> 135:     return (value() == 0);
> 136:   }

I wonder if we should just remove this as well. It is old legacy locking 
displaced markWord related.

Suggestion:

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Mark.java line 151:

> 149:   }
> 150:   public boolean hasMonitor() {
> 151:     // Align SA’s decoding with markWord::has_monitor().

Seems like an unnecessary comment to have in the code. I would have expected a 
comment if for some reason we did not align the SA's mirror implementation with 
the HotSpot code. _(Also that is an exotic apostrophe `’` vs `'`)_


Suggestion:

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ObjectSynchronizer.java
 line 30:

> 28: 
> 29: import sun.jvm.hotspot.oops.*;
> 30: import sun.jvm.hotspot.utilities.*;

Maybe this are imported "just cause". 

But the last use of the import was removed with the `Asserts` removal. 


Suggestion:

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

Changes requested by aboldtch (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/32758#pullrequestreview-5150279351
PR Review Comment: https://git.openjdk.org/jdk/pull/32758#discussion_r3965097422
PR Review Comment: https://git.openjdk.org/jdk/pull/32758#discussion_r3965084808
PR Review Comment: https://git.openjdk.org/jdk/pull/32758#discussion_r3965152513

Reply via email to