[lilliput-jdk17u:lilliput] RFR: 8308107: [Lilliput/JDK17] Cherry-pick: 8291555: Implement alternative fast-locking scheme [v3]

Aleksey Shipilev shade at openjdk.org
Mon May 22 11:27:19 UTC 2023


On Wed, 17 May 2023 16:40:04 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

>> This brings "8291555: Implement alternative fast-locking scheme" into lilliput/jdk17. Lots of small improvements, most importantly the fixed-size lock-stack, plus tons of testing and reviews that went into the upstream change that went into JDK21.
>> 
>> Testing:
>>  - [x] tier1 (x86, x86_64, aarch64)
>>  - [x] tier2 (x86, x86_64, aarch64)
>
> Roman Kennke has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Don't restrict Klass prototype headers to Lilliput, b/c biased-locking

Looks okay, with minor nits. We also need to comb through the upstream diff after this integrates to catch anything we accidentally change in upstream.

src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 518:

> 516:   movptr(tmpReg, Address(objReg, oopDesc::mark_offset_in_bytes()));          // [FETCH]
> 517:   testptr(tmpReg, markWord::monitor_value); // inflated vs stack-locked|neutral|biased
> 518:   jccb(Assembler::notZero, IsInflated);

Upstream patch does `jccb` -> `jcc` here:
https://github.com/openjdk/jdk/commit/7f6358a8b53a35a87c9413c68f8fe6c5fdec0caf#diff-318d0e76b9a97e8cf8936be1de34e52735c4d947a77cac38babbbf9a081d16fcR602

src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 711:

> 709:   if (LockingMode == LM_LIGHTWEIGHT) {
> 710:     // If the owner is ANONYMOUS, we need to fix it.
> 711:     testb(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), (int) (intptr_t) ObjectMonitor::ANONYMOUS_OWNER);

Want to do `(int32_t) ObjectMonitor::ANONYMOUS_OWNER)` here, like in upstream? 
https://github.com/openjdk/jdk/commit/7f6358a8b53a35a87c9413c68f8fe6c5fdec0caf#diff-318d0e76b9a97e8cf8936be1de34e52735c4d947a77cac38babbbf9a081d16fcR788

src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 724:

> 722:       // Call the slow-path instead.
> 723:       jcc(Assembler::notEqual, DONE_LABEL);
> 724:     }

(Cannot comment on unaffected code, commenting on the nearest hunk)

Upstream does `jmpb` -> `jmp`  in the RTM block below: https://github.com/openjdk/jdk/commit/7f6358a8b53a35a87c9413c68f8fe6c5fdec0caf#diff-318d0e76b9a97e8cf8936be1de34e52735c4d947a77cac38babbbf9a081d16fcR812

src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 770:

> 768:   movptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(EntryList)));
> 769:   orptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(cxq)));
> 770:   jccb  (Assembler::notZero, DONE_LABEL);

Why this change?

src/hotspot/share/oops/klass.hpp line 655:

> 653:   // prototype markWord. If biased locking is enabled it may further be
> 654:   // biasable and have an epoch.
> 655:   markWord prototype_header() const      { return _prototype_header; }

Why this change? This does not relate to fast-locking scheme?

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

PR Review: https://git.openjdk.org/lilliput-jdk17u/pull/19#pullrequestreview-1436292822
PR Review Comment: https://git.openjdk.org/lilliput-jdk17u/pull/19#discussion_r1200305025
PR Review Comment: https://git.openjdk.org/lilliput-jdk17u/pull/19#discussion_r1200310451
PR Review Comment: https://git.openjdk.org/lilliput-jdk17u/pull/19#discussion_r1200312869
PR Review Comment: https://git.openjdk.org/lilliput-jdk17u/pull/19#discussion_r1200315155
PR Review Comment: https://git.openjdk.org/lilliput-jdk17u/pull/19#discussion_r1200328718


More information about the lilliput-dev mailing list