RFR: 8284579: Improve VarHandle checks for interpreter [v3]

Claes Redestad redestad at openjdk.java.net
Tue Apr 12 08:34:41 UTC 2022


On Tue, 12 Apr 2022 01:15:33 GMT, David Holmes <dholmes at openjdk.org> wrote:

> > checkExactAccessMode -> checkAccessModeThenIsDirect
> 
> Don't you still want "Exact" in there? That "access" check seems odd anyway as it only checks for one form of mismatch - should it not also check for `!exact && accessModeType(ad.type) == ad.symbolicMethodTypeExact`?

What's checked is that the access mode is nominally OK. It just so happens that the only rule validated up front is that iff the VH is exact then the types must be an exact match. 

For non-exact VH sufficient checks will be done later, eg. by the `asType` call (if the type of the VH isn't adaptable to `ad.symbolicMethodTypeInvoker` this will throw an exception).

With that in mind then the name `checkExactAccessMode` even appears misleading as it can be interpreted that the VH _must_ be `exact`. Which is not the case. Dropping the `Exact` part makes it less ambiguous.

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

PR: https://git.openjdk.java.net/jdk/pull/8160


More information about the core-libs-dev mailing list