Java Magazine, Nov/Dec 2017
ORACLE COM JAVAMAGAZINE NOVEMBER DECEMBER 2017 76 inside the jvm This implementation creates dynamic classes to represent the implementing type of a lambda while at the same time future proofing the implementation and maintaining JIT friendliness It makes use of the simplest case call sites that are looked up once and cannot change thereafter These are represented by instances of ConstantCallSite which I discussed earlier More complex cases are possible including call sites that can change or even have semantics similar to volatile variables These cases are harder to handle and quickly become very complex but they provide the greatest amount of dynamic flexibility available to the platform The previous example of lambda expressions shows how the invokedynamic opcode relaxes a key part of the static type system and makes flexible runtime dispatch possible Conclusion While invokedynamic might not be a part of Java that most developers are exposed to very often the Java ecosystem has evolved significantly through its addition Future versions of Java may well introduce further advances in VM technology and many of these techniques would be impossible without the advent of invokedynamic and the reimagining of method execution that it represents article Ben Evans @ kittylyst is a Java Champion tech fellow and founder at jClarity an organizer for the London Java Community LJC and a member of the Java SE EE Executive Committee Demystifying invokedynamic Part 1 by Julien Ponge Java Magazine January February 2013 PDF Demystifying invokedynamic Part 2 by Julien Ponge Java Magazine May June 2013 PDF learn more
You must have JavaScript enabled to view digital editions.