RFR: 8365190: Remove LockingMode related code from share

David Holmes dholmes at openjdk.org
Thu Sep 4 02:35:49 UTC 2025


On Tue, 2 Sep 2025 08:24:10 GMT, Fredrik Bredberg <fbredberg at openjdk.org> wrote:

> Since the integration of [JDK-8359437](https://bugs.openjdk.org/browse/JDK-8359437) the `LockingMode` flag can no longer be set by the user. After that, a number of PRs has been integrated which has removed all `LockingMode` related code from all platforms (except from zero, which is done in this PR).
> 
> This PR removes `LockingMode` related code from the shared (non-platform specific) files. It also removes the `LockingMode` variable itself.
> 
> Passes tier1-tier5 with no added problems.

Looks good. Great cleanup! A couple of nits/suggestions.

Thanks

src/hotspot/share/c1/c1_LIRGenerator.cpp line 638:

> 636:   LIR_Opr hdr = lock;
> 637:   lock = new_hdr;
> 638:   CodeStub* slow_path = new MonitorExitStub(lock, true, monitor_no);

It seems all creators for `MonitorExitStub` now pass `true` so that parameter can be removed.

src/hotspot/share/runtime/basicLock.hpp line 40:

> 38:   // Used as a cache of the ObjectMonitor* used when locking. Must either
> 39:   // be nullptr or the ObjectMonitor* used when locking.
> 40:   volatile uintptr_t _metadata;

So this could now be a properly typed and named field. Future RFE.

src/hotspot/share/runtime/basicLock.hpp line 53:

> 51:   static int displaced_header_offset_in_bytes() { return metadata_offset_in_bytes(); }
> 52: 
> 53:   // For lightweight locking

If the following are for lightweight locking then what are the two previous for?

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

PR Review: https://git.openjdk.org/jdk/pull/27041#pullrequestreview-3179255959
PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2317998409
PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2320634417
PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2320643671


More information about the hotspot-dev mailing list