[master] RFR: Add some inlining and avoid CAS for quick_enter for lightweight locking.
Axel Boldt-Christmas
aboldtch at openjdk.org
Tue Jul 2 07:07:43 UTC 2024
On Mon, 1 Jul 2024 20:18:48 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
> This is sort of a simple change to inline the code that decides to go to LightweightSynchronizer in case the call has some negative effects for performance sensitive code. Avoiding the CAS in try_enter was the most helpful. With perf, I found that the CAS had a longer stall than with the code without the OM world refactoring. The OM world table is off for this comparison.
> Tested with tier1-4, including some local changes to run tier1 tests with -XX:+UseObjectMonitorTable.
Marked as reviewed by aboldtch (Committer).
src/hotspot/share/runtime/lightweightSynchronizer.cpp line 578:
> 576: };
> 577:
> 578: inline bool LightweightSynchronizer::check_unlocked(oop obj, LockStack& lock_stack, JavaThread* current) {
This could be called something like `fast_lock_try_enter` or `fast_lock_enter`. Or even `enter_fast_lock` (similar name to what is in synchronizer.cpp).
I think I like `fast_lock_try_enter` or `fast_lock_enter` the best.
src/hotspot/share/runtime/objectMonitor.cpp line 385:
> 383:
> 384: bool ObjectMonitor::try_enter(JavaThread* current) {
> 385: if (LockingMode == LM_LIGHTWEIGHT) {
Could probably just do this for all LockingModes.
-------------
PR Review: https://git.openjdk.org/lilliput/pull/187#pullrequestreview-2152862078
PR Review Comment: https://git.openjdk.org/lilliput/pull/187#discussion_r1661939993
PR Review Comment: https://git.openjdk.org/lilliput/pull/187#discussion_r1661941127
More information about the lilliput-dev
mailing list