On Fri, 23 Jan 2026 20:08:58 GMT, Chen Liang <[email protected]> wrote:

>> Since access descriptor is created for each VH operation site, we can 
>> optimistically cache the adapted method handle in a site if the site 
>> operates on a constant VH.  Used a C2 IR test to verify such a setup through 
>> an inexact VarHandle invocation can be constant folded through (previously, 
>> it was blocked by `asType`)
>
> 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.

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

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

Reply via email to