-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8367982: Unify ObjectSynchronizer and LightweightSynchronizer #27915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
8367982: Unify ObjectSynchronizer and LightweightSynchronizer #27915
Conversation
|
👋 Welcome back fbredberg! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
Webrevs
|
|
@bulasevich, @TheRealMDoerr, @RealFYang, @offamitkumar |
|
Thanks for cleaning this up on all platforms! Works on PPC64. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this cleanup. I only found some instances in comments where lightweight referred to the locking mode and not just the fast path, so the word should be removed rather than replaced with fast.
| // stability and then install the hash. | ||
| } else if (mark.has_monitor()) { | ||
| } else { | ||
| assert(!mark.is_unlocked() && !mark.is_fast_locked(), "invariant"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that mark.monitor() below already asserts mark.has_monitor() which is stronger.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, but I still like to keep the assert() on 648 for clarity. Would you rather see it removed?
Hello, A simple tier1 test is good on linux-riscv64. I checked the riscv part and I only see in indentation issues as pointed out by @TheRealMDoerr. |
Hi, I ran tier1 and seems like on s390 everything is good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never say "last" cleanup. The renaming to remove "lightweight" looks good. I wasn't sure if we wanted to keep that name or not. There's a lightweight NMT coming so this won't be confused with that anymore. I guess that's good.
|
|
||
| // ----------------------------------------------------------------------------- | ||
| // ConcurrentHashTable storing links from objects to ObjectMonitors | ||
| class ObjectMonitorTable : AllStatic { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess after looking at this, it made sense to combine the lightweightSynchronizer code into synchronizer.cpp (should be ObjectSynchronizer.hpp/cpp). I wonder if the OM table code could be split out into its own file objectMontitorTable.hpp/cpp. I feel like synchronzer.hpp/cpp again does too many different things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are currently investigating the OM table elseware (see: JDK-8365493) I wote for not doing any OM table refactoring in this PR.
| return read_monitor(mark); | ||
| } else { | ||
| return LightweightSynchronizer::get_monitor_from_table(current, obj); | ||
| return ObjectSynchronizer::get_monitor_from_table(current, obj); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's a need for this file anymore. read_monitor is mostly called inside synchronizer.cpp, so it can be inlined there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you want me to do that in this PR? Or should I create a new RFE for that, just to acknowledge the fact that one should never say "last" cleanup. :)
Hi, tier1 runs clean on ARM32. Thanks! |
Oops, my bad. Guess this what you end up with when you use |
This is the last PR in a series of PRs (see: JDK-8344261) to obsolete the LockingMode flag and related code.
The main focus is to to unify
ObjectSynchronizerandLightweightSynchronizer.There used to be a number of "dispatch functions" to redirect calls depending on the setting of the
LockingModeflag.Since we now only have lightweight locking, there is no longer any need for those dispatch functions, so I removed them.
To remove the dispatch functions I renamed the corresponding lightweight functions and call them directly.
This ultimately led me to remove "lightweight" from the function names and go back to "fast" instead, just to avoid having some with, and some without the "lightweight" part of the name.
This PR also include a small simplification of
ObjectSynchronizer::FastHashCode.Tested tier1-7 (on supported platforms) without seeing any problems that can be traced to this code change.
All other platforms (
arm,ppc,riscv,s390) has been sanity checked using QEMU.Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27915/head:pull/27915$ git checkout pull/27915Update a local copy of the PR:
$ git checkout pull/27915$ git pull https://git.openjdk.org/jdk.git pull/27915/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 27915View PR using the GUI difftool:
$ git pr show -t 27915Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27915.diff
Using Webrev
Link to Webrev Comment