SlideShare una empresa de Scribd logo
1 de 67
Descargar para leer sin conexión
1
JIT-compiler in JVM
seen by a Java developer
Vladimir Ivanov
HotSpot JVM Compiler
Oracle Corp.
2
Agenda
§  about compilers in general
–  … and JIT-compilers in particular
§  about JIT-compilers in HotSpot JVM
§  monitoring JIT-compilers in HotSpot JVM
3
Static vs Dynamic
AOT vs JIT
4
Dynamic and Static Compilation Differences
§  Static compilation
–  “ahead-of-time”(AOT) compilation
–  Source code → Native executable
–  Most of compilation work happens before executing
§  Modern Java VMs use dynamic compilers (JIT)
–  “just-in-time” (JIT) compilation
–  Source code → Bytecode → Interpreter + JITted executable
–  Most of compilation work happens during executing
5
Dynamic and Static Compilation Differences
§  Static compilation (AOT)
–  can utilize complex and heavy analyses and optimizations
–  … but static information sometimes isn’t enough
–  … and it’s hard to rely on profiling info, if any
–  moreover, how to utilize specific platform features (like SSE 4.2)?
6
Dynamic and Static Compilation Differences
§  Modern Java VMs use dynamic compilers (JIT)
–  aggressive optimistic optimizations
§  through extensive usage of profiling info
–  … but budget is limited and shared with an application
–  startup speed suffers
–  peak performance may suffer as well (not necessary)
7
JIT-compilation
§  Just-In-Time compilation
§  Compiled when needed
§  Maybe immediately before execution
–  ...or when we decide it’s important
–  ...or never?
8
Dynamic Compilation
in JVM
9
JVM
§  Runtime
–  class loading, bytecode verification, synchronization
§  JIT
–  profiling, compilation plans, OSR
–  aggressive optimizations
§  GC
–  different algorithms: throughput vs. response time
10
JVM: Makes Bytecodes Fast
§  JVMs eventually JIT bytecodes
–  To make them fast
–  Some JITs are high quality optimizing compilers
§  But cannot use existing static compilers directly:
–  Tracking OOPs (ptrs) for GC
–  Java Memory Model (volatile reordering & fences)
–  New code patterns to optimize
–  Time & resource constraints (CPU, memory)
11
JVM: Makes Bytecodes Fast
§  JIT'ing requires Profiling
–  Because you don't want to JIT everything
§  Profiling allows focused code-gen
§  Profiling allows better code-gen
–  Inline what’s hot
–  Loop unrolling, range-check elimination, etc
–  Branch prediction, spill-code-gen, scheduling
12
Dynamic Compilation (JIT)
§  Knows about
–  loaded classes, methods the program has executed
§  Makes optimization decisions based on code paths executed
–  Code generation depends on what is observed:
§  loaded classes, code paths executed, branches taken
§  May re-optimize if assumption was wrong, or alternative code paths
taken
–  Instruction path length may change between invocations of methods as a
result of de-optimization / re-compilation
13
Dynamic Compilation (JIT)
§  Can do non-conservative optimizations in dynamic
§  Separates optimization from product delivery cycle
–  Update JVM, run the same application, realize improved performance!
–  Can be "tuned" to the target platform
14
Profiling
§  Gathers data about code during execution
–  invariants
§  types, constants (e.g. null pointers)
–  statistics
§  branches, calls
§  Gathered data is used during optimization
–  Educated guess
–  Guess can be wrong
15
Profile-guided optimization (PGO)
§  Use profile for more efficient optimization
§  PGO in JVMs
–  Always have it, turned on by default
–  Developers (usually) not interested or concerned about it
–  Profile is always consistent to execution scenario
16
Optimistic Compilers
§  Assume profile is accurate
–  Aggressively optimize based on profile
–  Bail out if we’re wrong
§  ...and hope that we’re usually right
17
Dynamic Compilation (JIT)
§  Is dynamic compilation overhead essential?
–  The longer your application runs, the less the overhead
§  Trading off compilation time, not application time
–  Steal some cycles very early in execution
–  Done automagically and transparently to application
§  Most of “perceived” overhead is compiler waiting for more data
–  ...thus running semi-optimal code for time being
Overhead
18
JVM
Author: Alexey Shipilev
19
Mixed-Mode Execution
§  Interpreted
–  Bytecode-walking
–  Artificial stack machine
§  Compiled
–  Direct native operations
–  Native register machine
20
Bytecode Execution
1 2
34
Interpretation Profiling
Dynamic
Compilation
Deoptimization
21
Deoptimization
§  Bail out of running native code
–  stop executing native (JIT-generated) code
–  start interpreting bytecode
§  It’s a complicated operation at runtime…
22
OSR: On-Stack Replacement
§  Running method never exits?
§  But it’s getting really hot?
§  Generally means loops, back-branching
§  Compile and replace while running
§  Not typically useful in large systems
§  Looks great on benchmarks!
23
Optimizations
24
Optimizations in HotSpot JVM
§  compiler tactics
delayed compilation
tiered compilation
on-stack replacement
delayed reoptimization
program dependence graph rep.
static single assignment rep.
§  proof-based techniques
exact type inference
memory value inference
memory value tracking
constant folding
reassociation
operator strength reduction
null check elimination
type test strength reduction
type test elimination
algebraic simplification
common subexpression elimination
integer range typing
§  flow-sensitive rewrites
conditional constant propagation
dominating test detection
flow-carried type narrowing
dead code elimination
§  language-specific techniques
class hierarchy analysis
devirtualization
symbolic constant propagation
autobox elimination
escape analysis
lock elision
lock fusion
de-reflection
§  speculative (profile-based) techniques
optimistic nullness assertions
optimistic type assertions
optimistic type strengthening
optimistic array length strengthening
untaken branch pruning
optimistic N-morphic inlining
branch frequency prediction
call frequency prediction
§  memory and placement transformation
expression hoisting
expression sinking
redundant store elimination
adjacent store fusion
card-mark elimination
merge-point splitting
§  loop transformations
loop unrolling
loop peeling
safepoint elimination
iteration range splitting
range check elimination
loop vectorization
§  global code shaping
inlining (graph integration)
global code motion
heat-based code layout
switch balancing
throw inlining
§  control flow graph transformation
local code scheduling
local code bundling
delay slot filling
graph-coloring register allocation
linear scan register allocation
live range splitting
copy coalescing
constant splitting
copy removal
address mode matching
instruction peepholing
DFA-based code generator
25
JVM: Makes Virtual Calls Fast
§  C++ avoids virtual calls – because they are slow
§  Java embraces them – and makes them fast
–  Well, mostly fast – JIT's do Class Hierarchy Analysis (CHA)
–  CHA turns most virtual calls into static calls
–  JVM detects new classes loaded, adjusts CHA
§  May need to re-JIT
–  When CHA fails to make the call static, inline caches
–  When IC's fail, virtual calls are back to being slow
26
Call Site
§  The place where you make a call
§  Monomorphic (“one shape”)
–  Single target class
§  Bimorphic (“two shapes”)
§  Polymorphic (“many shapes”)
§  Megamorphic
27
Inlining
§  Combine caller and callee into one unit
–  e.g.based on profile
–  … or prove smth using CHA (Class Hierarchy Analysis)
–  Perhaps with a guard/test
§  Optimize as a whole
–  More code means better visibility
28
Inlining
int addAll(int max) {
int accum = 0;
for (int i = 0; i < max; i++) {
accum = add(accum, i);
}
return accum;
}
int add(int a, int b) { return a + b; }
29
Inlining
int addAll(int max) {
int accum = 0;
for (int i = 0; i < max; i++) {
accum = accum + i;
}
return accum;
}
30
Inlining and devirtualization
§  Inlining is the most profitable compiler optimization
–  Rather straightforward to implement
–  Huge benefits: expands the scope for other optimizations
§  OOP needs polymorphism, that implies virtual calls
–  Prevents naïve inlining
–  Devirtualization is required
–  (This does not mean you should not write OOP code)
31
JVM Devirtualization
§  Developers shouldn't care
§  Analyze hierarchy of currently loaded classes
§  Efficiently devirtualize all monomorphic calls
§  Able to devirtualize polymorphic calls
§  JVM may inline dynamic methods
–  Reflection calls
–  Runtime-synthesized methods
–  JSR 292
32
Feedback multiplies optimizations
§  On-line profiling and CHA produces information
–  ...which lets the JIT ignore unused paths
–  ...and helps the JIT sharpen types on hot paths
–  ...which allows calls to be devirtualized
–  ...allowing them to be inlined
–  ...expanding an ever-widening optimization horizon
§  Result:
Large native methods containing tightly optimized machine code for
hundreds of inlined calls!
33
Loop unrolling
public void foo(int[] arr, int a) {
for (int i = 0; i < arr.length; i++) {
arr[i] += a;
}
}
34
Loop unrolling
public void foo(int[] arr, int a) {
for (int i = 0; i < arr.length; i=i+4) {
arr[i] += a; arr[i+1] += a; arr[i+2] += a; arr[i+3] += a;
}
}
35
Loop unrolling
public void foo(int[] arr, int a) {
int new_limit = arr.length / 4;
for (int i = 0; i < new_limit; i++) {
arr[4*i] += a; arr[4*i+1] += a; arr[4*i+2] += a; arr[4*i+3] += a;
}
for (int i = new_limit*4; i < arr.length; i++) {
arr[i] += a;
}}
36
Lock Coarsening
pubic void m1(Object newValue) {
syncronized(this) {
field1 = newValue;
}
syncronized(this) {
field2 = newValue;
}
}
37
Lock Coarsening
pubic void m1(Object newValue) {
syncronized(this) {
field1 = newValue;
field2 = newValue;
}
}
38
Lock Eliding
public void m1() {
List list = new ArrayList();
synchronized (list) {
list.add(someMethod());
}
}
39
Lock Eliding
public void m1() {
List list = new ArrayList();
synchronized (list) {
list.add(someMethod());
}
}
40
Lock Eliding
public void m1() {
List list = new ArrayList();
list.add(someMethod());
}
41
Escape Analysis
public int m1() {
Pair p = new Pair(1, 2);
return m2(p);
}
public int m2(Pair p) {
return p.first + m3(p);
}
public int m3(Pair p) { return p.second;}
Initial version
42
Escape Analysis
public int m1() {
Pair p = new Pair(1, 2);
return p.first + p.second;
}
After deep inlining
43
Escape Analysis
public int m1() {
return 3;
}
Optimized version
44
Intrinsic
§  Known to the JIT compiler
–  method bytecode is ignored
–  inserts “best” native code
§  e.g. optimized sqrt in machine code
§  Existing intrinsics
–  String::equals, Math::*, System::arraycopy, Object::hashCode,
Object::getClass, sun.misc.Unsafe::*
45
HotSpot JVM
46
JVMs
§  Oracle HotSpot
§  IBM J9
§  Oracle JRockit
§  Azul Zing
§  Excelsior JET
§  Jikes RVM
47
HotSpot JVM
§  client / C1
§  server / C2
§  tiered mode (C1 + C2)
JIT-compilers
48
HotSpot JVM
§  client / C1
–  $ java –client
§  only available in 32-bit VM
–  fast code generation of acceptable quality
–  basic optimizations
–  doesn’t need profile
–  compilation threshold: 1,5k invocations
JIT-compilers
49
HotSpot JVM
§  server / C2
–  $ java –server
–  highly optimized code for speed
–  many aggressive optimizations which rely on profile
–  compilation threshold: 10k invocations
JIT-compilers
50
HotSpot JVM
§  Client / C1
+ fast startup
–  peak performance suffers
§  Server / C2
+ very good code for hot methods
–  slow startup / warmup
JIT-compilers comparison
51
Tiered compilation
§  -XX:+TieredCompilation
§  Multiple tiers of interpretation, C1, and C2
§  Level0=Interpreter
§  Level1-3=C1
–  #1: C1 w/o profiling
–  #2: C1 w/ basic profiling
–  #3: C1 w/ full profiling
§  Level4=C2
C1 + C2
52
Monitoring JIT
53
Monitoring JIT-Compiler
§  how to print info about compiled methods?
–  -XX:+PrintCompilation
§  how to print info about inlining decisions
–  -XX:+PrintInlining
§  how to control compilation policy?
–  -XX:CompileCommand=…
§  how to print assembly code?
–  -XX:+PrintAssembly
–  -XX:+PrintOptoAssembly (C2-only)
54
Print Compilation
§  -XX:+PrintCompilation
§  Print methods as they are JIT-compiled
§  Class + name + size
55
Print Compilation
$ java -XX:+PrintCompilation
988 1 java.lang.String::hashCode (55 bytes)
1271 2 sun.nio.cs.UTF_8$Encoder::encode (361 bytes)
1406 3 java.lang.String::charAt (29 bytes)
Sample output
56
Print Compilation
§  2043 470 % ! jdk.nashorn.internal.ir.FunctionNode::accept @ 136 (265 bytes)
% == OSR compilation
! == has exception handles (may be expensive)
s == synchronized method
§  2028 466 n java.lang.Class::isArray (native)
n == native method
Other useful info
57
Print Compilation
§  621 160 java.lang.Object::equals (11 bytes) made not entrant
–  don‘t allow any new calls into this compiled version
§  1807 160 java.lang.Object::equals (11 bytes) made zombie
–  can safely throw away compiled version
Not just compilation notifications
58
No JIT At All?
§  Code is too large
§  Code isn’t too «hot»
–  executed not too often
59
Print Inlining
§  -XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining
§  Shows hierarchy of inlined methods
§  Prints reason, if a method isn’t inlined
60
Print Inlining
$ java -XX:+PrintCompilation -XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining
75 1 java.lang.String::hashCode (55 bytes)
88 2 sun.nio.cs.UTF_8$Encoder::encode (361 bytes)
@ 14 java.lang.Math::min (11 bytes) (intrinsic)
@ 139 java.lang.Character::isSurrogate (18 bytes) never executed
103 3 java.lang.String::charAt (29 bytes)
61
Inlining Tuning
§  -XX:MaxInlineSize=35
–  Largest inlinable method (bytecode)
§  -XX:InlineSmallCode=#
–  Largest inlinable compiled method
§  -XX:FreqInlineSize=#
–  Largest frequently-called method…
§  -XX:MaxInlineLevel=9
–  How deep does the rabbit hole go?
§  -XX:MaxRecursiveInlineLevel=#
–  recursive inlining
62
Machine Code
§  -XX:+PrintAssembly
§  http://wikis.sun.com/display/HotSpotInternals/PrintAssembly
§  Knowing code compiles is good
§  Knowing code inlines is better
§  Seeing the actual assembly is best!
63
-XX:CompileCommand=
§  Syntax
–  “[command] [method] [signature]”
§  Supported commands
–  exclude – never compile
–  inline – always inline
–  dontinline – never inline
§  Method reference
–  class.name::methodName
§  Method signature is optional
64
What Have We Learned?
§  How JIT compilers work
§  How HotSpot’s JIT works
§  How to monitor the JIT in HotSpot
65
“Quantum Performance Effects”
Sergey Kuksenko, Oracle
today, 13:30-14:30, «San-Francisco» hall
“Bulletproof Java Concurrency”
Aleksey Shipilev, Oracle
today, 15:30-16:30, «Moscow» hall
Related Talks
66
Questions?
vladimir.x.ivanov@oracle.com
@iwanowww
67
Graphic Section Divider

Más contenido relacionado

La actualidad más candente

Java Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug ClassJava Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug ClassCODE WHITE GmbH
 
Tiered Compilation in Hotspot JVM
Tiered Compilation in Hotspot JVMTiered Compilation in Hotspot JVM
Tiered Compilation in Hotspot JVMIgor Veresov
 
JVM @ Taobao - QCon Hangzhou 2011
JVM @ Taobao - QCon Hangzhou 2011JVM @ Taobao - QCon Hangzhou 2011
JVM @ Taobao - QCon Hangzhou 2011Kris Mok
 
Instruction Combine in LLVM
Instruction Combine in LLVMInstruction Combine in LLVM
Instruction Combine in LLVMWang Hsiangkai
 
A whirlwind tour of the LLVM optimizer
A whirlwind tour of the LLVM optimizerA whirlwind tour of the LLVM optimizer
A whirlwind tour of the LLVM optimizerNikita Popov
 
Data oriented design and c++
Data oriented design and c++Data oriented design and c++
Data oriented design and c++Mike Acton
 
LLVM Instruction Selection
LLVM Instruction SelectionLLVM Instruction Selection
LLVM Instruction SelectionShiva Chen
 
Advanced Reflection in Java
Advanced Reflection in JavaAdvanced Reflection in Java
Advanced Reflection in Javakim.mens
 
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
 
Deep dive into Coroutines on JVM @ KotlinConf 2017
Deep dive into Coroutines on JVM @ KotlinConf 2017Deep dive into Coroutines on JVM @ KotlinConf 2017
Deep dive into Coroutines on JVM @ KotlinConf 2017Roman Elizarov
 
Being Functional on Reactive Streams with Spring Reactor
Being Functional on Reactive Streams with Spring ReactorBeing Functional on Reactive Streams with Spring Reactor
Being Functional on Reactive Streams with Spring ReactorMax Huang
 
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016Christian Schneider
 
JavaScript Event Loop
JavaScript Event LoopJavaScript Event Loop
JavaScript Event LoopDesignveloper
 
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...joaomatosf_
 
Java tricks for high-load server programming
Java tricks for high-load server programmingJava tricks for high-load server programming
Java tricks for high-load server programmingAndrei Pangin
 
The Performance Engineer's Guide To HotSpot Just-in-Time Compilation
The Performance Engineer's Guide To HotSpot Just-in-Time CompilationThe Performance Engineer's Guide To HotSpot Just-in-Time Compilation
The Performance Engineer's Guide To HotSpot Just-in-Time CompilationMonica Beckwith
 
Java SE 8 lambdaで変わる プログラミングスタイル
Java SE 8 lambdaで変わる プログラミングスタイルJava SE 8 lambdaで変わる プログラミングスタイル
Java SE 8 lambdaで変わる プログラミングスタイルなおき きしだ
 

La actualidad más candente (20)

Java Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug ClassJava Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug Class
 
Tiered Compilation in Hotspot JVM
Tiered Compilation in Hotspot JVMTiered Compilation in Hotspot JVM
Tiered Compilation in Hotspot JVM
 
JVM @ Taobao - QCon Hangzhou 2011
JVM @ Taobao - QCon Hangzhou 2011JVM @ Taobao - QCon Hangzhou 2011
JVM @ Taobao - QCon Hangzhou 2011
 
Instruction Combine in LLVM
Instruction Combine in LLVMInstruction Combine in LLVM
Instruction Combine in LLVM
 
A whirlwind tour of the LLVM optimizer
A whirlwind tour of the LLVM optimizerA whirlwind tour of the LLVM optimizer
A whirlwind tour of the LLVM optimizer
 
Data oriented design and c++
Data oriented design and c++Data oriented design and c++
Data oriented design and c++
 
Qemu JIT Code Generator and System Emulation
Qemu JIT Code Generator and System EmulationQemu JIT Code Generator and System Emulation
Qemu JIT Code Generator and System Emulation
 
LLVM Instruction Selection
LLVM Instruction SelectionLLVM Instruction Selection
LLVM Instruction Selection
 
Advanced Reflection in Java
Advanced Reflection in JavaAdvanced Reflection in Java
Advanced Reflection in Java
 
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
 
Deep dive into Coroutines on JVM @ KotlinConf 2017
Deep dive into Coroutines on JVM @ KotlinConf 2017Deep dive into Coroutines on JVM @ KotlinConf 2017
Deep dive into Coroutines on JVM @ KotlinConf 2017
 
Being Functional on Reactive Streams with Spring Reactor
Being Functional on Reactive Streams with Spring ReactorBeing Functional on Reactive Streams with Spring Reactor
Being Functional on Reactive Streams with Spring Reactor
 
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
 
Introduction to Data Oriented Design
Introduction to Data Oriented DesignIntroduction to Data Oriented Design
Introduction to Data Oriented Design
 
JavaScript Event Loop
JavaScript Event LoopJavaScript Event Loop
JavaScript Event Loop
 
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
 
Java tricks for high-load server programming
Java tricks for high-load server programmingJava tricks for high-load server programming
Java tricks for high-load server programming
 
The Performance Engineer's Guide To HotSpot Just-in-Time Compilation
The Performance Engineer's Guide To HotSpot Just-in-Time CompilationThe Performance Engineer's Guide To HotSpot Just-in-Time Compilation
The Performance Engineer's Guide To HotSpot Just-in-Time Compilation
 
JVM Under The Hood WDI.pdf
JVM Under The Hood WDI.pdfJVM Under The Hood WDI.pdf
JVM Under The Hood WDI.pdf
 
Java SE 8 lambdaで変わる プログラミングスタイル
Java SE 8 lambdaで変わる プログラミングスタイルJava SE 8 lambdaで変わる プログラミングスタイル
Java SE 8 lambdaで変わる プログラミングスタイル
 

Destacado

just in time JIT compiler
just in time JIT compilerjust in time JIT compiler
just in time JIT compilerMohit kumar
 
"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine
"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine
"JIT compiler overview" @ JEEConf 2013, Kiev, UkraineVladimir Ivanov
 
Jit complier
Jit complierJit complier
Jit complierKaya Ota
 
JIT-компиляция в виртуальной машине Java (HighLoad++ 2013)
JIT-компиляция в виртуальной машине Java (HighLoad++ 2013)JIT-компиляция в виртуальной машине Java (HighLoad++ 2013)
JIT-компиляция в виртуальной машине Java (HighLoad++ 2013)aragozin
 
Владимир Иванов. JIT для Java разработчиков
Владимир Иванов. JIT для Java разработчиковВладимир Иванов. JIT для Java разработчиков
Владимир Иванов. JIT для Java разработчиковVolha Banadyseva
 
JIT Soultions: Overview
 JIT Soultions: Overview JIT Soultions: Overview
JIT Soultions: OverviewJIT Solutions
 
Game of Performance: A Song of JIT and GC
Game of Performance: A Song of JIT and GCGame of Performance: A Song of JIT and GC
Game of Performance: A Song of JIT and GCMonica Beckwith
 
The Performance Engineer's Guide To (OpenJDK) HotSpot Garbage Collection - Th...
The Performance Engineer's Guide To (OpenJDK) HotSpot Garbage Collection - Th...The Performance Engineer's Guide To (OpenJDK) HotSpot Garbage Collection - Th...
The Performance Engineer's Guide To (OpenJDK) HotSpot Garbage Collection - Th...Monica Beckwith
 
Under the Hood of the Testarossa JIT Compiler
Under the Hood of the Testarossa JIT CompilerUnder the Hood of the Testarossa JIT Compiler
Under the Hood of the Testarossa JIT CompilerMark Stoodley
 
JFokus Java 9 contended locking performance
JFokus Java 9 contended locking performanceJFokus Java 9 contended locking performance
JFokus Java 9 contended locking performanceMonica Beckwith
 
Java Performance Engineer's Survival Guide
Java Performance Engineer's Survival GuideJava Performance Engineer's Survival Guide
Java Performance Engineer's Survival GuideMonica Beckwith
 
Implementing a JavaScript Engine
Implementing a JavaScript EngineImplementing a JavaScript Engine
Implementing a JavaScript EngineKris Mok
 
淺談編譯器最佳化技術
淺談編譯器最佳化技術淺談編譯器最佳化技術
淺談編譯器最佳化技術Kito Cheng
 
Java 9: The (G1) GC Awakens!
Java 9: The (G1) GC Awakens!Java 9: The (G1) GC Awakens!
Java 9: The (G1) GC Awakens!Monica Beckwith
 

Destacado (20)

just in time JIT compiler
just in time JIT compilerjust in time JIT compiler
just in time JIT compiler
 
"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine
"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine
"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine
 
Jit complier
Jit complierJit complier
Jit complier
 
Presto@Uber
Presto@UberPresto@Uber
Presto@Uber
 
JIT-компиляция в виртуальной машине Java (HighLoad++ 2013)
JIT-компиляция в виртуальной машине Java (HighLoad++ 2013)JIT-компиляция в виртуальной машине Java (HighLoad++ 2013)
JIT-компиляция в виртуальной машине Java (HighLoad++ 2013)
 
Владимир Иванов. JIT для Java разработчиков
Владимир Иванов. JIT для Java разработчиковВладимир Иванов. JIT для Java разработчиков
Владимир Иванов. JIT для Java разработчиков
 
JIT Soultions: Overview
 JIT Soultions: Overview JIT Soultions: Overview
JIT Soultions: Overview
 
Game of Performance: A Song of JIT and GC
Game of Performance: A Song of JIT and GCGame of Performance: A Song of JIT and GC
Game of Performance: A Song of JIT and GC
 
The Performance Engineer's Guide To (OpenJDK) HotSpot Garbage Collection - Th...
The Performance Engineer's Guide To (OpenJDK) HotSpot Garbage Collection - Th...The Performance Engineer's Guide To (OpenJDK) HotSpot Garbage Collection - Th...
The Performance Engineer's Guide To (OpenJDK) HotSpot Garbage Collection - Th...
 
Under the Hood of the Testarossa JIT Compiler
Under the Hood of the Testarossa JIT CompilerUnder the Hood of the Testarossa JIT Compiler
Under the Hood of the Testarossa JIT Compiler
 
JFokus Java 9 contended locking performance
JFokus Java 9 contended locking performanceJFokus Java 9 contended locking performance
JFokus Java 9 contended locking performance
 
Java Performance Engineer's Survival Guide
Java Performance Engineer's Survival GuideJava Performance Engineer's Survival Guide
Java Performance Engineer's Survival Guide
 
Build Programming Language Runtime with LLVM
Build Programming Language Runtime with LLVMBuild Programming Language Runtime with LLVM
Build Programming Language Runtime with LLVM
 
Implementing a JavaScript Engine
Implementing a JavaScript EngineImplementing a JavaScript Engine
Implementing a JavaScript Engine
 
淺談編譯器最佳化技術
淺談編譯器最佳化技術淺談編譯器最佳化技術
淺談編譯器最佳化技術
 
Jit
JitJit
Jit
 
from Source to Binary: How GNU Toolchain Works
from Source to Binary: How GNU Toolchain Worksfrom Source to Binary: How GNU Toolchain Works
from Source to Binary: How GNU Toolchain Works
 
Java 9: The (G1) GC Awakens!
Java 9: The (G1) GC Awakens!Java 9: The (G1) GC Awakens!
Java 9: The (G1) GC Awakens!
 
Interpreter, Compiler, JIT from scratch
Interpreter, Compiler, JIT from scratchInterpreter, Compiler, JIT from scratch
Interpreter, Compiler, JIT from scratch
 
Just In Time (JIT) Systems
Just In Time (JIT) SystemsJust In Time (JIT) Systems
Just In Time (JIT) Systems
 

Similar a JVM JIT-compiler overview @ JavaOne Moscow 2013

Java Jit. Compilation and optimization by Andrey Kovalenko
Java Jit. Compilation and optimization by Andrey KovalenkoJava Jit. Compilation and optimization by Andrey Kovalenko
Java Jit. Compilation and optimization by Andrey KovalenkoValeriia Maliarenko
 
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.J On The Beach
 
Apache Big Data Europe 2016
Apache Big Data Europe 2016Apache Big Data Europe 2016
Apache Big Data Europe 2016Tim Ellison
 
A Java Implementer's Guide to Better Apache Spark Performance
A Java Implementer's Guide to Better Apache Spark PerformanceA Java Implementer's Guide to Better Apache Spark Performance
A Java Implementer's Guide to Better Apache Spark PerformanceTim Ellison
 
Five cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark fasterFive cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark fasterTim Ellison
 
Cloud Native Compiler
Cloud Native CompilerCloud Native Compiler
Cloud Native CompilerSimon Ritter
 
White and Black Magic on the JVM
White and Black Magic on the JVMWhite and Black Magic on the JVM
White and Black Magic on the JVMIvaylo Pashov
 
Scala & Spark(1.6) in Performance Aspect for Scala Taiwan
Scala & Spark(1.6) in Performance Aspect for Scala TaiwanScala & Spark(1.6) in Performance Aspect for Scala Taiwan
Scala & Spark(1.6) in Performance Aspect for Scala TaiwanJimin Hsieh
 
New hope is comming? Project Loom.pdf
New hope is comming? Project Loom.pdfNew hope is comming? Project Loom.pdf
New hope is comming? Project Loom.pdfKrystian Zybała
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance Tunningguest1f2740
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance TunningTerry Cho
 
Building a Better JVM
Building a Better JVMBuilding a Better JVM
Building a Better JVMSimon Ritter
 
The Diabolical Developers Guide to Performance Tuning
The Diabolical Developers Guide to Performance TuningThe Diabolical Developers Guide to Performance Tuning
The Diabolical Developers Guide to Performance TuningjClarity
 
Clr jvm implementation differences
Clr jvm implementation differencesClr jvm implementation differences
Clr jvm implementation differencesJean-Philippe BEMPEL
 
Towards "write once - run whenever possible" with Safety Critical Java af Ben...
Towards "write once - run whenever possible" with Safety Critical Java af Ben...Towards "write once - run whenever possible" with Safety Critical Java af Ben...
Towards "write once - run whenever possible" with Safety Critical Java af Ben...InfinIT - Innovationsnetværket for it
 
Groovy In the Cloud
Groovy In the CloudGroovy In the Cloud
Groovy In the CloudJim Driscoll
 
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...srisatish ambati
 
FOSDEM 2017 - Open J9 The Next Free Java VM
FOSDEM 2017 - Open J9 The Next Free Java VMFOSDEM 2017 - Open J9 The Next Free Java VM
FOSDEM 2017 - Open J9 The Next Free Java VMCharlie Gracie
 
Jvm problem diagnostics
Jvm problem diagnosticsJvm problem diagnostics
Jvm problem diagnosticsDanijel Mitar
 

Similar a JVM JIT-compiler overview @ JavaOne Moscow 2013 (20)

Java Jit. Compilation and optimization by Andrey Kovalenko
Java Jit. Compilation and optimization by Andrey KovalenkoJava Jit. Compilation and optimization by Andrey Kovalenko
Java Jit. Compilation and optimization by Andrey Kovalenko
 
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.
 
Apache Big Data Europe 2016
Apache Big Data Europe 2016Apache Big Data Europe 2016
Apache Big Data Europe 2016
 
A Java Implementer's Guide to Better Apache Spark Performance
A Java Implementer's Guide to Better Apache Spark PerformanceA Java Implementer's Guide to Better Apache Spark Performance
A Java Implementer's Guide to Better Apache Spark Performance
 
Five cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark fasterFive cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark faster
 
Cloud Native Compiler
Cloud Native CompilerCloud Native Compiler
Cloud Native Compiler
 
White and Black Magic on the JVM
White and Black Magic on the JVMWhite and Black Magic on the JVM
White and Black Magic on the JVM
 
Scala & Spark(1.6) in Performance Aspect for Scala Taiwan
Scala & Spark(1.6) in Performance Aspect for Scala TaiwanScala & Spark(1.6) in Performance Aspect for Scala Taiwan
Scala & Spark(1.6) in Performance Aspect for Scala Taiwan
 
New hope is comming? Project Loom.pdf
New hope is comming? Project Loom.pdfNew hope is comming? Project Loom.pdf
New hope is comming? Project Loom.pdf
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance Tunning
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance Tunning
 
Building a Better JVM
Building a Better JVMBuilding a Better JVM
Building a Better JVM
 
The Diabolical Developers Guide to Performance Tuning
The Diabolical Developers Guide to Performance TuningThe Diabolical Developers Guide to Performance Tuning
The Diabolical Developers Guide to Performance Tuning
 
Clr jvm implementation differences
Clr jvm implementation differencesClr jvm implementation differences
Clr jvm implementation differences
 
Towards "write once - run whenever possible" with Safety Critical Java af Ben...
Towards "write once - run whenever possible" with Safety Critical Java af Ben...Towards "write once - run whenever possible" with Safety Critical Java af Ben...
Towards "write once - run whenever possible" with Safety Critical Java af Ben...
 
Groovy In the Cloud
Groovy In the CloudGroovy In the Cloud
Groovy In the Cloud
 
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
 
FOSDEM 2017 - Open J9 The Next Free Java VM
FOSDEM 2017 - Open J9 The Next Free Java VMFOSDEM 2017 - Open J9 The Next Free Java VM
FOSDEM 2017 - Open J9 The Next Free Java VM
 
Java Memory Model
Java Memory ModelJava Memory Model
Java Memory Model
 
Jvm problem diagnostics
Jvm problem diagnosticsJvm problem diagnostics
Jvm problem diagnostics
 

Más de Vladimir Ivanov

"What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia
"What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia "What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia
"What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia Vladimir Ivanov
 
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,..."Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...Vladimir Ivanov
 
"Optimizing Memory Footprint in Java" @ JEEConf 2013, Kiev, Ukraine
"Optimizing Memory Footprint in Java" @ JEEConf 2013, Kiev, Ukraine "Optimizing Memory Footprint in Java" @ JEEConf 2013, Kiev, Ukraine
"Optimizing Memory Footprint in Java" @ JEEConf 2013, Kiev, Ukraine Vladimir Ivanov
 
"Invokedynamic: роскошь или необходимость?"@ JavaOne Moscow 2013
"Invokedynamic: роскошь или необходимость?"@ JavaOne Moscow 2013"Invokedynamic: роскошь или необходимость?"@ JavaOne Moscow 2013
"Invokedynamic: роскошь или необходимость?"@ JavaOne Moscow 2013Vladimir Ivanov
 
"G1 GC и Обзор сборки мусора в HotSpot JVM" @ JUG SPb, 31-05-2012
"G1 GC и Обзор сборки мусора в HotSpot JVM" @ JUG SPb, 31-05-2012"G1 GC и Обзор сборки мусора в HotSpot JVM" @ JUG SPb, 31-05-2012
"G1 GC и Обзор сборки мусора в HotSpot JVM" @ JUG SPb, 31-05-2012Vladimir Ivanov
 
Управление памятью в Java: Footprint
Управление памятью в Java: FootprintУправление памятью в Java: Footprint
Управление памятью в Java: FootprintVladimir Ivanov
 
Многоуровневая компиляция в HotSpot JVM
Многоуровневая компиляция в HotSpot JVMМногоуровневая компиляция в HotSpot JVM
Многоуровневая компиляция в HotSpot JVMVladimir Ivanov
 
G1 GC: Garbage-First Garbage Collector
G1 GC: Garbage-First Garbage CollectorG1 GC: Garbage-First Garbage Collector
G1 GC: Garbage-First Garbage CollectorVladimir Ivanov
 
"Диагностирование проблем и настройка GC в HotSpot JVM" (JEEConf, Киев, 2011)
"Диагностирование проблем и настройка GC в HotSpot JVM" (JEEConf, Киев, 2011)"Диагностирование проблем и настройка GC в HotSpot JVM" (JEEConf, Киев, 2011)
"Диагностирование проблем и настройка GC в HotSpot JVM" (JEEConf, Киев, 2011)Vladimir Ivanov
 

Más de Vladimir Ivanov (9)

"What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia
"What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia "What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia
"What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia
 
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,..."Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...
 
"Optimizing Memory Footprint in Java" @ JEEConf 2013, Kiev, Ukraine
"Optimizing Memory Footprint in Java" @ JEEConf 2013, Kiev, Ukraine "Optimizing Memory Footprint in Java" @ JEEConf 2013, Kiev, Ukraine
"Optimizing Memory Footprint in Java" @ JEEConf 2013, Kiev, Ukraine
 
"Invokedynamic: роскошь или необходимость?"@ JavaOne Moscow 2013
"Invokedynamic: роскошь или необходимость?"@ JavaOne Moscow 2013"Invokedynamic: роскошь или необходимость?"@ JavaOne Moscow 2013
"Invokedynamic: роскошь или необходимость?"@ JavaOne Moscow 2013
 
"G1 GC и Обзор сборки мусора в HotSpot JVM" @ JUG SPb, 31-05-2012
"G1 GC и Обзор сборки мусора в HotSpot JVM" @ JUG SPb, 31-05-2012"G1 GC и Обзор сборки мусора в HotSpot JVM" @ JUG SPb, 31-05-2012
"G1 GC и Обзор сборки мусора в HotSpot JVM" @ JUG SPb, 31-05-2012
 
Управление памятью в Java: Footprint
Управление памятью в Java: FootprintУправление памятью в Java: Footprint
Управление памятью в Java: Footprint
 
Многоуровневая компиляция в HotSpot JVM
Многоуровневая компиляция в HotSpot JVMМногоуровневая компиляция в HotSpot JVM
Многоуровневая компиляция в HotSpot JVM
 
G1 GC: Garbage-First Garbage Collector
G1 GC: Garbage-First Garbage CollectorG1 GC: Garbage-First Garbage Collector
G1 GC: Garbage-First Garbage Collector
 
"Диагностирование проблем и настройка GC в HotSpot JVM" (JEEConf, Киев, 2011)
"Диагностирование проблем и настройка GC в HotSpot JVM" (JEEConf, Киев, 2011)"Диагностирование проблем и настройка GC в HotSpot JVM" (JEEConf, Киев, 2011)
"Диагностирование проблем и настройка GC в HotSpot JVM" (JEEConf, Киев, 2011)
 

Último

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 

Último (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 

JVM JIT-compiler overview @ JavaOne Moscow 2013

  • 1. 1 JIT-compiler in JVM seen by a Java developer Vladimir Ivanov HotSpot JVM Compiler Oracle Corp.
  • 2. 2 Agenda §  about compilers in general –  … and JIT-compilers in particular §  about JIT-compilers in HotSpot JVM §  monitoring JIT-compilers in HotSpot JVM
  • 4. 4 Dynamic and Static Compilation Differences §  Static compilation –  “ahead-of-time”(AOT) compilation –  Source code → Native executable –  Most of compilation work happens before executing §  Modern Java VMs use dynamic compilers (JIT) –  “just-in-time” (JIT) compilation –  Source code → Bytecode → Interpreter + JITted executable –  Most of compilation work happens during executing
  • 5. 5 Dynamic and Static Compilation Differences §  Static compilation (AOT) –  can utilize complex and heavy analyses and optimizations –  … but static information sometimes isn’t enough –  … and it’s hard to rely on profiling info, if any –  moreover, how to utilize specific platform features (like SSE 4.2)?
  • 6. 6 Dynamic and Static Compilation Differences §  Modern Java VMs use dynamic compilers (JIT) –  aggressive optimistic optimizations §  through extensive usage of profiling info –  … but budget is limited and shared with an application –  startup speed suffers –  peak performance may suffer as well (not necessary)
  • 7. 7 JIT-compilation §  Just-In-Time compilation §  Compiled when needed §  Maybe immediately before execution –  ...or when we decide it’s important –  ...or never?
  • 9. 9 JVM §  Runtime –  class loading, bytecode verification, synchronization §  JIT –  profiling, compilation plans, OSR –  aggressive optimizations §  GC –  different algorithms: throughput vs. response time
  • 10. 10 JVM: Makes Bytecodes Fast §  JVMs eventually JIT bytecodes –  To make them fast –  Some JITs are high quality optimizing compilers §  But cannot use existing static compilers directly: –  Tracking OOPs (ptrs) for GC –  Java Memory Model (volatile reordering & fences) –  New code patterns to optimize –  Time & resource constraints (CPU, memory)
  • 11. 11 JVM: Makes Bytecodes Fast §  JIT'ing requires Profiling –  Because you don't want to JIT everything §  Profiling allows focused code-gen §  Profiling allows better code-gen –  Inline what’s hot –  Loop unrolling, range-check elimination, etc –  Branch prediction, spill-code-gen, scheduling
  • 12. 12 Dynamic Compilation (JIT) §  Knows about –  loaded classes, methods the program has executed §  Makes optimization decisions based on code paths executed –  Code generation depends on what is observed: §  loaded classes, code paths executed, branches taken §  May re-optimize if assumption was wrong, or alternative code paths taken –  Instruction path length may change between invocations of methods as a result of de-optimization / re-compilation
  • 13. 13 Dynamic Compilation (JIT) §  Can do non-conservative optimizations in dynamic §  Separates optimization from product delivery cycle –  Update JVM, run the same application, realize improved performance! –  Can be "tuned" to the target platform
  • 14. 14 Profiling §  Gathers data about code during execution –  invariants §  types, constants (e.g. null pointers) –  statistics §  branches, calls §  Gathered data is used during optimization –  Educated guess –  Guess can be wrong
  • 15. 15 Profile-guided optimization (PGO) §  Use profile for more efficient optimization §  PGO in JVMs –  Always have it, turned on by default –  Developers (usually) not interested or concerned about it –  Profile is always consistent to execution scenario
  • 16. 16 Optimistic Compilers §  Assume profile is accurate –  Aggressively optimize based on profile –  Bail out if we’re wrong §  ...and hope that we’re usually right
  • 17. 17 Dynamic Compilation (JIT) §  Is dynamic compilation overhead essential? –  The longer your application runs, the less the overhead §  Trading off compilation time, not application time –  Steal some cycles very early in execution –  Done automagically and transparently to application §  Most of “perceived” overhead is compiler waiting for more data –  ...thus running semi-optimal code for time being Overhead
  • 19. 19 Mixed-Mode Execution §  Interpreted –  Bytecode-walking –  Artificial stack machine §  Compiled –  Direct native operations –  Native register machine
  • 20. 20 Bytecode Execution 1 2 34 Interpretation Profiling Dynamic Compilation Deoptimization
  • 21. 21 Deoptimization §  Bail out of running native code –  stop executing native (JIT-generated) code –  start interpreting bytecode §  It’s a complicated operation at runtime…
  • 22. 22 OSR: On-Stack Replacement §  Running method never exits? §  But it’s getting really hot? §  Generally means loops, back-branching §  Compile and replace while running §  Not typically useful in large systems §  Looks great on benchmarks!
  • 24. 24 Optimizations in HotSpot JVM §  compiler tactics delayed compilation tiered compilation on-stack replacement delayed reoptimization program dependence graph rep. static single assignment rep. §  proof-based techniques exact type inference memory value inference memory value tracking constant folding reassociation operator strength reduction null check elimination type test strength reduction type test elimination algebraic simplification common subexpression elimination integer range typing §  flow-sensitive rewrites conditional constant propagation dominating test detection flow-carried type narrowing dead code elimination §  language-specific techniques class hierarchy analysis devirtualization symbolic constant propagation autobox elimination escape analysis lock elision lock fusion de-reflection §  speculative (profile-based) techniques optimistic nullness assertions optimistic type assertions optimistic type strengthening optimistic array length strengthening untaken branch pruning optimistic N-morphic inlining branch frequency prediction call frequency prediction §  memory and placement transformation expression hoisting expression sinking redundant store elimination adjacent store fusion card-mark elimination merge-point splitting §  loop transformations loop unrolling loop peeling safepoint elimination iteration range splitting range check elimination loop vectorization §  global code shaping inlining (graph integration) global code motion heat-based code layout switch balancing throw inlining §  control flow graph transformation local code scheduling local code bundling delay slot filling graph-coloring register allocation linear scan register allocation live range splitting copy coalescing constant splitting copy removal address mode matching instruction peepholing DFA-based code generator
  • 25. 25 JVM: Makes Virtual Calls Fast §  C++ avoids virtual calls – because they are slow §  Java embraces them – and makes them fast –  Well, mostly fast – JIT's do Class Hierarchy Analysis (CHA) –  CHA turns most virtual calls into static calls –  JVM detects new classes loaded, adjusts CHA §  May need to re-JIT –  When CHA fails to make the call static, inline caches –  When IC's fail, virtual calls are back to being slow
  • 26. 26 Call Site §  The place where you make a call §  Monomorphic (“one shape”) –  Single target class §  Bimorphic (“two shapes”) §  Polymorphic (“many shapes”) §  Megamorphic
  • 27. 27 Inlining §  Combine caller and callee into one unit –  e.g.based on profile –  … or prove smth using CHA (Class Hierarchy Analysis) –  Perhaps with a guard/test §  Optimize as a whole –  More code means better visibility
  • 28. 28 Inlining int addAll(int max) { int accum = 0; for (int i = 0; i < max; i++) { accum = add(accum, i); } return accum; } int add(int a, int b) { return a + b; }
  • 29. 29 Inlining int addAll(int max) { int accum = 0; for (int i = 0; i < max; i++) { accum = accum + i; } return accum; }
  • 30. 30 Inlining and devirtualization §  Inlining is the most profitable compiler optimization –  Rather straightforward to implement –  Huge benefits: expands the scope for other optimizations §  OOP needs polymorphism, that implies virtual calls –  Prevents naïve inlining –  Devirtualization is required –  (This does not mean you should not write OOP code)
  • 31. 31 JVM Devirtualization §  Developers shouldn't care §  Analyze hierarchy of currently loaded classes §  Efficiently devirtualize all monomorphic calls §  Able to devirtualize polymorphic calls §  JVM may inline dynamic methods –  Reflection calls –  Runtime-synthesized methods –  JSR 292
  • 32. 32 Feedback multiplies optimizations §  On-line profiling and CHA produces information –  ...which lets the JIT ignore unused paths –  ...and helps the JIT sharpen types on hot paths –  ...which allows calls to be devirtualized –  ...allowing them to be inlined –  ...expanding an ever-widening optimization horizon §  Result: Large native methods containing tightly optimized machine code for hundreds of inlined calls!
  • 33. 33 Loop unrolling public void foo(int[] arr, int a) { for (int i = 0; i < arr.length; i++) { arr[i] += a; } }
  • 34. 34 Loop unrolling public void foo(int[] arr, int a) { for (int i = 0; i < arr.length; i=i+4) { arr[i] += a; arr[i+1] += a; arr[i+2] += a; arr[i+3] += a; } }
  • 35. 35 Loop unrolling public void foo(int[] arr, int a) { int new_limit = arr.length / 4; for (int i = 0; i < new_limit; i++) { arr[4*i] += a; arr[4*i+1] += a; arr[4*i+2] += a; arr[4*i+3] += a; } for (int i = new_limit*4; i < arr.length; i++) { arr[i] += a; }}
  • 36. 36 Lock Coarsening pubic void m1(Object newValue) { syncronized(this) { field1 = newValue; } syncronized(this) { field2 = newValue; } }
  • 37. 37 Lock Coarsening pubic void m1(Object newValue) { syncronized(this) { field1 = newValue; field2 = newValue; } }
  • 38. 38 Lock Eliding public void m1() { List list = new ArrayList(); synchronized (list) { list.add(someMethod()); } }
  • 39. 39 Lock Eliding public void m1() { List list = new ArrayList(); synchronized (list) { list.add(someMethod()); } }
  • 40. 40 Lock Eliding public void m1() { List list = new ArrayList(); list.add(someMethod()); }
  • 41. 41 Escape Analysis public int m1() { Pair p = new Pair(1, 2); return m2(p); } public int m2(Pair p) { return p.first + m3(p); } public int m3(Pair p) { return p.second;} Initial version
  • 42. 42 Escape Analysis public int m1() { Pair p = new Pair(1, 2); return p.first + p.second; } After deep inlining
  • 43. 43 Escape Analysis public int m1() { return 3; } Optimized version
  • 44. 44 Intrinsic §  Known to the JIT compiler –  method bytecode is ignored –  inserts “best” native code §  e.g. optimized sqrt in machine code §  Existing intrinsics –  String::equals, Math::*, System::arraycopy, Object::hashCode, Object::getClass, sun.misc.Unsafe::*
  • 46. 46 JVMs §  Oracle HotSpot §  IBM J9 §  Oracle JRockit §  Azul Zing §  Excelsior JET §  Jikes RVM
  • 47. 47 HotSpot JVM §  client / C1 §  server / C2 §  tiered mode (C1 + C2) JIT-compilers
  • 48. 48 HotSpot JVM §  client / C1 –  $ java –client §  only available in 32-bit VM –  fast code generation of acceptable quality –  basic optimizations –  doesn’t need profile –  compilation threshold: 1,5k invocations JIT-compilers
  • 49. 49 HotSpot JVM §  server / C2 –  $ java –server –  highly optimized code for speed –  many aggressive optimizations which rely on profile –  compilation threshold: 10k invocations JIT-compilers
  • 50. 50 HotSpot JVM §  Client / C1 + fast startup –  peak performance suffers §  Server / C2 + very good code for hot methods –  slow startup / warmup JIT-compilers comparison
  • 51. 51 Tiered compilation §  -XX:+TieredCompilation §  Multiple tiers of interpretation, C1, and C2 §  Level0=Interpreter §  Level1-3=C1 –  #1: C1 w/o profiling –  #2: C1 w/ basic profiling –  #3: C1 w/ full profiling §  Level4=C2 C1 + C2
  • 53. 53 Monitoring JIT-Compiler §  how to print info about compiled methods? –  -XX:+PrintCompilation §  how to print info about inlining decisions –  -XX:+PrintInlining §  how to control compilation policy? –  -XX:CompileCommand=… §  how to print assembly code? –  -XX:+PrintAssembly –  -XX:+PrintOptoAssembly (C2-only)
  • 54. 54 Print Compilation §  -XX:+PrintCompilation §  Print methods as they are JIT-compiled §  Class + name + size
  • 55. 55 Print Compilation $ java -XX:+PrintCompilation 988 1 java.lang.String::hashCode (55 bytes) 1271 2 sun.nio.cs.UTF_8$Encoder::encode (361 bytes) 1406 3 java.lang.String::charAt (29 bytes) Sample output
  • 56. 56 Print Compilation §  2043 470 % ! jdk.nashorn.internal.ir.FunctionNode::accept @ 136 (265 bytes) % == OSR compilation ! == has exception handles (may be expensive) s == synchronized method §  2028 466 n java.lang.Class::isArray (native) n == native method Other useful info
  • 57. 57 Print Compilation §  621 160 java.lang.Object::equals (11 bytes) made not entrant –  don‘t allow any new calls into this compiled version §  1807 160 java.lang.Object::equals (11 bytes) made zombie –  can safely throw away compiled version Not just compilation notifications
  • 58. 58 No JIT At All? §  Code is too large §  Code isn’t too «hot» –  executed not too often
  • 59. 59 Print Inlining §  -XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining §  Shows hierarchy of inlined methods §  Prints reason, if a method isn’t inlined
  • 60. 60 Print Inlining $ java -XX:+PrintCompilation -XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining 75 1 java.lang.String::hashCode (55 bytes) 88 2 sun.nio.cs.UTF_8$Encoder::encode (361 bytes) @ 14 java.lang.Math::min (11 bytes) (intrinsic) @ 139 java.lang.Character::isSurrogate (18 bytes) never executed 103 3 java.lang.String::charAt (29 bytes)
  • 61. 61 Inlining Tuning §  -XX:MaxInlineSize=35 –  Largest inlinable method (bytecode) §  -XX:InlineSmallCode=# –  Largest inlinable compiled method §  -XX:FreqInlineSize=# –  Largest frequently-called method… §  -XX:MaxInlineLevel=9 –  How deep does the rabbit hole go? §  -XX:MaxRecursiveInlineLevel=# –  recursive inlining
  • 62. 62 Machine Code §  -XX:+PrintAssembly §  http://wikis.sun.com/display/HotSpotInternals/PrintAssembly §  Knowing code compiles is good §  Knowing code inlines is better §  Seeing the actual assembly is best!
  • 63. 63 -XX:CompileCommand= §  Syntax –  “[command] [method] [signature]” §  Supported commands –  exclude – never compile –  inline – always inline –  dontinline – never inline §  Method reference –  class.name::methodName §  Method signature is optional
  • 64. 64 What Have We Learned? §  How JIT compilers work §  How HotSpot’s JIT works §  How to monitor the JIT in HotSpot
  • 65. 65 “Quantum Performance Effects” Sergey Kuksenko, Oracle today, 13:30-14:30, «San-Francisco» hall “Bulletproof Java Concurrency” Aleksey Shipilev, Oracle today, 15:30-16:30, «Moscow» hall Related Talks