Search, explore and find the perfect course for you
Using invoke dynamic to teach the JVM a new language
In the space of the last year, I've been working on porting the Rakudo Perl 6 compiler to the Java Virtual Machine. Traditionally, languages have been at a disadvantage on the JVM when their type systems and dispatch mechanisms were a long way from Java. Extra dispatch and type checking logic would tend to bulk up code, throw off the JIT compiler's analysis and leave the JVM less able to apply its many, many optimizations.
Then came invokedynamic: a new JVM instruction aimed at making the situation better. While at first blush a single new instruction doesn't seem like much, it's the infrastructure that lies behind it that makes it so powerful. Really, invokedynamic is a programmable instruction, its meaning selectable - and even changeable - at runtime.
In this session I'll talk about how invokedynamic works, look at some of the ways I've been using it, and discuss how it impacts performance. I'll also try to pick out what it is about the design of invokedynamic that makes it so versatile, principles that can be applied whenever we build stuff.