RFR: 8364141: Remove LockingMode related code from x86
Axel Boldt-Christmas
aboldtch at openjdk.org
Fri Aug 1 06:14:57 UTC 2025
On Wed, 30 Jul 2025 13:17:37 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, instead it's declared as `const int LockingMode = LM_LIGHTWEIGHT;`. This means that we can now safely remove all `LockingMode` related code from all platforms.
>
> This PR removes `LockingMode` related code from the **x86** platform.
>
> When all the `LockingMode` code has been removed from all platforms, we can go on and remove it from shared (non-platform specific) files as well. And finally remove the `LockingMode` variable itself.
>
> Passes tier1-tier5 with no added problems.
Nice cleanup! Some small initial comments.
All the "displaced header" comments looks out of place. Displacing the header word on the stack (in the box) was purely a LM_LEGACY thing. Now we only displace it in the ObjectMonitor which is only handled (inflation / deflation) in the C++ runtime.
There are some more `BasicLock::displaced_header_offset_in_bytes()` asserts inside the x86 code. For callers of these methods, could be removed now or when the `BasicLock` is cleaned up.
There are some unused variables because of "displaced header" code that is kept.
`fast_lock_lightweight` and `fast_unlock_lockweight` should probably be renamed `fast_lock` and `fast_unlock` to be in sync with all the comments. (Or all the comments should be updated) (Same with C2 AD instruction)
src/hotspot/cpu/x86/interp_masm_x86.cpp line 1032:
> 1030: const Register tmp_reg = rbx;
> 1031: const Register obj_reg = c_rarg3; // Will contain the oop
> 1032: const Register rklass_decode_tmp = rscratch1;
Unused variable.
src/hotspot/cpu/x86/interp_masm_x86.cpp line 1037:
> 1035: const int lock_offset = in_bytes(BasicObjectLock::lock_offset());
> 1036: const int mark_offset = lock_offset +
> 1037: BasicLock::displaced_header_offset_in_bytes();
Unused variable.
src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp line 2194:
> 2192:
> 2193: // Load the oop from the handle
> 2194: __ movptr(obj_reg, Address(oop_handle_reg, 0));
`mark_word_offset` and `count_mon` unused variable above.
-------------
Changes requested by aboldtch (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/26552#pullrequestreview-3077803768
PR Review Comment: https://git.openjdk.org/jdk/pull/26552#discussion_r2247015924
PR Review Comment: https://git.openjdk.org/jdk/pull/26552#discussion_r2247016992
PR Review Comment: https://git.openjdk.org/jdk/pull/26552#discussion_r2247033438
More information about the hotspot-compiler-dev
mailing list