SlideShare a Scribd company logo
1 of 45
JVM++: The Graal VM
Martin Toshev,
BGOUG, 04.06.2016
Special thanks to Thomas Wuerthinger and
Oracle Labs for inspiring this presentation …
Who am I
Software consultant (CoffeeCupConsulting)
BG JUG board member (http://jug.bg)
OpenJDK and Oracle RDBMS enthusiast
Who am I
Author of Learning RabbitMQ
Agenda
• Overview of the Graal VM
• Building and managing Graal
• Performance benchmarks
• Future directions
Overview of the Graal VM
Overview of the Graal VM
Some background …
static compilation vs dynamic compilation
static compiler
source code (e.g. JVM bytecode)
dynamic compiler
runtime
machine code
runtime
source code (e.g. JVM bytecode)
machine code
Overview of the Graal VM
• The javac tool performs static compilation of Java
sources to bytecode
• The JVM may perform dynamic compilation of
bytecode to machine code for optimization using a
JIT (Just-in-Time) compiler
Overview of the Graal VM
• Graal is a new JIT (Just-in-Time) compiler for the
JVM
• Brings the performance of Java to scripting
languages (via the Truffle API)
• written in Java
Overview of the Graal VM
• In essence the Graal JIT compiler generates
machine code from an optimized AST rather than
bytecode
• However the Graal VM has both AST and bytecode
interpreters
Overview of the Graal VM
• The Graal VM supports the following types of
compilers (apart from the Graal JIT compiler):
--vm server-nograal // server compiler
--vm server // server compiler using Graal
--vm graal // Graal compiler using Graal
--vm client-nograal // client compiler
--vm client // client compiler running Graal
Overview of the Graal VM
• The Truffle API:
– is a Java API
– provides AST (Abstract Syntax Tree) representation of
source code
– provides a mechanism to convert the generated AST
into a Graal IR (intermediate representation)
Overview of the Graal VM
• The Truffle API is declarative (uses Java
annotations)
• The AST graph generated by Truffle is a mixture of
control flow and data flow graph
• Essential feature of the Truffle API is the ability to
specify node specializations used in node rewriting
Overview of the Graal VM
• The Truffle API is used in conjunction with custom
annotation processor that generates code based
on the Truffle annotations used in the interpreter
classes
Truffle
Interpreter
javac
Annotation
processor
Compiled
Interpreter
Generated
Interpreter
source code
Overview of the Graal VM
• General architecture:
HotSpot VM (C++)
Graal (Java)
Truffle (Java) Java Other JVM language
JavaScript Ruby R
Other interpreted
language
Graal <–> Hotspot adapter (C++, Java)
Maxine VM (Java)
Graal <–> Maxine
adapter (Java)
Overview of the Graal VM
• Let’s see, for example, how a JavaScript interpreter
works in Graal …
Overview of the Graal VM
HotSpot VM (C++)
Graal (Java)
Truffle (Java) Java Other JVM language
JavaScript Ruby R
Other interpreted
language
Graal <–> Hotspot adapter (C++, Java)
Run JavaScript file: app.js
Overview of the Graal VM
HotSpot VM (C++)
Graal (Java)
Truffle (Java) Java Other JVM language
JavaScript Ruby R
Other interpreted
language
Graal <–> Hotspot adapter (C++, Java)
JavaScript Interpreter parses app.js and converts it to Truffle AST
Overview of the Graal VM
HotSpot VM (C++)
Graal (Java)
Truffle (Java) Java Other JVM language
JavaScript Ruby R
Other interpreted
language
Graal <–> Hotspot adapter (C++, Java)
The app.js Truffle AST is converted to Graal IR (AST)
Overview of the Graal VM
HotSpot VM (C++)
Graal (Java)
Truffle (Java) Java Other JVM language
JavaScript Ruby R
Other interpreted
language
Graal <–> Hotspot adapter (C++, Java)
The Graal VM has bytecode and AST interpreters along with a JIT compiler
(optimizations and AST lowering is performed to generate machine code
and perform partial evaluation)
Overview of the Graal VM
HotSpot VM (C++)
Graal (Java)
Truffle (Java) Java Other JVM language
JavaScript Ruby R
Other interpreted
language
Graal <–> Hotspot adapter (C++, Java)
When parts of app.js are compiled to machine code by the Graal compiler
the compiled code is transferred to Hotspot for execution by means of
Hotspot APIs and with the help of a Graal – Hotspot adapter interface
Overview of the Graal VM
HotSpot VM (C++)
Graal (Java)
Truffle (Java) Java Other JVM language
JavaScript Ruby R
Other interpreted
language
Graal <–> Hotspot adapter (C++, Java)
Compiled code can also be deoptimized and control is transferred back to
the interpreter (e.g. when an exception occurs, an assumption fails or a
guard is reached)
Overview of the Graal VM
• Optimizations done on the Graal IR include:
– method inlining
– partial escape analysis
– inline caching
– constant folding
– arithmetic optimizations and others …
Overview of the Graal VM
• Currently supported languages include:
– JavaScript (Graal.JS)
– R (FastR)
– Ruby (RubyTruffle)
– Experimental interpreters for C, Python, Smalltalk, LLVM
IR and others …
(some are not open-sourced as of the time of this presentation)
Overview of the Graal VM
• The SimpleLanguage project provides a showcase
on how to use the Truffle APIs
Source file Parser Truffle AST Graal VM
Building the Graal VM
Building the Graal VM
• The Graal VM interoperates with JEP 243: Java-
Level JVM Compiler Interface
• In that regard two modes of operation are
supported – via the Graal VM or via the JVMCI
(JVM Compiler Interface)
Building the Graal VM
• Early access builds of Graal available for download
• You can build Graal on any supported platform
(Windows, Linux, MacOS, Solaris) from source
code
Building the Graal VM
git clone https://github.com/graalvm/mx.git
export PATH=$PWD/mx:$PATH
git clone https://github.com/graalvm/graal-core.git
cd graal-core
mx --vm graal build
mx vm
Building the Graal VM
• The MX tool is a Python (2.7) tool that manages the
Graal projects and allows to:
- update sources and run JUnit tests and benchmarks;
- builds (sub)projects (Java and C++ sources can be built
separately);
- runs VM tools (such as IGV or c1visualizer) that can aid
development of Graal or language interpreters;
- can be used to generate IDE project files for Graal development
(support for Eclipse and NetBeans)
The Graal VM
demo
Performance benchmarks
Performance benchmarks
• According to various JVM benchmarks such as SPECjvm2008
and Scala Dacapo the Graal compiler positions between the
client and server JVM compilers
(source: One VM to Rule Them All, Thomas Wuertinger)
• In general Truffle interpreters provide much better
performance for some dynamic languages
Performance benchmarks
• Graal.JS – shows improvement of 1.5x in some cases
with a peak of 2.6x compared to V8 (running Google Octane’s
benchmark)
• RubyTruffle – shows improvements between 1.5x and 4.5x in some
cases with a peak of 14x compared to JRuby
• FastR - shows improvements between 2x and 39x in some cases
with a peak of 94x compared to GnuR
(source: One VM to Rule Them All, Thomas Wuertinger)
Future directions
Future directions
• Graal provides an extensible framework for
researching and experimenting with other
compiler optimizations
• In that regard new types of compiler optimization
may be introduced in the VM that address runtime
behavior in certain scenarios
Future directions
• Graal provides an extensible framework for
creating language interpreters further simplified by
the Truffle API
• In that regard more languages can be introduced
that run in the Graal VM
• Currently existing languages that compile to
bytecode may support Truffle in the future
Future directions
• Graal provides an extensible framework for
different types of operating systems and CPU
architectures
• In that regard CPU architectures and operating
systems might be supported by Graal
Thank you !
Q&A
References
Graal Project
http://openjdk.java.net/projects/graal/
Graal - A New Just In Time Compiler for the JVM
http://www.oracle.com/technetwork/oracle-labs/program-
languages/overview/index.html
Graal VM: GitHub repositories
https://github.com/graalvm
References
Graal - A Bytecode Agnostic Compiler for the JVM, Thomas Wuerthinger, JVM
Language Summit
http://medianetwork.oracle.com/video/player/1113230360001
Graal and Truffle: One VM to Rule Them All
http://www.slideshare.net/ThomasWuerthinger/graal-truffle-
ethdec2013?qid=848a4965-9768-40d5-b167-
ccd8eb7d1659&v=&b=&from_search=2
References
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for
Building a Multipurpose Runtime
http://www.slideshare.net/ThomasWuerthinger/2014-0424-graal-
modularity?qid=0e86ed21-0b8f-4087-9212-
68f76546d674&v=&b=&from_search=4
Dynamic Compilation - Thomas Wuerthinger
https://www.youtube.com/watch?v=RLsG2kE1EMI
https://www.youtube.com/watch?v=U_QpToYLsO0
JVMLS 2012: Graal
http://medianetwork.oracle.com/video/player/1785432492001
References
Graal Tutorial at CGO 2015 by Christian Wimmer
http://lafo.ssw.uni-linz.ac.at/papers/2015_CGO_Graal.pdf
Writing a language in Truffle: Part 1 - Using Truffle and Graal
https://cesquivias.github.io/blog/2014/10/13/writing-a-language-in-truffle-
part-1-a-simple-slow-interpreter/
Writing a language in Truffle: Part 2 - Using Truffle and Graal
http://cesquivias.github.io/blog/2014/12/02/writing-a-language-in-truffle-
part-2-using-truffle-and-graal/
References
Graal publications, JKU, Linz
http://ssw.jku.at/Research/Projects/JVM/Graal.html
Truffle publications, JKU, Linz
http://ssw.jku.at/Research/Projects/JVM/Truffle.html
References
R as a citizen in a Polyglot world: The promise of the Truffle framework
http://user2015.math.aau.dk/presentations/112.pdf
Truffle/C Interpreter
http://www.manuelrigger.at/downloads/trufflec_thesis.pdf
Graal.JS - high-performance JavaScript on the JVM talk by Christian Wirth
https://www.youtube.com/watch?v=OUo3BFMwQFo

More Related Content

What's hot

Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVMSylvain Wallez
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!Jakub Kubrynski
 
GraalVM: Run Programs Faster Everywhere
GraalVM: Run Programs Faster EverywhereGraalVM: Run Programs Faster Everywhere
GraalVM: Run Programs Faster EverywhereJ On The Beach
 
Coroutines in Kotlin
Coroutines in KotlinCoroutines in Kotlin
Coroutines in KotlinAlexey Soshin
 
Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introductionJonathan Holloway
 
Polygot Java EE on the GraalVM
Polygot Java EE on the GraalVMPolygot Java EE on the GraalVM
Polygot Java EE on the GraalVMRyan Cuprak
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation ToolIzzet Mustafaiev
 
Jetpack Compose - Android’s modern toolkit for building native UI
Jetpack Compose - Android’s modern toolkit for building native UIJetpack Compose - Android’s modern toolkit for building native UI
Jetpack Compose - Android’s modern toolkit for building native UIGilang Ramadhan
 
Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introductionRasheed Waraich
 
Graal and Truffle: One VM to Rule Them All
Graal and Truffle: One VM to Rule Them AllGraal and Truffle: One VM to Rule Them All
Graal and Truffle: One VM to Rule Them AllThomas Wuerthinger
 
Spring Boot & Actuators
Spring Boot & ActuatorsSpring Boot & Actuators
Spring Boot & ActuatorsVMware Tanzu
 
GraalVM Overview Compact version
GraalVM Overview Compact versionGraalVM Overview Compact version
GraalVM Overview Compact versionscalaconfjp
 

What's hot (20)

Spring Boot
Spring BootSpring Boot
Spring Boot
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!
 
GraalVM: Run Programs Faster Everywhere
GraalVM: Run Programs Faster EverywhereGraalVM: Run Programs Faster Everywhere
GraalVM: Run Programs Faster Everywhere
 
Coroutines in Kotlin
Coroutines in KotlinCoroutines in Kotlin
Coroutines in Kotlin
 
Gradle Introduction
Gradle IntroductionGradle Introduction
Gradle Introduction
 
Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introduction
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Gradle
GradleGradle
Gradle
 
Polygot Java EE on the GraalVM
Polygot Java EE on the GraalVMPolygot Java EE on the GraalVM
Polygot Java EE on the GraalVM
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation Tool
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
Jetpack Compose - Android’s modern toolkit for building native UI
Jetpack Compose - Android’s modern toolkit for building native UIJetpack Compose - Android’s modern toolkit for building native UI
Jetpack Compose - Android’s modern toolkit for building native UI
 
Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introduction
 
Introduction to gradle
Introduction to gradleIntroduction to gradle
Introduction to gradle
 
Graal and Truffle: One VM to Rule Them All
Graal and Truffle: One VM to Rule Them AllGraal and Truffle: One VM to Rule Them All
Graal and Truffle: One VM to Rule Them All
 
Quarkus k8s
Quarkus   k8sQuarkus   k8s
Quarkus k8s
 
Spring Boot & Actuators
Spring Boot & ActuatorsSpring Boot & Actuators
Spring Boot & Actuators
 
GraalVM Overview Compact version
GraalVM Overview Compact versionGraalVM Overview Compact version
GraalVM Overview Compact version
 
Spring Boot Tutorial
Spring Boot TutorialSpring Boot Tutorial
Spring Boot Tutorial
 

Viewers also liked

Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...Thomas Wuerthinger
 
Graal Tutorial at CGO 2015 by Christian Wimmer
Graal Tutorial at CGO 2015 by Christian WimmerGraal Tutorial at CGO 2015 by Christian Wimmer
Graal Tutorial at CGO 2015 by Christian WimmerThomas Wuerthinger
 
Graal VM: Multi-Language Execution Platform
Graal VM: Multi-Language Execution PlatformGraal VM: Multi-Language Execution Platform
Graal VM: Multi-Language Execution PlatformThomas Wuerthinger
 
Scalable SAAS Meetup - Oct 6th
Scalable SAAS Meetup - Oct 6thScalable SAAS Meetup - Oct 6th
Scalable SAAS Meetup - Oct 6thmdilawari
 
Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)Martin Toshev
 
Security Аrchitecture of Тhe Java Platform
Security Аrchitecture of Тhe Java PlatformSecurity Аrchitecture of Тhe Java Platform
Security Аrchitecture of Тhe Java PlatformMartin Toshev
 
Writing Stored Procedures with Oracle Database 12c
Writing Stored Procedures with Oracle Database 12cWriting Stored Procedures with Oracle Database 12c
Writing Stored Procedures with Oracle Database 12cMartin Toshev
 
2016 JavaOne Deconstructing REST Security
2016 JavaOne Deconstructing REST Security2016 JavaOne Deconstructing REST Security
2016 JavaOne Deconstructing REST SecurityDavid Blevins
 
Writing Stored Procedures in Oracle RDBMS
Writing Stored Procedures in Oracle RDBMSWriting Stored Procedures in Oracle RDBMS
Writing Stored Procedures in Oracle RDBMSMartin Toshev
 
Writing Java Stored Procedures in Oracle 12c
Writing Java Stored Procedures in Oracle 12cWriting Java Stored Procedures in Oracle 12c
Writing Java Stored Procedures in Oracle 12cMartin Toshev
 
RxJS vs RxJava: Intro
RxJS vs RxJava: IntroRxJS vs RxJava: Intro
RxJS vs RxJava: IntroMartin Toshev
 
KDB database (EPAM tech talks, Sofia, April, 2015)
KDB database (EPAM tech talks, Sofia, April, 2015)KDB database (EPAM tech talks, Sofia, April, 2015)
KDB database (EPAM tech talks, Sofia, April, 2015)Martin Toshev
 
Gábor Horváth - Code Generation in Serializers and Comparators of Apache Flink
Gábor Horváth - Code Generation in Serializers and Comparators of Apache FlinkGábor Horváth - Code Generation in Serializers and Comparators of Apache Flink
Gábor Horváth - Code Generation in Serializers and Comparators of Apache FlinkFlink Forward
 
Security Architecture of the Java platform
Security Architecture of the Java platformSecurity Architecture of the Java platform
Security Architecture of the Java platformMartin Toshev
 
Eclipse plug in development
Eclipse plug in developmentEclipse plug in development
Eclipse plug in developmentMartin Toshev
 
Security Architecture of the Java Platform (BG OUG, Plovdiv, 13.06.2015)
Security Architecture of the Java Platform (BG OUG, Plovdiv, 13.06.2015)Security Architecture of the Java Platform (BG OUG, Plovdiv, 13.06.2015)
Security Architecture of the Java Platform (BG OUG, Plovdiv, 13.06.2015)Martin Toshev
 
The HaLVM: A Simple Platform for Simple Platforms
The HaLVM: A Simple Platform for Simple PlatformsThe HaLVM: A Simple Platform for Simple Platforms
The HaLVM: A Simple Platform for Simple PlatformsThe Linux Foundation
 
Service Discovery and Registration in a Microservices Architecture
Service Discovery and Registration in a Microservices ArchitectureService Discovery and Registration in a Microservices Architecture
Service Discovery and Registration in a Microservices ArchitecturePLUMgrid
 

Viewers also liked (20)

Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...
 
Graal Tutorial at CGO 2015 by Christian Wimmer
Graal Tutorial at CGO 2015 by Christian WimmerGraal Tutorial at CGO 2015 by Christian Wimmer
Graal Tutorial at CGO 2015 by Christian Wimmer
 
Graal VM: Multi-Language Execution Platform
Graal VM: Multi-Language Execution PlatformGraal VM: Multi-Language Execution Platform
Graal VM: Multi-Language Execution Platform
 
Scalable SAAS Meetup - Oct 6th
Scalable SAAS Meetup - Oct 6thScalable SAAS Meetup - Oct 6th
Scalable SAAS Meetup - Oct 6th
 
Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)
 
Security Аrchitecture of Тhe Java Platform
Security Аrchitecture of Тhe Java PlatformSecurity Аrchitecture of Тhe Java Platform
Security Аrchitecture of Тhe Java Platform
 
Writing Stored Procedures with Oracle Database 12c
Writing Stored Procedures with Oracle Database 12cWriting Stored Procedures with Oracle Database 12c
Writing Stored Procedures with Oracle Database 12c
 
2016 JavaOne Deconstructing REST Security
2016 JavaOne Deconstructing REST Security2016 JavaOne Deconstructing REST Security
2016 JavaOne Deconstructing REST Security
 
Writing Stored Procedures in Oracle RDBMS
Writing Stored Procedures in Oracle RDBMSWriting Stored Procedures in Oracle RDBMS
Writing Stored Procedures in Oracle RDBMS
 
Writing Java Stored Procedures in Oracle 12c
Writing Java Stored Procedures in Oracle 12cWriting Java Stored Procedures in Oracle 12c
Writing Java Stored Procedures in Oracle 12c
 
Modular Java
Modular JavaModular Java
Modular Java
 
RxJS vs RxJava: Intro
RxJS vs RxJava: IntroRxJS vs RxJava: Intro
RxJS vs RxJava: Intro
 
Spring RabbitMQ
Spring RabbitMQSpring RabbitMQ
Spring RabbitMQ
 
KDB database (EPAM tech talks, Sofia, April, 2015)
KDB database (EPAM tech talks, Sofia, April, 2015)KDB database (EPAM tech talks, Sofia, April, 2015)
KDB database (EPAM tech talks, Sofia, April, 2015)
 
Gábor Horváth - Code Generation in Serializers and Comparators of Apache Flink
Gábor Horváth - Code Generation in Serializers and Comparators of Apache FlinkGábor Horváth - Code Generation in Serializers and Comparators of Apache Flink
Gábor Horváth - Code Generation in Serializers and Comparators of Apache Flink
 
Security Architecture of the Java platform
Security Architecture of the Java platformSecurity Architecture of the Java platform
Security Architecture of the Java platform
 
Eclipse plug in development
Eclipse plug in developmentEclipse plug in development
Eclipse plug in development
 
Security Architecture of the Java Platform (BG OUG, Plovdiv, 13.06.2015)
Security Architecture of the Java Platform (BG OUG, Plovdiv, 13.06.2015)Security Architecture of the Java Platform (BG OUG, Plovdiv, 13.06.2015)
Security Architecture of the Java Platform (BG OUG, Plovdiv, 13.06.2015)
 
The HaLVM: A Simple Platform for Simple Platforms
The HaLVM: A Simple Platform for Simple PlatformsThe HaLVM: A Simple Platform for Simple Platforms
The HaLVM: A Simple Platform for Simple Platforms
 
Service Discovery and Registration in a Microservices Architecture
Service Discovery and Registration in a Microservices ArchitectureService Discovery and Registration in a Microservices Architecture
Service Discovery and Registration in a Microservices Architecture
 

Similar to JVM++: The Graal VM

GraalVM - JBCNConf 2019-05-28
GraalVM - JBCNConf 2019-05-28GraalVM - JBCNConf 2019-05-28
GraalVM - JBCNConf 2019-05-28Jorge Hidalgo
 
TechEvent Graal(VM) Performance Interoperability
TechEvent Graal(VM) Performance InteroperabilityTechEvent Graal(VM) Performance Interoperability
TechEvent Graal(VM) Performance InteroperabilityTrivadis
 
GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22Jorge Hidalgo
 
GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18Jorge Hidalgo
 
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVMHOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVMOwais Zahid
 
Enabling Java: Windows on Arm64 - A Success Story!
Enabling Java: Windows on Arm64 - A Success Story!Enabling Java: Windows on Arm64 - A Success Story!
Enabling Java: Windows on Arm64 - A Success Story!Monica Beckwith
 
PL-4042, Wholly Graal: Accelerating GPU offload for Java/Sumatra using the Op...
PL-4042, Wholly Graal: Accelerating GPU offload for Java/Sumatra using the Op...PL-4042, Wholly Graal: Accelerating GPU offload for Java/Sumatra using the Op...
PL-4042, Wholly Graal: Accelerating GPU offload for Java/Sumatra using the Op...AMD Developer Central
 
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps WayDevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Waysmalltown
 
A tour of Java and the JVM
A tour of Java and the JVMA tour of Java and the JVM
A tour of Java and the JVMAlex Birch
 
Java 40 versions_sgp
Java 40 versions_sgpJava 40 versions_sgp
Java 40 versions_sgpmichaelisvy
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And BeyondVMware Tanzu
 
Python Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on FlinkPython Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on FlinkAljoscha Krettek
 
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...Flink Forward
 
Java script anywhere. What Nombas was doing pre-acquisition.
Java script anywhere. What Nombas was doing pre-acquisition.Java script anywhere. What Nombas was doing pre-acquisition.
Java script anywhere. What Nombas was doing pre-acquisition.Brent Noorda
 
Java ScriptingJava Scripting: One VM, Many Languages
Java ScriptingJava Scripting: One VM, Many LanguagesJava ScriptingJava Scripting: One VM, Many Languages
Java ScriptingJava Scripting: One VM, Many Languageselliando dias
 
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5David Voyles
 

Similar to JVM++: The Graal VM (20)

Javantura v4 - JVM++ The GraalVM - Martin Toshev
Javantura v4 - JVM++ The GraalVM - Martin ToshevJavantura v4 - JVM++ The GraalVM - Martin Toshev
Javantura v4 - JVM++ The GraalVM - Martin Toshev
 
GraalVM - JBCNConf 2019-05-28
GraalVM - JBCNConf 2019-05-28GraalVM - JBCNConf 2019-05-28
GraalVM - JBCNConf 2019-05-28
 
TechEvent Graal(VM) Performance Interoperability
TechEvent Graal(VM) Performance InteroperabilityTechEvent Graal(VM) Performance Interoperability
TechEvent Graal(VM) Performance Interoperability
 
GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22
 
GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18
 
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVMHOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
 
Enabling Java: Windows on Arm64 - A Success Story!
Enabling Java: Windows on Arm64 - A Success Story!Enabling Java: Windows on Arm64 - A Success Story!
Enabling Java: Windows on Arm64 - A Success Story!
 
PL-4042, Wholly Graal: Accelerating GPU offload for Java/Sumatra using the Op...
PL-4042, Wholly Graal: Accelerating GPU offload for Java/Sumatra using the Op...PL-4042, Wholly Graal: Accelerating GPU offload for Java/Sumatra using the Op...
PL-4042, Wholly Graal: Accelerating GPU offload for Java/Sumatra using the Op...
 
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps WayDevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
 
A tour of Java and the JVM
A tour of Java and the JVMA tour of Java and the JVM
A tour of Java and the JVM
 
Java 40 versions_sgp
Java 40 versions_sgpJava 40 versions_sgp
Java 40 versions_sgp
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And Beyond
 
Python Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on FlinkPython Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on Flink
 
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
 
Java1 in mumbai
Java1 in mumbaiJava1 in mumbai
Java1 in mumbai
 
Java script anywhere. What Nombas was doing pre-acquisition.
Java script anywhere. What Nombas was doing pre-acquisition.Java script anywhere. What Nombas was doing pre-acquisition.
Java script anywhere. What Nombas was doing pre-acquisition.
 
Java ScriptingJava Scripting: One VM, Many Languages
Java ScriptingJava Scripting: One VM, Many LanguagesJava ScriptingJava Scripting: One VM, Many Languages
Java ScriptingJava Scripting: One VM, Many Languages
 
Asm.js introduction
Asm.js introductionAsm.js introduction
Asm.js introduction
 
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
 
java intro.pptx
java intro.pptxjava intro.pptx
java intro.pptx
 

More from Martin Toshev

Building highly scalable data pipelines with Apache Spark
Building highly scalable data pipelines with Apache SparkBuilding highly scalable data pipelines with Apache Spark
Building highly scalable data pipelines with Apache SparkMartin Toshev
 
Big data processing with Apache Spark and Oracle Database
Big data processing with Apache Spark and Oracle DatabaseBig data processing with Apache Spark and Oracle Database
Big data processing with Apache Spark and Oracle DatabaseMartin Toshev
 
Semantic Technology In Oracle Database 12c
Semantic Technology In Oracle Database 12cSemantic Technology In Oracle Database 12c
Semantic Technology In Oracle Database 12cMartin Toshev
 
Practical security In a modular world
Practical security In a modular worldPractical security In a modular world
Practical security In a modular worldMartin Toshev
 
Java 9 Security Enhancements in Practice
Java 9 Security Enhancements in PracticeJava 9 Security Enhancements in Practice
Java 9 Security Enhancements in PracticeMartin Toshev
 
Oracle Database 12c Attack Vectors
Oracle Database 12c Attack VectorsOracle Database 12c Attack Vectors
Oracle Database 12c Attack VectorsMartin Toshev
 
Concurrency Utilities in Java 8
Concurrency Utilities in Java 8Concurrency Utilities in Java 8
Concurrency Utilities in Java 8Martin Toshev
 
The RabbitMQ Message Broker
The RabbitMQ Message BrokerThe RabbitMQ Message Broker
The RabbitMQ Message BrokerMartin Toshev
 
java2days 2014: Attacking JavaEE Application Servers
java2days 2014: Attacking JavaEE Application Serversjava2days 2014: Attacking JavaEE Application Servers
java2days 2014: Attacking JavaEE Application ServersMartin Toshev
 
Security Architecture of the Java Platform (http://www.javaday.bg event - 14....
Security Architecture of the Java Platform (http://www.javaday.bg event - 14....Security Architecture of the Java Platform (http://www.javaday.bg event - 14....
Security Architecture of the Java Platform (http://www.javaday.bg event - 14....Martin Toshev
 
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)Martin Toshev
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8Martin Toshev
 

More from Martin Toshev (15)

Building highly scalable data pipelines with Apache Spark
Building highly scalable data pipelines with Apache SparkBuilding highly scalable data pipelines with Apache Spark
Building highly scalable data pipelines with Apache Spark
 
Big data processing with Apache Spark and Oracle Database
Big data processing with Apache Spark and Oracle DatabaseBig data processing with Apache Spark and Oracle Database
Big data processing with Apache Spark and Oracle Database
 
Jdk 10 sneak peek
Jdk 10 sneak peekJdk 10 sneak peek
Jdk 10 sneak peek
 
Semantic Technology In Oracle Database 12c
Semantic Technology In Oracle Database 12cSemantic Technology In Oracle Database 12c
Semantic Technology In Oracle Database 12c
 
Practical security In a modular world
Practical security In a modular worldPractical security In a modular world
Practical security In a modular world
 
Java 9 Security Enhancements in Practice
Java 9 Security Enhancements in PracticeJava 9 Security Enhancements in Practice
Java 9 Security Enhancements in Practice
 
Java 9 sneak peek
Java 9 sneak peekJava 9 sneak peek
Java 9 sneak peek
 
Spring RabbitMQ
Spring RabbitMQSpring RabbitMQ
Spring RabbitMQ
 
Oracle Database 12c Attack Vectors
Oracle Database 12c Attack VectorsOracle Database 12c Attack Vectors
Oracle Database 12c Attack Vectors
 
Concurrency Utilities in Java 8
Concurrency Utilities in Java 8Concurrency Utilities in Java 8
Concurrency Utilities in Java 8
 
The RabbitMQ Message Broker
The RabbitMQ Message BrokerThe RabbitMQ Message Broker
The RabbitMQ Message Broker
 
java2days 2014: Attacking JavaEE Application Servers
java2days 2014: Attacking JavaEE Application Serversjava2days 2014: Attacking JavaEE Application Servers
java2days 2014: Attacking JavaEE Application Servers
 
Security Architecture of the Java Platform (http://www.javaday.bg event - 14....
Security Architecture of the Java Platform (http://www.javaday.bg event - 14....Security Architecture of the Java Platform (http://www.javaday.bg event - 14....
Security Architecture of the Java Platform (http://www.javaday.bg event - 14....
 
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8
 

Recently uploaded

Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 

Recently uploaded (20)

Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 

JVM++: The Graal VM

  • 1. JVM++: The Graal VM Martin Toshev, BGOUG, 04.06.2016
  • 2. Special thanks to Thomas Wuerthinger and Oracle Labs for inspiring this presentation …
  • 3. Who am I Software consultant (CoffeeCupConsulting) BG JUG board member (http://jug.bg) OpenJDK and Oracle RDBMS enthusiast
  • 4. Who am I Author of Learning RabbitMQ
  • 5. Agenda • Overview of the Graal VM • Building and managing Graal • Performance benchmarks • Future directions
  • 6. Overview of the Graal VM
  • 7. Overview of the Graal VM Some background … static compilation vs dynamic compilation static compiler source code (e.g. JVM bytecode) dynamic compiler runtime machine code runtime source code (e.g. JVM bytecode) machine code
  • 8. Overview of the Graal VM • The javac tool performs static compilation of Java sources to bytecode • The JVM may perform dynamic compilation of bytecode to machine code for optimization using a JIT (Just-in-Time) compiler
  • 9. Overview of the Graal VM • Graal is a new JIT (Just-in-Time) compiler for the JVM • Brings the performance of Java to scripting languages (via the Truffle API) • written in Java
  • 10. Overview of the Graal VM • In essence the Graal JIT compiler generates machine code from an optimized AST rather than bytecode • However the Graal VM has both AST and bytecode interpreters
  • 11. Overview of the Graal VM • The Graal VM supports the following types of compilers (apart from the Graal JIT compiler): --vm server-nograal // server compiler --vm server // server compiler using Graal --vm graal // Graal compiler using Graal --vm client-nograal // client compiler --vm client // client compiler running Graal
  • 12. Overview of the Graal VM • The Truffle API: – is a Java API – provides AST (Abstract Syntax Tree) representation of source code – provides a mechanism to convert the generated AST into a Graal IR (intermediate representation)
  • 13. Overview of the Graal VM • The Truffle API is declarative (uses Java annotations) • The AST graph generated by Truffle is a mixture of control flow and data flow graph • Essential feature of the Truffle API is the ability to specify node specializations used in node rewriting
  • 14. Overview of the Graal VM • The Truffle API is used in conjunction with custom annotation processor that generates code based on the Truffle annotations used in the interpreter classes Truffle Interpreter javac Annotation processor Compiled Interpreter Generated Interpreter source code
  • 15. Overview of the Graal VM • General architecture: HotSpot VM (C++) Graal (Java) Truffle (Java) Java Other JVM language JavaScript Ruby R Other interpreted language Graal <–> Hotspot adapter (C++, Java) Maxine VM (Java) Graal <–> Maxine adapter (Java)
  • 16. Overview of the Graal VM • Let’s see, for example, how a JavaScript interpreter works in Graal …
  • 17. Overview of the Graal VM HotSpot VM (C++) Graal (Java) Truffle (Java) Java Other JVM language JavaScript Ruby R Other interpreted language Graal <–> Hotspot adapter (C++, Java) Run JavaScript file: app.js
  • 18. Overview of the Graal VM HotSpot VM (C++) Graal (Java) Truffle (Java) Java Other JVM language JavaScript Ruby R Other interpreted language Graal <–> Hotspot adapter (C++, Java) JavaScript Interpreter parses app.js and converts it to Truffle AST
  • 19. Overview of the Graal VM HotSpot VM (C++) Graal (Java) Truffle (Java) Java Other JVM language JavaScript Ruby R Other interpreted language Graal <–> Hotspot adapter (C++, Java) The app.js Truffle AST is converted to Graal IR (AST)
  • 20. Overview of the Graal VM HotSpot VM (C++) Graal (Java) Truffle (Java) Java Other JVM language JavaScript Ruby R Other interpreted language Graal <–> Hotspot adapter (C++, Java) The Graal VM has bytecode and AST interpreters along with a JIT compiler (optimizations and AST lowering is performed to generate machine code and perform partial evaluation)
  • 21. Overview of the Graal VM HotSpot VM (C++) Graal (Java) Truffle (Java) Java Other JVM language JavaScript Ruby R Other interpreted language Graal <–> Hotspot adapter (C++, Java) When parts of app.js are compiled to machine code by the Graal compiler the compiled code is transferred to Hotspot for execution by means of Hotspot APIs and with the help of a Graal – Hotspot adapter interface
  • 22. Overview of the Graal VM HotSpot VM (C++) Graal (Java) Truffle (Java) Java Other JVM language JavaScript Ruby R Other interpreted language Graal <–> Hotspot adapter (C++, Java) Compiled code can also be deoptimized and control is transferred back to the interpreter (e.g. when an exception occurs, an assumption fails or a guard is reached)
  • 23. Overview of the Graal VM • Optimizations done on the Graal IR include: – method inlining – partial escape analysis – inline caching – constant folding – arithmetic optimizations and others …
  • 24. Overview of the Graal VM • Currently supported languages include: – JavaScript (Graal.JS) – R (FastR) – Ruby (RubyTruffle) – Experimental interpreters for C, Python, Smalltalk, LLVM IR and others … (some are not open-sourced as of the time of this presentation)
  • 25. Overview of the Graal VM • The SimpleLanguage project provides a showcase on how to use the Truffle APIs Source file Parser Truffle AST Graal VM
  • 27. Building the Graal VM • The Graal VM interoperates with JEP 243: Java- Level JVM Compiler Interface • In that regard two modes of operation are supported – via the Graal VM or via the JVMCI (JVM Compiler Interface)
  • 28. Building the Graal VM • Early access builds of Graal available for download • You can build Graal on any supported platform (Windows, Linux, MacOS, Solaris) from source code
  • 29. Building the Graal VM git clone https://github.com/graalvm/mx.git export PATH=$PWD/mx:$PATH git clone https://github.com/graalvm/graal-core.git cd graal-core mx --vm graal build mx vm
  • 30. Building the Graal VM • The MX tool is a Python (2.7) tool that manages the Graal projects and allows to: - update sources and run JUnit tests and benchmarks; - builds (sub)projects (Java and C++ sources can be built separately); - runs VM tools (such as IGV or c1visualizer) that can aid development of Graal or language interpreters; - can be used to generate IDE project files for Graal development (support for Eclipse and NetBeans)
  • 33. Performance benchmarks • According to various JVM benchmarks such as SPECjvm2008 and Scala Dacapo the Graal compiler positions between the client and server JVM compilers (source: One VM to Rule Them All, Thomas Wuertinger) • In general Truffle interpreters provide much better performance for some dynamic languages
  • 34. Performance benchmarks • Graal.JS – shows improvement of 1.5x in some cases with a peak of 2.6x compared to V8 (running Google Octane’s benchmark) • RubyTruffle – shows improvements between 1.5x and 4.5x in some cases with a peak of 14x compared to JRuby • FastR - shows improvements between 2x and 39x in some cases with a peak of 94x compared to GnuR (source: One VM to Rule Them All, Thomas Wuertinger)
  • 36. Future directions • Graal provides an extensible framework for researching and experimenting with other compiler optimizations • In that regard new types of compiler optimization may be introduced in the VM that address runtime behavior in certain scenarios
  • 37. Future directions • Graal provides an extensible framework for creating language interpreters further simplified by the Truffle API • In that regard more languages can be introduced that run in the Graal VM • Currently existing languages that compile to bytecode may support Truffle in the future
  • 38. Future directions • Graal provides an extensible framework for different types of operating systems and CPU architectures • In that regard CPU architectures and operating systems might be supported by Graal
  • 40. References Graal Project http://openjdk.java.net/projects/graal/ Graal - A New Just In Time Compiler for the JVM http://www.oracle.com/technetwork/oracle-labs/program- languages/overview/index.html Graal VM: GitHub repositories https://github.com/graalvm
  • 41. References Graal - A Bytecode Agnostic Compiler for the JVM, Thomas Wuerthinger, JVM Language Summit http://medianetwork.oracle.com/video/player/1113230360001 Graal and Truffle: One VM to Rule Them All http://www.slideshare.net/ThomasWuerthinger/graal-truffle- ethdec2013?qid=848a4965-9768-40d5-b167- ccd8eb7d1659&v=&b=&from_search=2
  • 42. References Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for Building a Multipurpose Runtime http://www.slideshare.net/ThomasWuerthinger/2014-0424-graal- modularity?qid=0e86ed21-0b8f-4087-9212- 68f76546d674&v=&b=&from_search=4 Dynamic Compilation - Thomas Wuerthinger https://www.youtube.com/watch?v=RLsG2kE1EMI https://www.youtube.com/watch?v=U_QpToYLsO0 JVMLS 2012: Graal http://medianetwork.oracle.com/video/player/1785432492001
  • 43. References Graal Tutorial at CGO 2015 by Christian Wimmer http://lafo.ssw.uni-linz.ac.at/papers/2015_CGO_Graal.pdf Writing a language in Truffle: Part 1 - Using Truffle and Graal https://cesquivias.github.io/blog/2014/10/13/writing-a-language-in-truffle- part-1-a-simple-slow-interpreter/ Writing a language in Truffle: Part 2 - Using Truffle and Graal http://cesquivias.github.io/blog/2014/12/02/writing-a-language-in-truffle- part-2-using-truffle-and-graal/
  • 44. References Graal publications, JKU, Linz http://ssw.jku.at/Research/Projects/JVM/Graal.html Truffle publications, JKU, Linz http://ssw.jku.at/Research/Projects/JVM/Truffle.html
  • 45. References R as a citizen in a Polyglot world: The promise of the Truffle framework http://user2015.math.aau.dk/presentations/112.pdf Truffle/C Interpreter http://www.manuelrigger.at/downloads/trufflec_thesis.pdf Graal.JS - high-performance JavaScript on the JVM talk by Christian Wirth https://www.youtube.com/watch?v=OUo3BFMwQFo

Editor's Notes

  1. The JVM may also perform deoptimization.
  2. This essentially means the Graal VM can run in client/server mode but also use the Graal JIT compiler in certain scenarios
  3. Truffle can be used for static analysis as well
  4. Truffle can be used for static analysis as well
  5. Without Graal you will be need to write a bytecode compiler.
  6. There are high level optimization on the AST and low level optimization (after the AST is lowered).
  7. In inline caching the callee is cached at the call site instead of a dynamic callee method lookup. -
  8. Some of the languages are not open-sourced as of the time of this presentation (such as GraalJS). Interpreter executables are provided in the official distribution under <GraalVM>/bin/ (e.g. <GraalVM>/bin/js for GraalJS)
  9. Up to JDK 9 Graal had to use a modified version of Hotspot. With JDK9 the JVMCI enables the deployment of Graal on top of an existing JVM without further modifications (using JVMCI).