A la conquête du Graal

Thomas Nunes - Norsys

Appel aux armes !

GraalVM / Graal

LLVM / Clang

???

Oracle

Java 

Scala

Clojure

Groovy

Kotlin

JVM

De nouvelles épreuves

LLVM

IOT

Micro-services

Polyglot

Big data

JVM

GO

warmup 210ms

memory 17.8 MB

image 266 MB

warmup 20ms

memory 1.2 MB

image 15.1MB

- X 10 -

Graal

JEP 295
Ahead-of-Time Compilation

JEP 317
Java-Based JIT Compiler

MaxineVM
meta circular
(depuis 2005)

Metropolis
java on java

Sulong
LLVM interops

Ahead Of Time (AOT)

Just In Time (JIT)

code

bytecode

compilateur JIT

VM
interpreteur JIT

Windows

Linux

Mac

code

compilateur AOT

Linux

Compilateurs

Ahead Of Time (AOT)

Just In Time (JIT)

.java

.class

javac

JVM

Windows

Linux

Mac

.java

native-image

Linux

Appliqué à JAVA

GraalVM

Truffle Polyglot API

Graal compiler

Substrate VM

JIT  +  AOT

Compilateur Graal

JDK 9

JDK 10

Substrate VM

Une nouvelle JVM

AOT - native

Facilement embarquée

Truffle langage API

Architecture

LLVM

C/ C++

Rust

Objective-C

Swift

Kotlin

Fils de GCC
AOT + JIT

Standalone

WebAssembly

IOS

Android

  • Full Scala/Java
  • Contributeur JDK
  • En prod
    • 10 %  OpenJDK   
    • 20 %  OracleJDK

 

Twitter

  • Kotlin native
    • iOS, Android
    • Mac, Windows, Linux
    • WebAssembly
  • C/C++, Swift &co interops
  • Pas de Java
  • Scala native

Kotlin

Choose your side !

Limitations GraalVM

  • Subtrate VM 
    • GC plus simple
    • Limitations (reflection, etc)
    • Pas encore au niveau de Hotspot
  • Graal
    • Compilation AOT longue
  • Truffle
    • Perte de perf sur NodeJs / python / C++
  •  Nécessite un framework (springboot, micronaut &co)

  • Stratégie commerciale Oracle

  • Dynamic Class Loading / Unloading

  • Reflection Class.forName()

  • sun.misc.Unsafe (partial)

  • Finalizers

  • Static Initializers (limitation)

  • JVMTI, JMX, other native VM interfaces

References

  • https://www.slideshare.net/trivadis/techevent-graalvm-performance-interoperability

 

  • https://royvanrijn.com/blog/2018/09/part-2-native-microservice-in-graalvm/

 

 

  • icons : https://www.flaticon.com/free-icon

exemple code
C from java https://gist.github.com/chrisseaton/5a80c19e945a5780d4e58c5af43e6969

 

Merci !

One VM to rule them all

Motivations   >   JIT vs AOT   >   GraalVM   >   LLVM   >    Limitations

          Deux refontes

full JAVA  vs C/C++/Assembleur

     licence vs libre

     Oracle vs Géants du web & mobile