RFR: 8365190: Remove LockingMode related code from share
Axel Boldt-Christmas
aboldtch at openjdk.org
Wed Sep 3 09:51:45 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.
Nothing obvious seems to be missing from the removal. And the changes look correct.
As @coleenp already mentioned there is even more code now that is effectively unused. Mostly to do with legacy + loom interactions. But I think it is fine to remove that in a follow up RFE.
Similarly there are some nomenclature that should be updated, but I know you have expressed wanting to do that in a follow up RFE as well.
I think it the main refactoring that are left are cleaning up the Synchronizer APIs, unifying some functions etc.
_As for unifying LightweightSynchronizer with the ObjectSynchronizer, there might be an opportunity to let ObjectSynchronizer define the general API used by the rest of the VM to interact with the locking subsystem. And let LightweightSynchronizer contain all of the implementation. This could including moving the locking specific implementation details of relocking, deopting etc. behind an interface, decoupling them, and avoiding leaking implementation._
src/hotspot/share/runtime/basicLock.hpp line 51:
> 49: void set_bad_metadata_deopt() { set_metadata(badDispHeaderDeopt); }
> 50:
> 51: static int displaced_header_offset_in_bytes() { return metadata_offset_in_bytes(); }
The `badDispHeaderDeopt` and `badDispHeaderOSR` constants should also be renamed.
src/hotspot/share/runtime/synchronizer.cpp line 634:
> 632: }
> 633:
> 634: static intptr_t install_hash_code(Thread* current, oop obj) {
A future RFE could potentially simplify and unify this with `FastHashCode`
-------------
Marked as reviewed by aboldtch (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/27041#pullrequestreview-3179315618
PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2318059361
PR Review Comment: https://git.openjdk.org/jdk/pull/27041#discussion_r2318041555
More information about the hotspot-dev
mailing list