JDK-8357245 : [lworld] Improve performance of Flat array var handles
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Affected Version: repo-valhalla
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2025-05-19
  • Updated: 2025-10-14
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-valhallaUnresolved
Related Reports
Blocks :  
Causes :  
Relates :  
Relates :  
Description
Unsafe.compareAndSetFlatValueAsBytes is slow, due to:

1. Array var handles must specialize and hold layout as a constant for C2
2. Need minimum arrayLayout0 and newSpecialArray C2 intrinsics for hot compareAndSetFlatValueAsBytes

Old:

This issue's purpose is to keep track of a potential performance regression introduced with JDK-8351569 (and discovered while investigating JDK-8343420). JDK-8351569 introduced a new overloaded version of Unsafe::getAndSet that is not intrinsified (which is used by e.g. VarHandle::getAndSet). We should evaluate how much of a performance impact this can have and potentially intrinsify it or make it call the intrinsified version.
Comments
I think this is more of a compiler-side responsibility to add intrinsics for new unsafe operations, isn't it?
19-05-2025