SlideShare a Scribd company logo
Dan Heidinga,
OpenJ9 Project Lead
IBM Runtimes J9 Interpreter Lead
Daniel_Heidinga@ca.ibm.com
@DanHeidinga
Oct 3, 2017
OpenJ9: Under the Hood of the
Next Open Source JVM
Important disclaimers
§ THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY.
§ WHILST EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION
CONTAINED IN THIS PRESENTATION, IT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED.
§ ALL PERFORMANCE DATA INCLUDED IN THIS PRESENTATION HAVE BEEN GATHERED IN A CONTROLLED
ENVIRONMENT. YOUR OWN TEST RESULTS MAY VARY BASED ON HARDWARE, SOFTWARE OR
INFRASTRUCTURE DIFFERENCES.
§ ALL DATA INCLUDED IN THIS PRESENTATION ARE MEANT TO BE USED ONLY AS A GUIDE.
§ IN ADDITION, THE INFORMATION CONTAINED IN THIS PRESENTATION IS BASED ON IBM’S CURRENT
PRODUCT PLANS AND STRATEGY, WHICH ARE SUBJECT TO CHANGE BY IBM, WITHOUT NOTICE.
§ IBM AND ITS AFFILIATED COMPANIES SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT
OF THE USE OF, OR OTHERWISE RELATED TO, THIS PRESENTATION OR ANY OTHER DOCUMENTATION.
§ NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, OR SHALL HAVE THE EFFECT OF:
– CREATING ANY WARRANT OR REPRESENTATION FROM IBM, ITS AFFILIATED COMPANIES OR ITS
OR THEIR SUPPLIERS AND/OR LICENSORS
2
Who am I?
§ I've been involved with virtual machine development at IBM
since 2007 and am now the J9 Virtual Machine Team Lead.
J9 is IBM's independent implementation of the JVM.
§ I've represented IBM on both the JSR 292 ('invokedynamic')
and JSR 335 ('lambda') expert groups and lead J9's
implementation of both JSRs.
§ I’ve also maintain the bytecode verifier and deal with various
other parts of the runtime.
§ Now one of the Project Leads for the Eclipse OpenJ9 JVM.
3
Dan Heidinga,
OpenJ9 Project Lead
IBM Runtimes J9 Interpreter Lead
Daniel_Heidinga@ca.ibm.com
@DanHeidinga
Oct 3, 2017
Eclipse
OpenJ9: Under the Hood of the
Next Open Source JVM
http://www.eclipse.org/openj9
https://github.com/eclipse/openj9
Dual License:
Eclipse Public License v2.0
Apache 2.0
Users and contributors very welcome
https://github.com/eclipse/openj9/blob/master/CONTRIBUTING.md
Eclipse OpenJ9
Created Sept 2017
https://adoptopenjdk.net/nightly.html?variant=openjdk9-openj9
$ git clone https://github.com/ibmruntimes/openj9-openjdk-jdk9
$ cd openj9-openjdk-jdk9
$ bash ./get_source.sh
$ bash ./configure --with-freemarker-jar=freemarker.jar
$ make images
$ cd build/linux-x86_64-normal-server-release/images/
$ ./jdk/bin/java -version
7
Building OpenJDK with OpenJ9
Wait… OpenJDK with OpenJ9?
8
9
10 http://docs.oracle.com/javase/8/docs/index.html
11
The VM has connections into the rest of the JDK
12
OpenJDK with Eclipse OpenJ9
To build OpenJDK with OpenJ9 requires patches
• Build process
• Class libraries
OpenJ9 Communities
Open	
JDK
HotSpot
Eclipse	OMR
Open	
JDK
Eclipse	
OpenJ9
Eclipse	
OMR
Proven	adaptable	technology	in	the	
open	for	rapid	innovation	and	
collaboration	across	multiple	
language	communities
OpenJDK IBM	SDK	for	Java
Java	community	open	innovation	
and	collaboration
Ruby?
OMR
Communities	Beyond	Java
COBOL
PL/I
Emulator
Python?
OMR
JS?
OMR
Swift?
OMR
…
Long	term	support,	quick	
response	for	problems,	and	
other	forms	of	IBM	customer	
specific	engagement
+
IBM
isms
Open	
JDK
Eclipse	
OpenJ9
Eclipse	
OMR
Build an open reusable language runtime foundation for cloud platforms
– To accelerate advancement and innovation
– In full cooperation with existing language communities
– Engaging a diverse community of people interested in language runtimes
• Professional developers
• Researchers
• Students
• Hobbyists
Eclipse OMR Mission
http://www.eclipse.org/omr
https://github.com/eclipse/omr
https://developer.ibm.com/open/omr/
Dual License:
Eclipse Public License v2.0
Apache 2.0
Users and contributors very welcome
https://github.com/eclipse/omr/blob/master/CONTRIBUTING.md
Eclipse OMR
Created March 2016
public class HelloService {
public static void main(…) {
System.out.println(“Hello”);
}
}
17
$ java -jar uber.jar
18
$ java -jar uber.jar
19
Hello
$
20
What’s a JVM
actually doing
here?
21
22
Classfile
23
Classfile
Inputs Outputs
24
Classfile
Inputs Outputs
$ java -jar uber.jar
25
Hello
$
$ java –verbose:class
-jar uber.jar
26
27
…
class load: jdk/internal/org/objectweb/asm/FieldVisitor from: jrt:/java.base
class load: jdk/internal/org/objectweb/asm/FieldWriter from: jrt:/java.base
class load: java/lang/ClassLoader$$Lambda$3/00000000702E91F0
class load: HelloService from: file:/openj9/uber.jar
class load: jdk/internal/reflect/UnsafeFieldAccessorFactory from: jrt:/java.base
class load: jdk/internal/reflect/FieldAccessor from: jrt:/java.base
class load: jdk/internal/reflect/FieldAccessorImpl from: jrt:/java.base
class load: jdk/internal/reflect/UnsafeFieldAccessorImpl from: jrt:/java.base
class load: jdk/internal/reflect/UnsafeObjectFieldAccessorImpl from: jrt:/java.base
class load: java/lang/Class$ReflectCache from: jrt:/java.base
class load: java/lang/annotation/Annotation from: jrt:/java.base
class load: jdk/internal/reflect/CallerSensitive from: jrt:/java.base
….
“Data dominates.
If you've chosen the right data structures and
organized things well, the algorithms will almost
always be self-evident.
Data structures, not algorithms, are central to
programming.”
–Rob Pike (known for Plan 9, UTF-8, Go)
28
29
public class HelloService {
public static void main(…) {
System.out.println(“Hello”);
}
}
30
What does the JVM do to find that main method?
31
J9ROMClass: a better classfile
§ Keep all the symbolic info from a classfile
§ Remove variability (where possible)
§ Position independent: map anywhere in the address space
§ ROM: Read only once written
– Learn from the Smalltalk past
32
ROMClass
Conversion to ROM
33
Classfile Static
Verification
ROMClassROM Class
Builder
https://github.com/eclipse/openj9/tree/master/runtime/bcverify
https://github.com/eclipse/openj9/tree/master/runtime/bcutil
Regular pointers
34
0x50
0x20
0x28
0x30
0x38
0x40
0x48
0x50
0x58
0x60
Self-relative pointers
35
0x20
0x20
0x28
0x30
0x38
0x40
0x48
0x50
0x58
0x60
0x30 + *(0x30) = 0x30 + 0x20 = 0x50
Address of slot + value = target address
typedef struct J9ROMClass {
U_32 romSize;
U_32 singleScalarStaticCount;
J9SRP className;
J9SRP superclassName;
U_32 modifiers;
U_32 extraModifiers;
U_32 interfaceCount;
J9SRP interfaces;
U_32 romMethodCount;
J9SRP romMethods;
U_32 romFieldCount;
J9SRP romFields;
U_32 objectStaticCount;
U_32 doubleScalarStaticCount;
U_32 ramConstantPoolCount;
U_32 romConstantPoolCount;
...
} J9ROMClass;
J9ROMClass
ROM
Constant pool
interfaces
J9ROMMethods
. . .
37
public static void main(java.lang.String[])
0 JBgetstatic 2 System.out LPrintStream;
3 JBldc 3 (java.lang.String) "Hello”
5 JBinvokevirtual 4 PrintStream.println(LString;)V
8 JBreturn
Java’s late bound… Isn’t it slow to resolve
the fields / methods every time?
From ROM to RAM
38
RAM class creation
Load superclases
Load superinterfaces
Calculate vtable
ROMClass J9RAMClass
https://github.com/eclipse/openj9/blob/master/runtime/vm/createramclass.cpp
typedef struct J9Class {
UDATA eyecatcher;
struct J9ROMClass* romClass;
struct J9Class** superclasses;
UDATA classDepthAndFlags;
struct J9ClassLoader* classLoader;
j9object_t classObject;
UDATA volatile initializeStatus;
struct J9Method* ramMethods;
UDATA* ramStatics;
struct J9Class* arrayClass;
UDATA totalInstanceSize;
UDATA* instanceDescription;
UDATA packageID;
void** iTable;
void** jniIDs;
struct J9Class* replacedClass;
UDATA* ramConstantPool;
. . .
} J9Class;
J9Class
VTable
JIT VTable RAM
Constant pool
J9Methods
ShareClasses: ROM pays off
JVM 1 JVM 2 JVM 3
ShareClasses: ROM pays off
JVM 1 JVM 2 JVM 3
ShareClasses: ROM pays off
JVM 1 JVM 2 JVM 3
Shared Classes
Cache
Faster startup, Smaller footprint
43
ROMClass J9RAMClass
Cool native memory!
How does this show
up for my Java code?
Classloading: tying it all together
44
ROMClass J9RAMClass
J9ClassLoader
java.lang.Class java.lang.ClassLoader
Heap
Native
45
public static void main(java.lang.String[])
0 JBgetstatic 2 System.out LPrintStream;
3 JBldc 3 (java.lang.String) "Hello”
5 JBinvokevirtual 4 PrintStream.println(LString;)V
8 JBreturn
That’s all good but what about actually
running my code???
Execution context: the Thread
46
J9VMThreadJ9VMThreadJ9JavaVM
omrthread_t omrthread_t omrthread_t
Heap
Native
java.lang.Thread java.lang.Thread java.lang.Thread
SP
A0
PC
Method
Per-Thread Interpreter State
47
J9VMThread
omrthread_t
java.lang.Thread
J9Method
ROMMethod
Bytecodes
SP
A0
PC
Method
Per-Thread Interpreter State
48
J9VMThread
omrthread_t
java.lang.Thread
J9Method
ROMMethod
Bytecodes
SP
A0
PC
Method
Per-Thread Interpreter State
49
J9VMThread
omrthread_t
java.lang.Thread
Pending
Frame
Temps
Args
Java stack
J9Method
ROMMethod
Bytecodes
0
Interpreter
§ Written in C++
§ Switch statement / computed goto
§ Executes:
– bytecodes
– INLs
– builds stack frames
§ Transition to the JIT
50
https://github.com/eclipse/openj9/blob/master/runtime/vm/BytecodeInterpreter.hpp
JIT Compilation
ARM
Optimizer
Analyses	and	Optimizations
cold warm hot FSDscorching AOT
IL	Generation
x86
POWER
Z
Code	Generators
Runtime
Environment/
Configuration
•Options
•Object	Model
•Memory
•Threading
•Tracing
codeMetadataRuntimeRT Helpers
very hot profiling
Profile
Manager
Hardware
counters
Sampling
Thread
Interpreter
Profile Info
JIT
Profile Info
Profiler
Adaptive JIT Compilation
52
§ Methods start out running bytecode form directly
§ After many invocations (or via sampling) code get compiled at
‘cold’ or ‘warm’ level
§ Low overhead sampling thread is used to identify hot methods
§ Methods may get recompiled at ‘hot’ or ‘scorching’ levels (for more
optimizations)
§ Transition to ‘scorching’ goes through a temporary profiling step
cold
hot
scorching
profiling
interpreter
warm
53
+ (cold) jdk/internal/reflect/NativeConstructorAccessorImpl.newInstance0(…
+ (cold) java/lang/Module.defineModule0(…
+ (cold) java/lang/Module.addReads0(Ljava/lang/Module;Ljava/lang/Module;)V
+ (cold) java/lang/Module.addExports0(…
+ (cold) java/lang/Module.addExportsToAll0(Ljava/lang/Module;Ljava/lang/String;)V
+ (warm) java/util/HashMap.hash(Ljava/lang/Object;)I
+ (warm) java/util/HashMap.putVal(…
+ (cold) java/lang/Thread.setNameImpl(JLjava/lang/String;)V
+ (warm) java/lang/Math.floorMod(II)I
+ (warm) java/lang/Math.floorDiv(II)I
$ java –Xjit:verbose
-jar uber.jar
“Dynamic” AOT through ShareClasses
Shared Classes
Cache
AOTROM Classes
$ java –Xshareclasses -jar uber.jar
55
Cool!
How can I get
involved?
Wrap-up: Want to get involved?
§ Download OpenJDK with OpenJ9 and try it out!
– https://adoptopenjdk.net/releases.html?variant=openjdk9-openj9
– Run on your favourite Java application and let us know how it went!
§ Interact with our community via Github issues
– https://github.com/eclipse/openj9
– Ask questions, report problems, report Amazing Results
– Download the code, build it yourself, play around!
– Submit pull requests, see them tested on multiple platforms in the open
§ Whatever you think will make Eclipse OpenJ9 better, we’d love to hear it
56
Learn more at Java One!
§ Have even more questions? Dan Heidinga, Mark Stoodley, John Duimovich
Ask the OpenJ9 Architects [CON2672]
Wednesday, Oct 04, 8:30 a.m. - 9:15 a.m. | Moscone West - Room 2011
§ Learn about microservices for open testing with Shelley Lambert
Cloud-Based Test Microservices [CON2789]
Thursday, Oct 05, 11:45 a.m. - 12:30 p.m. | Marriott Marquis (Yerba Buena Level) - Salon 12
§ Debugging runtimes with Dan Heidinga for Bjørn Vårdal
Secrets of Building a Debuggable Runime [CON4081]
Thursday, Oct 05, 12:45 p.m. - 1:30 p.m. | Marriott Marquis (Yerba Buena Level) - Salon 15
§ Visit the Eclipse Foundation booth (6140)
Dan Heidinga & Mark Stoodley today from 4:00 - 5:45
Mark Stoodley on Wednesday from 2:30 - 4:30
57
Questions?
58
Dan Heidinga
daniel_heidinga@ca.ibm.com
@DanHeidinga
59
Legal Notice
IBM and the IBM logo are trademarks or registered trademarks of IBM Corporation, in the United States, other
countries or both.
Java and all Java-based marks, among others, are trademarks or registered trademarks of Oracle in the United
States, other countries or both.
Other company, product and service names may be trademarks or service marks of others.
THE INFORMATION DISCUSSED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL
PURPOSES ONLY. WHILE EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND
ACCURACY OF THE INFORMATION, IT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, AND IBM SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT
OF THE USE OF, OR OTHERWISE RELATED TO, SUCH INFORMATION. ANY INFORMATION
CONCERNING IBM'S PRODUCT PLANS OR STRATEGY IS SUBJECT TO CHANGE BY IBM WITHOUT
NOTICE.

More Related Content

What's hot

Write your Helm charts as a professional. Design templates and inheritance. B...
Write your Helm charts as a professional. Design templates and inheritance. B...Write your Helm charts as a professional. Design templates and inheritance. B...
Write your Helm charts as a professional. Design templates and inheritance. B...
Volodymyr Shynkar
 
Sistemas operacionais de computadores de grande porte
Sistemas operacionais de computadores de grande porteSistemas operacionais de computadores de grande porte
Sistemas operacionais de computadores de grande portetiagohinke
 
Kamailio - Load Balancing Load Balancers
Kamailio - Load Balancing Load BalancersKamailio - Load Balancing Load Balancers
Kamailio - Load Balancing Load Balancers
Daniel-Constantin Mierla
 
HBase at LINE 2017
HBase at LINE 2017HBase at LINE 2017
HBase at LINE 2017
LINE Corporation
 
High-Performance Networking Using eBPF, XDP, and io_uring
High-Performance Networking Using eBPF, XDP, and io_uringHigh-Performance Networking Using eBPF, XDP, and io_uring
High-Performance Networking Using eBPF, XDP, and io_uring
ScyllaDB
 
Terraform Tips and Tricks - LAOUC 2022
Terraform Tips and Tricks - LAOUC 2022Terraform Tips and Tricks - LAOUC 2022
Terraform Tips and Tricks - LAOUC 2022
Nelson Calero
 
Execution
ExecutionExecution
Execution
Angel Boy
 
Aula 3 barramentos de placa mae
Aula 3 barramentos de placa maeAula 3 barramentos de placa mae
Aula 3 barramentos de placa mae
Marcos Basilio
 
헤테로지니어스 컴퓨팅 : CPU 에서 GPU 로 옮겨가기
헤테로지니어스 컴퓨팅 :  CPU 에서 GPU 로 옮겨가기헤테로지니어스 컴퓨팅 :  CPU 에서 GPU 로 옮겨가기
헤테로지니어스 컴퓨팅 : CPU 에서 GPU 로 옮겨가기zupet
 
Run Qt on Linux embedded systems using Yocto
Run Qt on Linux embedded systems using YoctoRun Qt on Linux embedded systems using Yocto
Run Qt on Linux embedded systems using Yocto
Marco Cavallini
 
Utilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino APIUtilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino API
Oliver Busse
 
Room 3 - 4 - Lê Quang Hiếu - How to be a cool dad: Leverage DIY Home Automati...
Room 3 - 4 - Lê Quang Hiếu - How to be a cool dad: Leverage DIY Home Automati...Room 3 - 4 - Lê Quang Hiếu - How to be a cool dad: Leverage DIY Home Automati...
Room 3 - 4 - Lê Quang Hiếu - How to be a cool dad: Leverage DIY Home Automati...
Vietnam Open Infrastructure User Group
 
Static partitioning virtualization on RISC-V
Static partitioning virtualization on RISC-VStatic partitioning virtualization on RISC-V
Static partitioning virtualization on RISC-V
RISC-V International
 
Plan 9: Not (Only) A Better UNIX
Plan 9: Not (Only) A Better UNIXPlan 9: Not (Only) A Better UNIX
Plan 9: Not (Only) A Better UNIX
National Cheng Kung University
 
Hadoop Meetup Jan 2019 - HDFS Scalability and Consistent Reads from Standby Node
Hadoop Meetup Jan 2019 - HDFS Scalability and Consistent Reads from Standby NodeHadoop Meetup Jan 2019 - HDFS Scalability and Consistent Reads from Standby Node
Hadoop Meetup Jan 2019 - HDFS Scalability and Consistent Reads from Standby Node
Erik Krogen
 
Seastore: Next Generation Backing Store for Ceph
Seastore: Next Generation Backing Store for CephSeastore: Next Generation Backing Store for Ceph
Seastore: Next Generation Backing Store for Ceph
ScyllaDB
 
Spnego configuration
Spnego configurationSpnego configuration
Spnego configuration
Gabriella Davis
 
Java Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame GraphsJava Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame Graphs
Brendan Gregg
 
rpm package 를 이용한 MySQL 설치자동화
rpm package 를 이용한 MySQL 설치자동화rpm package 를 이용한 MySQL 설치자동화
rpm package 를 이용한 MySQL 설치자동화
I Goo Lee
 
Introdução React.js
Introdução React.jsIntrodução React.js
Introdução React.js
Henrique Gogó
 

What's hot (20)

Write your Helm charts as a professional. Design templates and inheritance. B...
Write your Helm charts as a professional. Design templates and inheritance. B...Write your Helm charts as a professional. Design templates and inheritance. B...
Write your Helm charts as a professional. Design templates and inheritance. B...
 
Sistemas operacionais de computadores de grande porte
Sistemas operacionais de computadores de grande porteSistemas operacionais de computadores de grande porte
Sistemas operacionais de computadores de grande porte
 
Kamailio - Load Balancing Load Balancers
Kamailio - Load Balancing Load BalancersKamailio - Load Balancing Load Balancers
Kamailio - Load Balancing Load Balancers
 
HBase at LINE 2017
HBase at LINE 2017HBase at LINE 2017
HBase at LINE 2017
 
High-Performance Networking Using eBPF, XDP, and io_uring
High-Performance Networking Using eBPF, XDP, and io_uringHigh-Performance Networking Using eBPF, XDP, and io_uring
High-Performance Networking Using eBPF, XDP, and io_uring
 
Terraform Tips and Tricks - LAOUC 2022
Terraform Tips and Tricks - LAOUC 2022Terraform Tips and Tricks - LAOUC 2022
Terraform Tips and Tricks - LAOUC 2022
 
Execution
ExecutionExecution
Execution
 
Aula 3 barramentos de placa mae
Aula 3 barramentos de placa maeAula 3 barramentos de placa mae
Aula 3 barramentos de placa mae
 
헤테로지니어스 컴퓨팅 : CPU 에서 GPU 로 옮겨가기
헤테로지니어스 컴퓨팅 :  CPU 에서 GPU 로 옮겨가기헤테로지니어스 컴퓨팅 :  CPU 에서 GPU 로 옮겨가기
헤테로지니어스 컴퓨팅 : CPU 에서 GPU 로 옮겨가기
 
Run Qt on Linux embedded systems using Yocto
Run Qt on Linux embedded systems using YoctoRun Qt on Linux embedded systems using Yocto
Run Qt on Linux embedded systems using Yocto
 
Utilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino APIUtilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino API
 
Room 3 - 4 - Lê Quang Hiếu - How to be a cool dad: Leverage DIY Home Automati...
Room 3 - 4 - Lê Quang Hiếu - How to be a cool dad: Leverage DIY Home Automati...Room 3 - 4 - Lê Quang Hiếu - How to be a cool dad: Leverage DIY Home Automati...
Room 3 - 4 - Lê Quang Hiếu - How to be a cool dad: Leverage DIY Home Automati...
 
Static partitioning virtualization on RISC-V
Static partitioning virtualization on RISC-VStatic partitioning virtualization on RISC-V
Static partitioning virtualization on RISC-V
 
Plan 9: Not (Only) A Better UNIX
Plan 9: Not (Only) A Better UNIXPlan 9: Not (Only) A Better UNIX
Plan 9: Not (Only) A Better UNIX
 
Hadoop Meetup Jan 2019 - HDFS Scalability and Consistent Reads from Standby Node
Hadoop Meetup Jan 2019 - HDFS Scalability and Consistent Reads from Standby NodeHadoop Meetup Jan 2019 - HDFS Scalability and Consistent Reads from Standby Node
Hadoop Meetup Jan 2019 - HDFS Scalability and Consistent Reads from Standby Node
 
Seastore: Next Generation Backing Store for Ceph
Seastore: Next Generation Backing Store for CephSeastore: Next Generation Backing Store for Ceph
Seastore: Next Generation Backing Store for Ceph
 
Spnego configuration
Spnego configurationSpnego configuration
Spnego configuration
 
Java Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame GraphsJava Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame Graphs
 
rpm package 를 이용한 MySQL 설치자동화
rpm package 를 이용한 MySQL 설치자동화rpm package 를 이용한 MySQL 설치자동화
rpm package 를 이용한 MySQL 설치자동화
 
Introdução React.js
Introdução React.jsIntrodução React.js
Introdução React.js
 

Similar to JavaOne 2017: Eclipse OpenJ9: Under the hood of the JVM

JavaOne 2016: Life after Modularity
JavaOne 2016: Life after ModularityJavaOne 2016: Life after Modularity
JavaOne 2016: Life after Modularity
DanHeidinga
 
J9: Under the hood of the next open source JVM
J9: Under the hood of the next open source JVMJ9: Under the hood of the next open source JVM
J9: Under the hood of the next open source JVM
DanHeidinga
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
Ana-Maria Mihalceanu
 
The JVM in the Cloud: OpenJ9 and the traditional HotSpot JVM
The JVM in the Cloud: OpenJ9 and the traditional HotSpot JVMThe JVM in the Cloud: OpenJ9 and the traditional HotSpot JVM
The JVM in the Cloud: OpenJ9 and the traditional HotSpot JVM
Andy Moncsek
 
Master your java_applications_in_kubernetes
Master your java_applications_in_kubernetesMaster your java_applications_in_kubernetes
Master your java_applications_in_kubernetes
Andy Moncsek
 
Migrate Early, Migrate Often: JDK release cadence strategies
Migrate Early, Migrate Often: JDK release cadence strategiesMigrate Early, Migrate Often: JDK release cadence strategies
Migrate Early, Migrate Often: JDK release cadence strategies
DanHeidinga
 
Dropwizard and Friends
Dropwizard and FriendsDropwizard and Friends
Dropwizard and Friends
Yun Zhi Lin
 
Open j9 jdk on RISC-V
Open j9 jdk on RISC-VOpen j9 jdk on RISC-V
Open j9 jdk on RISC-V
RISC-V International
 
Optimizing Spring Boot apps for Docker
Optimizing Spring Boot apps for DockerOptimizing Spring Boot apps for Docker
Optimizing Spring Boot apps for Docker
Graham Charters
 
Building native Android applications with Mirah and Pindah
Building native Android applications with Mirah and PindahBuilding native Android applications with Mirah and Pindah
Building native Android applications with Mirah and Pindah
Nick Plante
 
Bci for Beginners
Bci for BeginnersBci for Beginners
Bci for Beginners
IainLewis
 
java basic for begginers
java basic for begginersjava basic for begginers
java basic for begginers
divaskrgupta007
 
A Glance At The Java Performance Toolbox-TIA.pdf
 A Glance At The Java Performance Toolbox-TIA.pdf A Glance At The Java Performance Toolbox-TIA.pdf
A Glance At The Java Performance Toolbox-TIA.pdf
Ana-Maria Mihalceanu
 
A Glance At The Java Performance Toolbox-TIA.pdf
 A Glance At The Java Performance Toolbox-TIA.pdf A Glance At The Java Performance Toolbox-TIA.pdf
A Glance At The Java Performance Toolbox-TIA.pdf
Ana-Maria Mihalceanu
 
The Power of the JVM: Applied Polyglot Projects with Java and JavaScript
The Power of the JVM: Applied Polyglot Projects with Java and JavaScriptThe Power of the JVM: Applied Polyglot Projects with Java and JavaScript
The Power of the JVM: Applied Polyglot Projects with Java and JavaScript
Hazelcast
 
Englishman in new york => scala for java developer
Englishman in new york =>  scala for java developerEnglishman in new york =>  scala for java developer
Englishman in new york => scala for java developer
Anton Naumov
 
Being agile with modern Java
Being agile with modern JavaBeing agile with modern Java
Being agile with modern Java
Oresztész Margaritisz
 
Building maintainable javascript applications
Building maintainable javascript applicationsBuilding maintainable javascript applications
Building maintainable javascript applications
equisodie
 
Deep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UKDeep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UK
José Paumard
 
Demystifying Maven
Demystifying MavenDemystifying Maven
Demystifying Maven
Mike Desjardins
 

Similar to JavaOne 2017: Eclipse OpenJ9: Under the hood of the JVM (20)

JavaOne 2016: Life after Modularity
JavaOne 2016: Life after ModularityJavaOne 2016: Life after Modularity
JavaOne 2016: Life after Modularity
 
J9: Under the hood of the next open source JVM
J9: Under the hood of the next open source JVMJ9: Under the hood of the next open source JVM
J9: Under the hood of the next open source JVM
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
The JVM in the Cloud: OpenJ9 and the traditional HotSpot JVM
The JVM in the Cloud: OpenJ9 and the traditional HotSpot JVMThe JVM in the Cloud: OpenJ9 and the traditional HotSpot JVM
The JVM in the Cloud: OpenJ9 and the traditional HotSpot JVM
 
Master your java_applications_in_kubernetes
Master your java_applications_in_kubernetesMaster your java_applications_in_kubernetes
Master your java_applications_in_kubernetes
 
Migrate Early, Migrate Often: JDK release cadence strategies
Migrate Early, Migrate Often: JDK release cadence strategiesMigrate Early, Migrate Often: JDK release cadence strategies
Migrate Early, Migrate Often: JDK release cadence strategies
 
Dropwizard and Friends
Dropwizard and FriendsDropwizard and Friends
Dropwizard and Friends
 
Open j9 jdk on RISC-V
Open j9 jdk on RISC-VOpen j9 jdk on RISC-V
Open j9 jdk on RISC-V
 
Optimizing Spring Boot apps for Docker
Optimizing Spring Boot apps for DockerOptimizing Spring Boot apps for Docker
Optimizing Spring Boot apps for Docker
 
Building native Android applications with Mirah and Pindah
Building native Android applications with Mirah and PindahBuilding native Android applications with Mirah and Pindah
Building native Android applications with Mirah and Pindah
 
Bci for Beginners
Bci for BeginnersBci for Beginners
Bci for Beginners
 
java basic for begginers
java basic for begginersjava basic for begginers
java basic for begginers
 
A Glance At The Java Performance Toolbox-TIA.pdf
 A Glance At The Java Performance Toolbox-TIA.pdf A Glance At The Java Performance Toolbox-TIA.pdf
A Glance At The Java Performance Toolbox-TIA.pdf
 
A Glance At The Java Performance Toolbox-TIA.pdf
 A Glance At The Java Performance Toolbox-TIA.pdf A Glance At The Java Performance Toolbox-TIA.pdf
A Glance At The Java Performance Toolbox-TIA.pdf
 
The Power of the JVM: Applied Polyglot Projects with Java and JavaScript
The Power of the JVM: Applied Polyglot Projects with Java and JavaScriptThe Power of the JVM: Applied Polyglot Projects with Java and JavaScript
The Power of the JVM: Applied Polyglot Projects with Java and JavaScript
 
Englishman in new york => scala for java developer
Englishman in new york =>  scala for java developerEnglishman in new york =>  scala for java developer
Englishman in new york => scala for java developer
 
Being agile with modern Java
Being agile with modern JavaBeing agile with modern Java
Being agile with modern Java
 
Building maintainable javascript applications
Building maintainable javascript applicationsBuilding maintainable javascript applications
Building maintainable javascript applications
 
Deep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UKDeep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UK
 
Demystifying Maven
Demystifying MavenDemystifying Maven
Demystifying Maven
 

Recently uploaded

Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
kalichargn70th171
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 

Recently uploaded (20)

Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 

JavaOne 2017: Eclipse OpenJ9: Under the hood of the JVM

  • 1. Dan Heidinga, OpenJ9 Project Lead IBM Runtimes J9 Interpreter Lead Daniel_Heidinga@ca.ibm.com @DanHeidinga Oct 3, 2017 OpenJ9: Under the Hood of the Next Open Source JVM
  • 2. Important disclaimers § THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY. § WHILST EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION CONTAINED IN THIS PRESENTATION, IT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. § ALL PERFORMANCE DATA INCLUDED IN THIS PRESENTATION HAVE BEEN GATHERED IN A CONTROLLED ENVIRONMENT. YOUR OWN TEST RESULTS MAY VARY BASED ON HARDWARE, SOFTWARE OR INFRASTRUCTURE DIFFERENCES. § ALL DATA INCLUDED IN THIS PRESENTATION ARE MEANT TO BE USED ONLY AS A GUIDE. § IN ADDITION, THE INFORMATION CONTAINED IN THIS PRESENTATION IS BASED ON IBM’S CURRENT PRODUCT PLANS AND STRATEGY, WHICH ARE SUBJECT TO CHANGE BY IBM, WITHOUT NOTICE. § IBM AND ITS AFFILIATED COMPANIES SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, THIS PRESENTATION OR ANY OTHER DOCUMENTATION. § NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, OR SHALL HAVE THE EFFECT OF: – CREATING ANY WARRANT OR REPRESENTATION FROM IBM, ITS AFFILIATED COMPANIES OR ITS OR THEIR SUPPLIERS AND/OR LICENSORS 2
  • 3. Who am I? § I've been involved with virtual machine development at IBM since 2007 and am now the J9 Virtual Machine Team Lead. J9 is IBM's independent implementation of the JVM. § I've represented IBM on both the JSR 292 ('invokedynamic') and JSR 335 ('lambda') expert groups and lead J9's implementation of both JSRs. § I’ve also maintain the bytecode verifier and deal with various other parts of the runtime. § Now one of the Project Leads for the Eclipse OpenJ9 JVM. 3
  • 4. Dan Heidinga, OpenJ9 Project Lead IBM Runtimes J9 Interpreter Lead Daniel_Heidinga@ca.ibm.com @DanHeidinga Oct 3, 2017 Eclipse OpenJ9: Under the Hood of the Next Open Source JVM
  • 5. http://www.eclipse.org/openj9 https://github.com/eclipse/openj9 Dual License: Eclipse Public License v2.0 Apache 2.0 Users and contributors very welcome https://github.com/eclipse/openj9/blob/master/CONTRIBUTING.md Eclipse OpenJ9 Created Sept 2017
  • 7. $ git clone https://github.com/ibmruntimes/openj9-openjdk-jdk9 $ cd openj9-openjdk-jdk9 $ bash ./get_source.sh $ bash ./configure --with-freemarker-jar=freemarker.jar $ make images $ cd build/linux-x86_64-normal-server-release/images/ $ ./jdk/bin/java -version 7 Building OpenJDK with OpenJ9
  • 9. 9
  • 11. 11 The VM has connections into the rest of the JDK
  • 12. 12 OpenJDK with Eclipse OpenJ9 To build OpenJDK with OpenJ9 requires patches • Build process • Class libraries
  • 14. Build an open reusable language runtime foundation for cloud platforms – To accelerate advancement and innovation – In full cooperation with existing language communities – Engaging a diverse community of people interested in language runtimes • Professional developers • Researchers • Students • Hobbyists Eclipse OMR Mission
  • 15. http://www.eclipse.org/omr https://github.com/eclipse/omr https://developer.ibm.com/open/omr/ Dual License: Eclipse Public License v2.0 Apache 2.0 Users and contributors very welcome https://github.com/eclipse/omr/blob/master/CONTRIBUTING.md Eclipse OMR Created March 2016
  • 16.
  • 17. public class HelloService { public static void main(…) { System.out.println(“Hello”); } } 17
  • 18. $ java -jar uber.jar 18
  • 19. $ java -jar uber.jar 19 Hello $
  • 21. 21
  • 25. $ java -jar uber.jar 25 Hello $
  • 27. 27 … class load: jdk/internal/org/objectweb/asm/FieldVisitor from: jrt:/java.base class load: jdk/internal/org/objectweb/asm/FieldWriter from: jrt:/java.base class load: java/lang/ClassLoader$$Lambda$3/00000000702E91F0 class load: HelloService from: file:/openj9/uber.jar class load: jdk/internal/reflect/UnsafeFieldAccessorFactory from: jrt:/java.base class load: jdk/internal/reflect/FieldAccessor from: jrt:/java.base class load: jdk/internal/reflect/FieldAccessorImpl from: jrt:/java.base class load: jdk/internal/reflect/UnsafeFieldAccessorImpl from: jrt:/java.base class load: jdk/internal/reflect/UnsafeObjectFieldAccessorImpl from: jrt:/java.base class load: java/lang/Class$ReflectCache from: jrt:/java.base class load: java/lang/annotation/Annotation from: jrt:/java.base class load: jdk/internal/reflect/CallerSensitive from: jrt:/java.base ….
  • 28. “Data dominates. If you've chosen the right data structures and organized things well, the algorithms will almost always be self-evident. Data structures, not algorithms, are central to programming.” –Rob Pike (known for Plan 9, UTF-8, Go) 28
  • 29. 29
  • 30. public class HelloService { public static void main(…) { System.out.println(“Hello”); } } 30 What does the JVM do to find that main method?
  • 31. 31
  • 32. J9ROMClass: a better classfile § Keep all the symbolic info from a classfile § Remove variability (where possible) § Position independent: map anywhere in the address space § ROM: Read only once written – Learn from the Smalltalk past 32 ROMClass
  • 33. Conversion to ROM 33 Classfile Static Verification ROMClassROM Class Builder https://github.com/eclipse/openj9/tree/master/runtime/bcverify https://github.com/eclipse/openj9/tree/master/runtime/bcutil
  • 35. Self-relative pointers 35 0x20 0x20 0x28 0x30 0x38 0x40 0x48 0x50 0x58 0x60 0x30 + *(0x30) = 0x30 + 0x20 = 0x50 Address of slot + value = target address
  • 36. typedef struct J9ROMClass { U_32 romSize; U_32 singleScalarStaticCount; J9SRP className; J9SRP superclassName; U_32 modifiers; U_32 extraModifiers; U_32 interfaceCount; J9SRP interfaces; U_32 romMethodCount; J9SRP romMethods; U_32 romFieldCount; J9SRP romFields; U_32 objectStaticCount; U_32 doubleScalarStaticCount; U_32 ramConstantPoolCount; U_32 romConstantPoolCount; ... } J9ROMClass; J9ROMClass ROM Constant pool interfaces J9ROMMethods . . .
  • 37. 37 public static void main(java.lang.String[]) 0 JBgetstatic 2 System.out LPrintStream; 3 JBldc 3 (java.lang.String) "Hello” 5 JBinvokevirtual 4 PrintStream.println(LString;)V 8 JBreturn Java’s late bound… Isn’t it slow to resolve the fields / methods every time?
  • 38. From ROM to RAM 38 RAM class creation Load superclases Load superinterfaces Calculate vtable ROMClass J9RAMClass https://github.com/eclipse/openj9/blob/master/runtime/vm/createramclass.cpp
  • 39. typedef struct J9Class { UDATA eyecatcher; struct J9ROMClass* romClass; struct J9Class** superclasses; UDATA classDepthAndFlags; struct J9ClassLoader* classLoader; j9object_t classObject; UDATA volatile initializeStatus; struct J9Method* ramMethods; UDATA* ramStatics; struct J9Class* arrayClass; UDATA totalInstanceSize; UDATA* instanceDescription; UDATA packageID; void** iTable; void** jniIDs; struct J9Class* replacedClass; UDATA* ramConstantPool; . . . } J9Class; J9Class VTable JIT VTable RAM Constant pool J9Methods
  • 40. ShareClasses: ROM pays off JVM 1 JVM 2 JVM 3
  • 41. ShareClasses: ROM pays off JVM 1 JVM 2 JVM 3
  • 42. ShareClasses: ROM pays off JVM 1 JVM 2 JVM 3 Shared Classes Cache Faster startup, Smaller footprint
  • 43. 43 ROMClass J9RAMClass Cool native memory! How does this show up for my Java code?
  • 44. Classloading: tying it all together 44 ROMClass J9RAMClass J9ClassLoader java.lang.Class java.lang.ClassLoader Heap Native
  • 45. 45 public static void main(java.lang.String[]) 0 JBgetstatic 2 System.out LPrintStream; 3 JBldc 3 (java.lang.String) "Hello” 5 JBinvokevirtual 4 PrintStream.println(LString;)V 8 JBreturn That’s all good but what about actually running my code???
  • 46. Execution context: the Thread 46 J9VMThreadJ9VMThreadJ9JavaVM omrthread_t omrthread_t omrthread_t Heap Native java.lang.Thread java.lang.Thread java.lang.Thread
  • 50. Interpreter § Written in C++ § Switch statement / computed goto § Executes: – bytecodes – INLs – builds stack frames § Transition to the JIT 50 https://github.com/eclipse/openj9/blob/master/runtime/vm/BytecodeInterpreter.hpp
  • 51. JIT Compilation ARM Optimizer Analyses and Optimizations cold warm hot FSDscorching AOT IL Generation x86 POWER Z Code Generators Runtime Environment/ Configuration •Options •Object Model •Memory •Threading •Tracing codeMetadataRuntimeRT Helpers very hot profiling Profile Manager Hardware counters Sampling Thread Interpreter Profile Info JIT Profile Info Profiler
  • 52. Adaptive JIT Compilation 52 § Methods start out running bytecode form directly § After many invocations (or via sampling) code get compiled at ‘cold’ or ‘warm’ level § Low overhead sampling thread is used to identify hot methods § Methods may get recompiled at ‘hot’ or ‘scorching’ levels (for more optimizations) § Transition to ‘scorching’ goes through a temporary profiling step cold hot scorching profiling interpreter warm
  • 53. 53 + (cold) jdk/internal/reflect/NativeConstructorAccessorImpl.newInstance0(… + (cold) java/lang/Module.defineModule0(… + (cold) java/lang/Module.addReads0(Ljava/lang/Module;Ljava/lang/Module;)V + (cold) java/lang/Module.addExports0(… + (cold) java/lang/Module.addExportsToAll0(Ljava/lang/Module;Ljava/lang/String;)V + (warm) java/util/HashMap.hash(Ljava/lang/Object;)I + (warm) java/util/HashMap.putVal(… + (cold) java/lang/Thread.setNameImpl(JLjava/lang/String;)V + (warm) java/lang/Math.floorMod(II)I + (warm) java/lang/Math.floorDiv(II)I $ java –Xjit:verbose -jar uber.jar
  • 54. “Dynamic” AOT through ShareClasses Shared Classes Cache AOTROM Classes $ java –Xshareclasses -jar uber.jar
  • 55. 55 Cool! How can I get involved?
  • 56. Wrap-up: Want to get involved? § Download OpenJDK with OpenJ9 and try it out! – https://adoptopenjdk.net/releases.html?variant=openjdk9-openj9 – Run on your favourite Java application and let us know how it went! § Interact with our community via Github issues – https://github.com/eclipse/openj9 – Ask questions, report problems, report Amazing Results – Download the code, build it yourself, play around! – Submit pull requests, see them tested on multiple platforms in the open § Whatever you think will make Eclipse OpenJ9 better, we’d love to hear it 56
  • 57. Learn more at Java One! § Have even more questions? Dan Heidinga, Mark Stoodley, John Duimovich Ask the OpenJ9 Architects [CON2672] Wednesday, Oct 04, 8:30 a.m. - 9:15 a.m. | Moscone West - Room 2011 § Learn about microservices for open testing with Shelley Lambert Cloud-Based Test Microservices [CON2789] Thursday, Oct 05, 11:45 a.m. - 12:30 p.m. | Marriott Marquis (Yerba Buena Level) - Salon 12 § Debugging runtimes with Dan Heidinga for Bjørn Vårdal Secrets of Building a Debuggable Runime [CON4081] Thursday, Oct 05, 12:45 p.m. - 1:30 p.m. | Marriott Marquis (Yerba Buena Level) - Salon 15 § Visit the Eclipse Foundation booth (6140) Dan Heidinga & Mark Stoodley today from 4:00 - 5:45 Mark Stoodley on Wednesday from 2:30 - 4:30 57
  • 59. 59 Legal Notice IBM and the IBM logo are trademarks or registered trademarks of IBM Corporation, in the United States, other countries or both. Java and all Java-based marks, among others, are trademarks or registered trademarks of Oracle in the United States, other countries or both. Other company, product and service names may be trademarks or service marks of others. THE INFORMATION DISCUSSED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY. WHILE EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION, IT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, AND IBM SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, SUCH INFORMATION. ANY INFORMATION CONCERNING IBM'S PRODUCT PLANS OR STRATEGY IS SUBJECT TO CHANGE BY IBM WITHOUT NOTICE.