SlideShare a Scribd company logo
Run * on the JVM
Interpreters on the JVM with
Graal and Truffle
Balazs Varga / @vbalazs
Agenda
● Compiled, interpreted applications and VMs
● Interpreters under the hood
● Interpreter on the JVM
○ Existing solutions
○ Future
● Summary
Compiled, interpreted applications
Operating system
Libraries
Compiler
Operating system
Libraries
Executable
Machine Code
C source code
Operating system
Libraries
InterpreterRuby source code
(1.8) GC Libraries
compiled C source code
(executable machine code)
Libraries
GC: Garbage Collector
Virtual Machines (runtimes)
Operating system
Libraries
Java compiler
Operating system
Libraries
Executable
JVM bytecode
Java source code
Libraries
JVM
bytecode
Java Runtime Env.
GC Libraries
Interpreters under the hood
1. Tokenize
2. Parse
3. AST
Ruby Tokens
Abstract Syntax Tree
nodes
C
Machine
Language
interpret
Abstract Syntax Tree
function sum(n) {
var sum = 0;
for (var i = 1; i < n; i++) {
sum += i;
}
return sum;
}
source: T. Würthinger, C. Wimmer, A. Wöß, L. Stadler, G.
Duboscq, C. Humer, G. Richards, D. Simon, M. Wolczko:
One VM to Rule Them All. In Proceedings of Onward!, ACM
Press, 2013.
Interpreter on the JVM
Ruby source code compiled to Java bytecode
Operating system
Libraries
JRuby interpreter
Java Runtime Env.
GC Libraries
Why?
Existing solutions
The future is here: Truffle and Graal
Goal: Native support for interpreters
Requirements:
● simplicity
● generality
● performance
System structure
source: Christian Wimmer and Chris Seaton speak at the JVM Language Summit, July 31, 2013.
Ruby
Javascript Python
R ...
Your language here
TruffleGraal
Language agnostic
dynamic compiler Common API between
language implementation
and optimization system
Substrate VM
Graal VM
Truffle
● Java framework for writing AST interpreters
● node specialization with tree rewriting
● define compiler optimizations, directives
○ assumptions
Graal
● 100% Java-based JIT framework
○ JIT: Just In Time (compiler)
● dynamic compiler
● directly control code generation
● graph intermediate representation
Node rewrite - optimization
source: T. Würthinger, C. Wimmer, A. Wöß, L. Stadler, G. Duboscq, C. Humer, G. Richards, D. Simon,
M. Wolczko: One VM to Rule Them All. In Proceedings of Onward!, ACM Press, 2013.
Node rewrite - de- and reoptimization
source: T. Würthinger, C. Wimmer, A. Wöß, L. Stadler, G. Duboscq, C. Humer, G. Richards, D. Simon,
M. Wolczko: One VM to Rule Them All. In Proceedings of Onward!, ACM Press, 2013.
Bonus
“Write your own language!”
Before Truffle:
● write a parser and an AST interpreter
● create a runtime system (C/C++), GC
● performance problems: bytecode, JIT, improve GC
● ...???
Easy?
Summary
● Truffle, Graal (~ Java 9)
○ “easy” to use AST interpreter framework
○ high performance (compiled to machine code!)
● Bonus: “Write your own language!”
● Contribute!
○ meetup.com: budapest.rb, budapest.js, …
○ https://github.com/jruby/jruby
○ http://openjdk.java.net/
Questions?

More Related Content

What's hot (20)

PDF
Give me 15 minutes and i'll change your view of gdb
gregthelaw
 
PDF
Be a Zen monk, the Python way
Sriram Murali
 
PDF
[COSCUP 2018] uTensor C++ Code Generator
Yin-Chen Liao
 
KEY
AMD SVMってなあに
Takuya ASADA
 
PDF
memcached Binary Protocol in a Nutshell
Toru Maesaka
 
PPTX
Advanced Debugging with GDB
David Khosid
 
PDF
How to make the Fastest C# Serializer, In the case of ZeroFormatter
Yoshifumi Kawai
 
PDF
An evaluation of LLVM compiler for SVE with fairly complicated loops
Linaro
 
PPTX
Seminar on Parallel and Concurrent Programming
Stefan Marr
 
PDF
Make the prompt great again
jtyr
 
PDF
Guile 3: Faster programs via just-in-time compilation (FOSDEM 2019)
Igalia
 
PPTX
Traitement temps réel chez Streamroot - Golang Paris Juin 2016
Simon Caplette
 
PDF
Amethyst: Past, Present, Future
Eyal Kalderon
 
PDF
Detecting Deadlock, Double-Free and Other Abuses in a Million Lines of Linux ...
Peter Breuer
 
PPT
Introduction to gdb
Owen Hsu
 
ODP
Gc algorithms
Michał Warecki
 
PDF
Rust system programming language
robin_sy
 
PDF
Gdb tutorial-handout
Suraj Kumar
 
PPT
Rust Programming Language
Jaeju Kim
 
PPT
Intro2 Cuda Moayad
Moayadhn
 
Give me 15 minutes and i'll change your view of gdb
gregthelaw
 
Be a Zen monk, the Python way
Sriram Murali
 
[COSCUP 2018] uTensor C++ Code Generator
Yin-Chen Liao
 
AMD SVMってなあに
Takuya ASADA
 
memcached Binary Protocol in a Nutshell
Toru Maesaka
 
Advanced Debugging with GDB
David Khosid
 
How to make the Fastest C# Serializer, In the case of ZeroFormatter
Yoshifumi Kawai
 
An evaluation of LLVM compiler for SVE with fairly complicated loops
Linaro
 
Seminar on Parallel and Concurrent Programming
Stefan Marr
 
Make the prompt great again
jtyr
 
Guile 3: Faster programs via just-in-time compilation (FOSDEM 2019)
Igalia
 
Traitement temps réel chez Streamroot - Golang Paris Juin 2016
Simon Caplette
 
Amethyst: Past, Present, Future
Eyal Kalderon
 
Detecting Deadlock, Double-Free and Other Abuses in a Million Lines of Linux ...
Peter Breuer
 
Introduction to gdb
Owen Hsu
 
Gc algorithms
Michał Warecki
 
Rust system programming language
robin_sy
 
Gdb tutorial-handout
Suraj Kumar
 
Rust Programming Language
Jaeju Kim
 
Intro2 Cuda Moayad
Moayadhn
 

Similar to Run * on the JVM - Simonyi Conference Budapest April 15 (20)

PDF
Javantura v4 - JVM++ The GraalVM - Martin Toshev
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
PDF
Wasm intro
Elifarley Cruz
 
PPTX
JVM++: The Graal VM
Martin Toshev
 
PDF
The Rust Programming Language
Mario Alexandro Santini
 
PDF
TypeScript: Angular's Secret Weapon
Laurent Duveau
 
PDF
TypeScript: Angular's Secret Weapon
Laurent Duveau
 
PPTX
Introduction to .net FrameWork by QuontraSolutions
Quontra Solutions
 
PPSX
Compilers
Jayanga V. Liyanage
 
PPT
10 Sep08 2003ver
Kumton Suttiraksiri
 
PPTX
Introduction to .NET by QuontraSolutions
QUONTRASOLUTIONS
 
PPTX
Server Side Web Development Unit 1 of Nodejs.pptx
sneha852132
 
PPTX
Java Basic PART I
Soumen Santra
 
PPT
Data structure and algorithm.lect-03.ppt
KamranAli649587
 
PPT
Web Development Environments: Choose the best or go with the rest
george.james
 
PPTX
EclipseOMRBuildingBlocks4Polyglot_TURBO18
Xiaoli Liang
 
PDF
Core Java
Prakash Dimmita
 
PPTX
Compiler Construction
Ahmed Raza
 
PPTX
Enabling Java: Windows on Arm64 - A Success Story!
Monica Beckwith
 
PPT
Introduction to java new
Gursimranjot singh dhiman
 
PPT
Introduction to java new
Gursimranjot singh dhiman
 
Javantura v4 - JVM++ The GraalVM - Martin Toshev
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
Wasm intro
Elifarley Cruz
 
JVM++: The Graal VM
Martin Toshev
 
The Rust Programming Language
Mario Alexandro Santini
 
TypeScript: Angular's Secret Weapon
Laurent Duveau
 
TypeScript: Angular's Secret Weapon
Laurent Duveau
 
Introduction to .net FrameWork by QuontraSolutions
Quontra Solutions
 
10 Sep08 2003ver
Kumton Suttiraksiri
 
Introduction to .NET by QuontraSolutions
QUONTRASOLUTIONS
 
Server Side Web Development Unit 1 of Nodejs.pptx
sneha852132
 
Java Basic PART I
Soumen Santra
 
Data structure and algorithm.lect-03.ppt
KamranAli649587
 
Web Development Environments: Choose the best or go with the rest
george.james
 
EclipseOMRBuildingBlocks4Polyglot_TURBO18
Xiaoli Liang
 
Core Java
Prakash Dimmita
 
Compiler Construction
Ahmed Raza
 
Enabling Java: Windows on Arm64 - A Success Story!
Monica Beckwith
 
Introduction to java new
Gursimranjot singh dhiman
 
Introduction to java new
Gursimranjot singh dhiman
 
Ad

Recently uploaded (20)

PDF
MOBILE AND WEB BASED REMOTE BUSINESS MONITORING SYSTEM
ijait
 
PPT
IISM Presentation.ppt Construction safety
lovingrkn
 
PPTX
Fluid statistics and Numerical on pascal law
Ravindra Kolhe
 
PPTX
Basics of Auto Computer Aided Drafting .pptx
Krunal Thanki
 
PDF
th International conference on Big Data, Machine learning and Applications (B...
Zac Darcy
 
PDF
A NEW FAMILY OF OPTICALLY CONTROLLED LOGIC GATES USING NAPHTHOPYRAN MOLECULE
ijoejnl
 
PPTX
Sensor IC System Design Using COMSOL Multiphysics 2025-July.pptx
James D.B. Wang, PhD
 
PDF
Jual GPS Geodetik CHCNAV i93 IMU-RTK Lanjutan dengan Survei Visual
Budi Minds
 
PDF
BEE331-Week 04-SU25.pdf semiconductors UW
faemoxley
 
PDF
PRIZ Academy - Change Flow Thinking Master Change with Confidence.pdf
PRIZ Guru
 
PDF
POWER PLANT ENGINEERING (R17A0326).pdf..
haneefachosa123
 
PDF
Comparative Analysis of the Use of Iron Ore Concentrate with Different Binder...
msejjournal
 
PPT
Hazard identification and risk assessment PPT
SUNILARORA51
 
PPTX
Mining Presentation Underground - Copy.pptx
patallenmoore
 
PDF
Web Technologies - Chapter 3 of Front end path.pdf
reemaaliasker
 
PPTX
Water resources Engineering GIS KRT.pptx
Krunal Thanki
 
PDF
LEARNING CROSS-LINGUAL WORD EMBEDDINGS WITH UNIVERSAL CONCEPTS
kjim477n
 
PDF
勉強会資料_An Image is Worth More Than 16x16 Patches
NABLAS株式会社
 
PPTX
Smart_Cities_IoT_Integration_Presentation.pptx
YashBhisade1
 
PPTX
ETP Presentation(1000m3 Small ETP For Power Plant and industry
MD Azharul Islam
 
MOBILE AND WEB BASED REMOTE BUSINESS MONITORING SYSTEM
ijait
 
IISM Presentation.ppt Construction safety
lovingrkn
 
Fluid statistics and Numerical on pascal law
Ravindra Kolhe
 
Basics of Auto Computer Aided Drafting .pptx
Krunal Thanki
 
th International conference on Big Data, Machine learning and Applications (B...
Zac Darcy
 
A NEW FAMILY OF OPTICALLY CONTROLLED LOGIC GATES USING NAPHTHOPYRAN MOLECULE
ijoejnl
 
Sensor IC System Design Using COMSOL Multiphysics 2025-July.pptx
James D.B. Wang, PhD
 
Jual GPS Geodetik CHCNAV i93 IMU-RTK Lanjutan dengan Survei Visual
Budi Minds
 
BEE331-Week 04-SU25.pdf semiconductors UW
faemoxley
 
PRIZ Academy - Change Flow Thinking Master Change with Confidence.pdf
PRIZ Guru
 
POWER PLANT ENGINEERING (R17A0326).pdf..
haneefachosa123
 
Comparative Analysis of the Use of Iron Ore Concentrate with Different Binder...
msejjournal
 
Hazard identification and risk assessment PPT
SUNILARORA51
 
Mining Presentation Underground - Copy.pptx
patallenmoore
 
Web Technologies - Chapter 3 of Front end path.pdf
reemaaliasker
 
Water resources Engineering GIS KRT.pptx
Krunal Thanki
 
LEARNING CROSS-LINGUAL WORD EMBEDDINGS WITH UNIVERSAL CONCEPTS
kjim477n
 
勉強会資料_An Image is Worth More Than 16x16 Patches
NABLAS株式会社
 
Smart_Cities_IoT_Integration_Presentation.pptx
YashBhisade1
 
ETP Presentation(1000m3 Small ETP For Power Plant and industry
MD Azharul Islam
 
Ad

Run * on the JVM - Simonyi Conference Budapest April 15

  • 1. Run * on the JVM Interpreters on the JVM with Graal and Truffle Balazs Varga / @vbalazs
  • 2. Agenda ● Compiled, interpreted applications and VMs ● Interpreters under the hood ● Interpreter on the JVM ○ Existing solutions ○ Future ● Summary
  • 3. Compiled, interpreted applications Operating system Libraries Compiler Operating system Libraries Executable Machine Code C source code Operating system Libraries InterpreterRuby source code (1.8) GC Libraries compiled C source code (executable machine code) Libraries GC: Garbage Collector
  • 4. Virtual Machines (runtimes) Operating system Libraries Java compiler Operating system Libraries Executable JVM bytecode Java source code Libraries JVM bytecode Java Runtime Env. GC Libraries
  • 5. Interpreters under the hood 1. Tokenize 2. Parse 3. AST Ruby Tokens Abstract Syntax Tree nodes C Machine Language interpret
  • 6. Abstract Syntax Tree function sum(n) { var sum = 0; for (var i = 1; i < n; i++) { sum += i; } return sum; } source: T. Würthinger, C. Wimmer, A. Wöß, L. Stadler, G. Duboscq, C. Humer, G. Richards, D. Simon, M. Wolczko: One VM to Rule Them All. In Proceedings of Onward!, ACM Press, 2013.
  • 7. Interpreter on the JVM Ruby source code compiled to Java bytecode Operating system Libraries JRuby interpreter Java Runtime Env. GC Libraries Why? Existing solutions
  • 8. The future is here: Truffle and Graal Goal: Native support for interpreters Requirements: ● simplicity ● generality ● performance
  • 9. System structure source: Christian Wimmer and Chris Seaton speak at the JVM Language Summit, July 31, 2013. Ruby Javascript Python R ... Your language here TruffleGraal Language agnostic dynamic compiler Common API between language implementation and optimization system Substrate VM Graal VM
  • 10. Truffle ● Java framework for writing AST interpreters ● node specialization with tree rewriting ● define compiler optimizations, directives ○ assumptions
  • 11. Graal ● 100% Java-based JIT framework ○ JIT: Just In Time (compiler) ● dynamic compiler ● directly control code generation ● graph intermediate representation
  • 12. Node rewrite - optimization source: T. Würthinger, C. Wimmer, A. Wöß, L. Stadler, G. Duboscq, C. Humer, G. Richards, D. Simon, M. Wolczko: One VM to Rule Them All. In Proceedings of Onward!, ACM Press, 2013.
  • 13. Node rewrite - de- and reoptimization source: T. Würthinger, C. Wimmer, A. Wöß, L. Stadler, G. Duboscq, C. Humer, G. Richards, D. Simon, M. Wolczko: One VM to Rule Them All. In Proceedings of Onward!, ACM Press, 2013.
  • 14. Bonus “Write your own language!” Before Truffle: ● write a parser and an AST interpreter ● create a runtime system (C/C++), GC ● performance problems: bytecode, JIT, improve GC ● ...??? Easy?
  • 15. Summary ● Truffle, Graal (~ Java 9) ○ “easy” to use AST interpreter framework ○ high performance (compiled to machine code!) ● Bonus: “Write your own language!” ● Contribute! ○ meetup.com: budapest.rb, budapest.js, … ○ https://github.com/jruby/jruby ○ http://openjdk.java.net/