SlideShare uma empresa Scribd logo
1 de 67
Baixar para ler offline
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

Mais conteĂșdo relacionado

Mais procurados

Mais procurados (20)

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
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 
JVM Under The Hood WDI.pdf
JVM Under The Hood WDI.pdfJVM Under The Hood WDI.pdf
JVM Under The Hood WDI.pdf
 
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
 
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
 
BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2 BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2
 
GraalVM Overview Compact version
GraalVM Overview Compact versionGraalVM Overview Compact version
GraalVM Overview Compact version
 
UseNUMA恚äș†ä»€äčˆïŒŸïŒˆ2012-03-14
UseNUMA恚äș†ä»€äčˆïŒŸïŒˆ2012-03-14UseNUMA恚äș†ä»€äčˆïŒŸïŒˆ2012-03-14
UseNUMA恚äș†ä»€äčˆïŒŸïŒˆ2012-03-14
 
Nouveautés Java 9-10-11
Nouveautés Java 9-10-11Nouveautés Java 9-10-11
Nouveautés Java 9-10-11
 
from Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu Worksfrom Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu Works
 
jemalloc ì„žëŻžë‚˜
jemalloc ì„žëŻžë‚˜jemalloc ì„žëŻžë‚˜
jemalloc ì„žëŻžë‚˜
 
OptView2 - C++ on Sea 2022
OptView2 - C++ on Sea 2022OptView2 - C++ on Sea 2022
OptView2 - C++ on Sea 2022
 
Let's talk about Garbage Collection
Let's talk about Garbage CollectionLet's talk about Garbage Collection
Let's talk about Garbage Collection
 
Process Address Space: The way to create virtual address (page table) of user...
Process Address Space: The way to create virtual address (page table) of user...Process Address Space: The way to create virtual address (page table) of user...
Process Address Space: The way to create virtual address (page table) of user...
 
What Can Compilers Do for Us?
What Can Compilers Do for Us?What Can Compilers Do for Us?
What Can Compilers Do for Us?
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
semaphore & mutex.pdf
semaphore & mutex.pdfsemaphore & mutex.pdf
semaphore & mutex.pdf
 
Discover Quarkus and GraalVM
Discover Quarkus and GraalVMDiscover Quarkus and GraalVM
Discover Quarkus and GraalVM
 
The definitive guide to java agents
The definitive guide to java agentsThe definitive guide to java agents
The definitive guide to java agents
 

Destaque

"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
Vladimir Ivanov
 
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
 

Destaque (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
 

Semelhante a JVM JIT-compiler overview @ JavaOne Moscow 2013

Semelhante 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
 

Mais 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 2013
Vladimir 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-2012
Vladimir Ivanov
 
УпраĐČĐ»Đ”ĐœĐžĐ” ĐżĐ°ĐŒŃŃ‚ŃŒŃŽ ĐČ Java: Footprint
УпраĐČĐ»Đ”ĐœĐžĐ” ĐżĐ°ĐŒŃŃ‚ŃŒŃŽ ĐČ Java: FootprintУпраĐČĐ»Đ”ĐœĐžĐ” ĐżĐ°ĐŒŃŃ‚ŃŒŃŽ ĐČ Java: Footprint
УпраĐČĐ»Đ”ĐœĐžĐ” ĐżĐ°ĐŒŃŃ‚ŃŒŃŽ ĐČ Java: Footprint
Vladimir Ivanov
 
ĐœĐœĐŸĐłĐŸŃƒŃ€ĐŸĐČĐœĐ”ĐČая ĐșĐŸĐŒĐżĐžĐ»ŃŃ†ĐžŃ ĐČ HotSpot JVM
ĐœĐœĐŸĐłĐŸŃƒŃ€ĐŸĐČĐœĐ”ĐČая ĐșĐŸĐŒĐżĐžĐ»ŃŃ†ĐžŃ ĐČ HotSpot JVMĐœĐœĐŸĐłĐŸŃƒŃ€ĐŸĐČĐœĐ”ĐČая ĐșĐŸĐŒĐżĐžĐ»ŃŃ†ĐžŃ ĐČ HotSpot JVM
ĐœĐœĐŸĐłĐŸŃƒŃ€ĐŸĐČĐœĐ”ĐČая ĐșĐŸĐŒĐżĐžĐ»ŃŃ†ĐžŃ ĐČ HotSpot JVM
Vladimir Ivanov
 
"Đ”ĐžĐ°ĐłĐœĐŸŃŃ‚ĐžŃ€ĐŸĐČĐ°ĐœĐžĐ” ĐżŃ€ĐŸĐ±Đ»Đ”ĐŒ Đž ĐœĐ°ŃŃ‚Ń€ĐŸĐčĐșĐ° GC ĐČ HotSpot JVM" (JEEConf, КОДĐČ, 2011)
"Đ”ĐžĐ°ĐłĐœĐŸŃŃ‚ĐžŃ€ĐŸĐČĐ°ĐœĐžĐ” ĐżŃ€ĐŸĐ±Đ»Đ”ĐŒ Đž ĐœĐ°ŃŃ‚Ń€ĐŸĐčĐșĐ° GC ĐČ HotSpot JVM" (JEEConf, КОДĐČ, 2011)"Đ”ĐžĐ°ĐłĐœĐŸŃŃ‚ĐžŃ€ĐŸĐČĐ°ĐœĐžĐ” ĐżŃ€ĐŸĐ±Đ»Đ”ĐŒ Đž ĐœĐ°ŃŃ‚Ń€ĐŸĐčĐșĐ° GC ĐČ HotSpot JVM" (JEEConf, КОДĐČ, 2011)
"Đ”ĐžĐ°ĐłĐœĐŸŃŃ‚ĐžŃ€ĐŸĐČĐ°ĐœĐžĐ” ĐżŃ€ĐŸĐ±Đ»Đ”ĐŒ Đž ĐœĐ°ŃŃ‚Ń€ĐŸĐčĐșĐ° GC ĐČ HotSpot JVM" (JEEConf, КОДĐČ, 2011)
Vladimir Ivanov
 

Mais 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

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Último (20)

Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

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