Skip to content

Conversation

fbredber
Copy link
Contributor

@fbredber fbredber commented Sep 30, 2025

Since we have removed all other locking modes than lightweight locking (see: 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.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8367601: Remove held_monitor_count (Sub-task - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27570/head:pull/27570
$ git checkout pull/27570

Update a local copy of the PR:
$ git checkout pull/27570
$ git pull https://git.openjdk.org/jdk.git pull/27570/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 27570

View PR using the GUI difftool:
$ git pr show -t 27570

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27570.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 30, 2025

👋 Welcome back fbredberg! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Sep 30, 2025

@fbredber This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8367601: Remove held_monitor_count

Reviewed-by: mdoerr, pchilanomate, fyang

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 43 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented Sep 30, 2025

@fbredber The following labels will be automatically applied to this pull request:

  • graal
  • hotspot

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@fbredber fbredber marked this pull request as ready for review September 30, 2025 12:37
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 30, 2025
@fbredber
Copy link
Contributor Author

@TheRealMDoerr, @RealFYang
I've run rudimentary tests using QEMU, but it would be nice if you guys (or any of your friends) could take it for a spin on real hardware. Thanks in advance.

@mlbridge
Copy link

mlbridge bot commented Sep 30, 2025

Webrevs

@TheRealMDoerr
Copy link
Contributor

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!

if (entry->is_pinned()) {
log_develop_debug(continuations)("PINNED due to critical section");
verify_continuation(cont.continuation());
freeze_result res = entry->is_pinned() ? freeze_pinned_cs : freeze_pinned_monitor;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this and always return freeze_pinned_cs. We should remove freeze_pinned_monitor (there is a matching definition in Continuation.java).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Member

@RealFYang RealFYang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RISC-V part of the change seems fine to me. My local hs:tier1-hs:tier3 passed with fastdebug build.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 1, 2025
@openjdk openjdk bot added core-libs [email protected] and removed ready Pull request is ready to be integrated labels Oct 1, 2025
@openjdk
Copy link

openjdk bot commented Oct 1, 2025

@fbredber core-libs has been added to this pull request based on files touched in new commit(s).

@fbredber
Copy link
Contributor Author

fbredber commented Oct 1, 2025

@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. :)

Copy link
Contributor

@TheRealMDoerr TheRealMDoerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PPC64 and shared code changes look good. Thanks!

@TheRealMDoerr
Copy link
Contributor

I guess you want to update the Copyright headers eventually.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 1, 2025
@fbredber
Copy link
Contributor Author

fbredber commented Oct 1, 2025

@TheRealMDoerr

I guess you want to update the Copyright headers eventually.

Think I updated all the years to 2025.
grep -i 'copyright' $(git diff --name-only master) | grep -i oracle | grep -v 2025

Did you see something I missed?

@TheRealMDoerr
Copy link
Contributor

@TheRealMDoerr

I guess you want to update the Copyright headers eventually.

Think I updated all the years to 2025. grep -i 'copyright' $(git diff --name-only master) | grep -i oracle

Did you see something I missed?

I thought I had seen 2024 somewhere. But, I can't find it again. I guess I had looked at the wrong file. Your Copyright updates look fine. Sorry.

Copy link
Contributor

@pchilano pchilano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs [email protected] graal [email protected] hotspot [email protected] ready Pull request is ready to be integrated rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

4 participants