RFR: 8367601: Remove held_monitor_count

Fredrik Bredberg fbredberg at openjdk.org
Wed Oct 1 13:39:56 UTC 2025


On Tue, 30 Sep 2025 13:32:24 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

>> Since we have removed all other locking modes than lightweight locking (see: [JDK-8344261](https://bugs.openjdk.org/browse/JDK-8344261)), we no longer need:
>> - `_held_monitor_count`
>> - `_parent_held_monitor_count`
>> - `_jni_monitor_count`
>> 
>> This PR removes them from shared code as well as from `X86`, `AArch64`, `PowerPC` and `RISC-V`.
>> They are not present in other platforms.
>> 
>> Tested tier1-7 (on supported platforms) without seeing any problems that can be traced to this code change.
>> `PowerPC` and `RISC-V` has been sanity checked using QEMU.
>
> Looks correct (PPC64 and shared code changes) and tier1 has passed. Would be nice to clean up unused temp registers
> 
> diff --git a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp
> index 0bcc24a23bf..9fe7e1f22ff 100644
> --- a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp
> +++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp
> @@ -1639,7 +1639,6 @@ static void fill_continuation_entry(MacroAssembler* masm, Register reg_cont_obj,
>    assert_different_registers(reg_cont_obj, reg_flags);
>    Register zero = R8_ARG6;
>    Register tmp2 = R9_ARG7;
> -  Register tmp3 = R10_ARG8;
>  
>    DEBUG_ONLY(__ block_comment("fill {"));
>  #ifdef ASSERT
> @@ -1678,7 +1677,6 @@ static void fill_continuation_entry(MacroAssembler* masm, Register reg_cont_obj,
>  static void continuation_enter_cleanup(MacroAssembler* masm) {
>    Register tmp1 = R8_ARG6;
>    Register tmp2 = R9_ARG7;
> -  Register tmp3 = R10_ARG8;
>  
>  #ifdef ASSERT
>    __ block_comment("clean {");
> @@ -1689,8 +1687,8 @@ static void continuation_enter_cleanup(MacroAssembler* masm) {
>  
>    __ ld_ptr(tmp1, ContinuationEntry::parent_cont_fastpath_offset(), R1_SP);
>    __ st_ptr(tmp1, JavaThread::cont_fastpath_offset(), R16_thread);
> -  __ ld_ptr(tmp3, ContinuationEntry::parent_offset(), R1_SP);
> -  __ st_ptr(tmp3, JavaThread::cont_entry_offset(), R16_thread);
> +  __ ld_ptr(tmp2, ContinuationEntry::parent_offset(), R1_SP);
> +  __ st_ptr(tmp2, JavaThread::cont_entry_offset(), R16_thread);
>    DEBUG_ONLY(__ block_comment("} clean"));
>  }
>  
> 
> Thanks for doing it for all platforms!

@TheRealMDoerr
> Would be nice to clean up unused temp registers

Fixed those.

> Thanks for doing it for all platforms!

The same ways as eating different types of food enriches your life, so does programming for different CPUs. :)

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

PR Comment: https://git.openjdk.org/jdk/pull/27570#issuecomment-3356372605


More information about the graal-dev mailing list