JDK-8267612 : Declare package-private VarHandle.AccessMode/AccessType counts
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-05-24
  • Updated: 2021-06-07
  • Resolved: 2021-05-25
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.
JDK 17
17 b24Fixed
Related Reports
Relates :  
Description
When creating VarHandles and in a few other places we call VarHandle.AccessMode/-Type.values().length. This cause cloning of the underlying array, only to discard it. An optimizing compiler would of course shortcut this, but these calls mostly happen during startup of applications. To reduce startup/warmup overheads of using VarHandles (which will be more crucial with JDK-8267277) it makes sense to introduce a constant value equal to values().length.
Comments
Changeset: 66b190e1 Author: Claes Redestad <redestad@openjdk.org> Date: 2021-05-25 11:47:33 +0000 URL: https://git.openjdk.java.net/jdk/commit/66b190e1e7d06f3fc59917b5346e94a128e928cd
25-05-2021