RFR: 8160821: VarHandle accesses are penalized when argument conversion is required [v13]

ExE Boss duke at openjdk.org
Sat Feb 21 13:50:13 UTC 2026


On Fri, 23 Jan 2026 23:02:34 GMT, John R Rose <jrose at openjdk.org> wrote:

>> Chen Liang has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Wording update, thanks Jorn
>
> src/java.base/share/classes/java/lang/invoke/VarHandle.java line 2022:
> 
>> 2020:     // In a class file, the JVM creates one access descriptor for one (name, type) combination.
>> 2021:     // Many call sites in one class can have the same (name, type) combination.
>> 2022:     // In this case, they share the same access descriptor.
> 
> I love it when, as part of maintenance, informative comments like these are added.  Thanks!
> 
> Please add a comment something like this as well:
> 
> 
> // Note:  The integers type and mode are proxies for the AccessType and
> // AccessMode enumerations, and the access type simply summarizes something
> // about the shape of the access mode.  The crucial type here, of the (name, type)
> // combination, is the MethodType that decorates the access shape with specific
> // strong types for the handle operation inputs and outputs.
> 
> 
> I think it was a small faux pas, some time ago, to choose the term `AccessType` instead of `AccessKind`, simply because the term "type" is already disastrously overloaded in our system.  But that’s water under the bridge.  Now we have one more "type" floating around in this neighborhood.

Well, `AccessType` can probably be renamed to `AccessKind`, since it’s a package‑private member of [`VarHandle`] ([`AccessMode`] is the public enum).
https://github.com/openjdk/jdk/blob/a35945ae067ffd60d5f374060086650636ebd9de/src/java.base/share/classes/java/lang/invoke/VarHandle.java#L1669-L1674

[`VarHandle`]: https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/invoke/VarHandle.html#nested-class-summary
[`AccessMode`]: https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/invoke/VarHandle.AccessMode.html

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28585#discussion_r2836196360


More information about the core-libs-dev mailing list