Any bytecode containing CONSTANT_Dynamic?
Vicente Romero
vicente.romero at oracle.com
Fri Jun 8 13:22:26 UTC 2018
On 06/08/2018 06:39 AM, Remi Forax wrote:
>
> ------------------------------------------------------------------------
>
> *De: *"Ess Kay" <s.2016.kay at gmail.com>
> *À: *"compiler-dev" <compiler-dev at openjdk.java.net>
> *Envoyé: *Vendredi 8 Juin 2018 02:13:10
> *Objet: *Any bytecode containing CONSTANT_Dynamic?
>
> We are needing to test our applications ability to correctly
> handle the new |CONSTANT_Dynamic| constant pool entry. Is there
> any Java source code available anywhere that would result in the
> Java 11 javac generating bytecode containing |CONSTANT_Dynamic|
> pool entries?
>
>
> Constant lambdas are translated into constant dynamic at least by the
> javac of Amber, but i do not know if the javac of the jdk11 does that too.
right you can clone the repo at [3] and move to the condy-folding
branch. Once you build it you will have a JDK that is able to generate
condy for non-capturing lambdas, also for lambdas that only capture
constants:
Runnable r = () -> {}
--------------------------------
String prefix = "__";
Function <String, String> s -> prefix + s;
etc
Thanks,
Vicente
>
> Otherwise, if you look for classes containing constant dynamic, we use
> this class [1] that was generated using the javac of Amber when
> testing ASM.
> If you want a more complex example, you can play with cplisp which
> encode lisp atoms into the constant pool using constant dynamic [2].
>
> regards,
> Rémi
>
> [1]
> https://gitlab.ow2.org/asm/asm/blob/master/asm-test/src/main/resources/jdk11/LambdaCondy.class
> [2] https://github.com/forax/cplisp/blob/master/.travis.yml
>
[3] http://hg.openjdk.java.net/amber/amber
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20180608/a591ef21/attachment.html>
More information about the compiler-dev
mailing list