[PATCH] Allow LambdaMetaFactory generate direct field access instructions

JARvis PROgrammer mrjarviscraft at gmail.com
Mon Sep 9 19:48:35 UTC 2019


This may be considered related to
https://bugs.openjdk.java.net/browse/JDK-8222744 according to which the
creation of MethodHandles was allowed for fields.

пн, 9 сент. 2019 г. в 22:36, JARvis PROgrammer <mrjarviscraft at gmail.com>:

> Hi there, according to the latest sources of JDK, LambdaMetafactory is
> unable to create Lambdas for field-access instructions (getstatic,
> putstatic, getfield, setfield). While on Java 9+ this is not a
> serious issue (as we already have VarHandle API for this), this is nice
> for backporting to Java 8 where this would allow framework developers use
> this for generating field access implementations at runtime.
>
> Here is the diff-file:
> https://gist.github.com/JarvisCraft/d66e69d47be56451a0f74cd9208457f6
> It is made to be minimal in its changes thus modifying only
> AbstractValidatingLambdaMetaFactory (originally prohibiting the creation
> of Lambdas for REF_getStatic, REF_putStatic, REF_getField, REF_getField)
> changing the switch in the constructor and adding a boolean field
> indicating whether the generated code should be for a method or a field and
> modyfying
> InnerClassLambdaMetaFactory.ForwardingMethodGenerator#generate() adding
> ASM-code generation for field access.
> It seems that there is nothing more needed to implement this change
> according to the source code of the changed classes.
>
> Yet, I expect this change to be inappropriate for here and thus ask you to
> forward me (if possible) to any other mailing list or explain what else is
> needed to have this patched.
>
> Thanks in advance,
> Peter
>


More information about the core-libs-dev mailing list