SlideShare a Scribd company logo
1 of 30
InfoQ.com: News & Community Site
• 750,000 unique visitors/month
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• News 15-20 / week
• Articles 3-4 / week
• Presentations (videos) 12-15 / week
• Interviews 2-3 / week
• Books 1 / month
Watch the video with slide
synchronization on InfoQ.com!
https://www.infoq.com/presentations/
polyglot-jvm-graal
Presented at QCon New York
www.qconnewyork.com
Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		|
Polyglot	on	the	JVM
with	Graal
Thomas	Wuerthinger
Senior	Research	Director,	Oracle	Labs
@thomaswue
QCon New	York,	June	2017
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		|
Safe	Harbor	Statement
The	following	is	intended	to	provide	some	insight	into	a	line	of	research	in	Oracle	Labs.	It	
is	intended	for	information	purposes	only,	and	may	not	be	incorporated	into	any	contract.		
It	is	not	a	commitment	to	deliver	any	material,	code,	or	functionality,	and	should	not	be	
relied	upon	in	making	purchasing	decisions.	The	development,	release,	and	timing	of	any	
features	or	functionality	described	in	connection	with	any	Oracle	product	or	service	
remains	at	the	sole	discretion	of	Oracle.		Any	views	expressed	in	this	presentation	are	my	
own	and	do	not	necessarily	reflect	the	views	of	Oracle.
3
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		| 4
The World Is Polyglot!
Java
C
C++
Python
C#
VB.NET
JavaScript
Assembly	language
PHP
PerlRubyVBSwift
R
Objective-C
Go
MATLAB
Delphi/Object	 Pascal
PL/SQL
Scratch
Others
PROGRAMMING	LANGUAGE	POPULARITY
(TOP	20	LANGUAGES	FROM	MAY	2017	TIOBE INDEX)
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		| 5
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		| 6
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		| 7
Polyglot	Challenges
Only	languages	with	high	industry	attention	achieve	high	performance.
Languages	require	different	tools	for	configuring,	debugging,	profiling…
Languages	execute	in	their	own	box	with	costly	serialization	between	boxes.
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		| 8
Graal Vision
High	performance for	all	languages
Language-level	virtualization	layer	for	shared	manageability	and	tooling
Zero	overhead	interoperability between	languages
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		| 9
You can execute any language on the JVM / CLR
- as long as it looks like Java / C#.
Mismatch	between	type	system	and	bytecodes of	host	VM	and	
semantics	of	guest	language.
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		| 10
After	5+	years	of	research…
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		| 11
U
U U
U
U I
I I
G
G I
I I
G
G
Node Rewriting
for Profiling Feedback
AST Interpreter
Rewritten Nodes
AST Interpreter
Uninitialized Nodes
Compilation using
Partial Evaluation
Compiled Code
Node Transitions
S
U
I
D
G
Uninitialized Integer
Generic
DoubleString
Optimization	and	Speculation…
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		| 12
I
I I
G
G I
I I
G
G
Deoptimization
to AST Interpreter
D
I D
G
G D
I D
G
G
Node Rewriting to Update
Profiling Feedback
Recompilation using
Partial Evaluation
And	Deoptimization!
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		| 13
Graal VM	Architecture
Java	HotSpot	VM
JVM	Compiler	Interface	(JVMCI)	JEP	243
Graal Compiler
Truffle	Framework
Sulong
(LLVM)
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		|
Let‘s talk about R...
14
function(a, x) (a[x]+42)
• Does	„+“	resolve	to	the	addition	builtinfunction?
• Class	of	„a“?
• Does	„[]“	resolve	to	the	array	access	builtinfunction?
• Is	„x“	a	vector	of	specific	length?
• Does	„x“	have	negative	elements?	The	0	element?	Positive	elements?	
In-bounds	or	out-of-bounds?	An	NA	element?
• Any	code	can	be	executed	at	the	point	where	„a“	or	„x“	is	evaluated	
(lazy	promise	evaluation	of	arguments)
• Does	evaluated	code	redefine	„+“	or	„[]“	functions?
• Is	intermediate	vector	result	needed?
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		| 15
Graal.js Architecture
JavaScript
C++
Java
node	modules	with	only	JavaScriptnode	modules	with	native	extensions
node	standard	library
node	bindings	(socket,	http,	…)
V8	API
thread
pool
(libeio)
event
loop
(libev)
DNS
(c-ares)
crypto
(OpenSSL)
Graal.js JavaScript	Engine
Adapter	V8	API	to	Graal.js via	JNI
native	extensions
Fully	compatible	including	native	module	support!
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		|
Project	Sulong:	LLVM	front-end	for	Graal
int add(x, y) {
return x + y;
} define i32 @add(i32 %x, i32 %y) #0 {
%1 = alloca i32, align 4
%2 = alloca i32, align 4
store i32 %x, i32* %1, align 4
store i32 %y, i32* %2, align 4
%3 = load i32* %1, align 4
%4 = load i32* %2, align 4
%5 = add nsw i32 %3, %4
ret i32 %5
}
FUNCTION add(x, y)
INTEGER :: add
INTEGER :: a
INTEGER :: b
add = a + b
RETURN
END FUNCTION
func add(x int, y int) int {
return x + y;
}
https://github.com/graalvm/sulong
C/C++
Fortran
Go
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		|
High-Performance	for	Each Language
17
1.02 1.2
4.1
4.5
0.85 0.9
0
1
2
3
4
5
Java Scala Ruby R Native JavaScript
Speedup,	higher	is	better
Performance	on	64-bit	x86	on	well-known	benchmark	suites	relative	to:
HotSpot/Server,	JRuby,	GNU	R,	LLVM	AOT	compiled,	V8
Graal
Best	Specialized	Competition
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		|
Twitter	Evaluated	Early	Version	of	Graal
• Large	number	of	Scala	microservices
• More	Tweets	per	CPU	msec in	their	core	service
• https://www.jfokus.se/jfokus17/preso/Graal-at-Twitter.pdf
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		|
Zero	Overhead	Interoperability
19
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		| Confidential	– Oracle	Internal/Restricted/Highly	Restricted 20
Graal runtime	supports	complete	separation	of	physical	and	
logical	layout	for	guest	language	data	structures.
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		|
• Defining	lambda	method	in	JavaScript:
• Calling	from	same	language:
• Or	from	other	language	(e.g.,	Java):
• Or	from	custom	memory	layouts:
Ø row-oriented	format	=>	raw	pointer	to	current	row	and	schema
Ø column-oriented	format	=>	two	raw	pointers	to	current	positions	within	columns	and	schema
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		| 22
#include<stdio.h>
struct complex {
double r;
double i;
}
int main() {
struct complex *a = …;
struct complex *b = …;
add(a, b);
}
function add(a, b) {
var result = {r:0, i:0};
result.r = a.r + b.r;
result.i = a.i + b.i;
return result;
}
add(a, b)
a->r b->r
a->i b->i
main.c
complex.js
Data	Sharing	Across	Language	Boundaries
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		| 23
1x
8x
11x
32x
0
5
10
15
20
25
30
35
CRuby Graal/Ruby CRuby+C Graal/Ruby+C
Image	Processing	Composite	Speedup
Pure Ruby Ruby + C
Higherisbetter
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		| 24
DEMO
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		| 25
Graal Extended	Vision
High	performance,	polyglot,	language-level	virtualization	layer…
embeddable	across	the	stack	in	native	and	JVM-based	applications.
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		|
Resources	on	Graal
• OTN	product	page	including	download:	
– www.oracle.com/technetwork/oracle-labs/program-languages
• Graal projects	on	github:
– github.com/graalvm
• Graal on	OpenJDK:	
– openjdk.java.net/projects/graal
26
Copyright	©	2017, Oracle	and/or	its	affiliates.	All	rights	reserved.		|
Q/A
27
@graal
@thomaswue
Watch the video with slide
synchronization on InfoQ.com!
https://www.infoq.com/presentations/
polyglot-jvm-graal

More Related Content

More from C4Media

More from C4Media (20)

Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CD
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine Learning
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at Speed
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep Systems
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.js
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly Compiler
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix Scale
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's Edge
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home Everywhere
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing For
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data Engineering
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
 
Navigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery TeamsNavigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery Teams
 
High Performance Cooperative Distributed Systems in Adtech
High Performance Cooperative Distributed Systems in AdtechHigh Performance Cooperative Distributed Systems in Adtech
High Performance Cooperative Distributed Systems in Adtech
 
Rust's Journey to Async/await
Rust's Journey to Async/awaitRust's Journey to Async/await
Rust's Journey to Async/await
 
Opportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven UtopiaOpportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven Utopia
 
Datadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/DayDatadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/Day
 
Are We Really Cloud-Native?
Are We Really Cloud-Native?Are We Really Cloud-Native?
Are We Really Cloud-Native?
 
CockroachDB: Architecture of a Geo-Distributed SQL Database
CockroachDB: Architecture of a Geo-Distributed SQL DatabaseCockroachDB: Architecture of a Geo-Distributed SQL Database
CockroachDB: Architecture of a Geo-Distributed SQL Database
 
A Dive into Streams @LinkedIn with Brooklin
A Dive into Streams @LinkedIn with BrooklinA Dive into Streams @LinkedIn with Brooklin
A Dive into Streams @LinkedIn with Brooklin
 

Recently uploaded

TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
FIDO Alliance
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
FIDO Alliance
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
FIDO Alliance
 

Recently uploaded (20)

TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 

Polyglot on the JVM with Graal