JDK-8310023 : [lworld] Implement alternative fast-locking scheme in Valhalla
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: repo-valhalla
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-06-14
  • Updated: 2024-07-09
  • Resolved: 2024-07-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
repo-valhallaFixed
Related Reports
Relates :  
Relates :  
Description
Valhalla does not support the alternative fast-locking scheme added by JDK-8291555 yet.
Comments
A pull request was submitted for review. Branch: lworld URL: https://git.openjdk.org/valhalla/pull/1158 Date: 2024-07-06 20:37:56 +0000
09-07-2024

I noticed that lightweight locking goes slow path and goes into the runtime, and then calls IMSE, not IdentityException. Actually a lot of this looks wrong. We shouldn't need to check for wait(), notify() and exit() because the lock won't be entered if it's an identity object. Edit: I see now. The throw is to prevent inflating the monitor that won't already be taken.
05-07-2024

Tier1 passes with -XX:LockingMode=2 when taking this out: diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index c9ff6c0a65a..ee6e67842f3 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -1829,10 +1829,6 @@ bool Arguments::check_vm_args_consistency() { warning("InlineTypeReturnedAsFields is not supported on this platform"); } - // Valhalla missing LM_LIGHTWEIGHT support just now - if (EnableValhalla && LockingMode == LM_LIGHTWEIGHT) { - FLAG_SET_CMDLINE(LockingMode, LM_LEGACY); - } #if !defined(X86) && !defined(AARCH64) && !defined(RISCV64) && !defined(ARM) && !defined(PPC64) && !defined(S390) if (LockingMode == LM_LIGHTWEIGHT) { FLAG_SET_CMDLINE(LockingMode, LM_LEGACY);
02-07-2024

I was trying to figure out what this means since I see the code that throws IdentityException for an inline type in the interpreter, and the compilers either deoptimize or don't compile methods that synchronize on value types. I'm don't see how LockingMode affects this (I ifdefed out the code in arguments.cpp that turns locking mode to Legacy). It looks like the valhalla repo is older than when we switched the default to LIGHTWEIGHT locking mode.
02-07-2024