Lambda Mechanics
The JVM implementation details behind Java 8 Lambdas
With Java 7 'invokedynamic' was added to the JVM instruction set and the concept of method handles was introduced – but not used at all by the Java language compiler. This changed when Java 8 lambda expressions and method references were introduced. Now the compiler makes heavily use of the new JVM capabilities.
In this presentation we explore the technical details of compiled lambda expressions and learn about the new JVM capabilities – which come with several performance benefits and could also be used for other JVM languages.
References
Code Examples:
https://github.com/marchof/lambda-mechanics
JLS8: Functional Interfaces, Chapter 9.8
JLS8: Compile-Time Step 3: Is the Chosen Method Appropriate? Chapter 15.12.3
JLS8: Runtime-Evaluation of Lambda Expressions, Chapter 15.27.4
The Java Virtual Machine Specification, Java SE 8 Edition
Java 8 API: LambdaMetafactory
Brian Götz: Lambda - A Peek Under The Hood
Anton Arihpov: Java 8 Revealed