JDK-8151706 : Update VarHandle implementation to use @Stable arrays
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2016-03-11
  • Updated: 2016-04-25
  • Resolved: 2016-04-11
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 9
9 b114Fixed
Related Reports
Blocks :  
Description
The VarHandle implementation currently explodes out constants into fields because C1 does not support @Stable on arrays. 

JDK-8143407 will fix that. When it does update the implementation to use @Stable arrays (indexed by enum ordinals), which simplifies the code.
Comments
In combination it's possible to opportunistically reduce the memory churn when linking MemberName instances to implementation methods. Now that the implementations have settled down there is less need for more general reflective linking. Each VarHandle implementation can provide it's own statically initialized member "vtable" table that is assigned to final @Stable ref on VarHandle upon construction. Assertion-based code can verify the table is correct using the current reflective mechanisms. VarForm and it's use of ClassValue could then be removed. Alternatively it may be possible to create MemberName instances lazily in VarHandleGuards.getMemberName, since a stable array will be used. A sentinel value can be used to single an unsupported operation. A null value triggers linking of a MemberName in the table. All the required information should be present in the guard method arguments to create and resolve a MemberName.
07-04-2016