20. Flaw: CPU Pipeline Stalling
• CPU would “pre-fetch” instructions on branch
EXE MEM WBID
Instructions of branch AInstructions of branch B
CPU Pipeline Stages
21. Flaw: CPU Pipeline Stalling
switch(op){
case OpAdd: {…}
case OpStore: {…}
case …
}
• CPU would also try to “predict” next branch
22. Flaw: CPU Pipeline Stalling
switch(op){
case OpAdd: {…}
case OpStore: {…}
case …
}
• CPU would also try to “predict” next branch
Hard to Predict!
23. Flaw: CPU Pipeline Stalling
EXE MEM WBID
Instructions of branch A? Which Branch?
CPU Pipeline Stages
Stalling
26. What is JIT Compilation?
• Compile Code On-The-Fly
• Compile a small region of code once a time
and execute it.
• Can Apply More Optimizations
• Compilations are All Happening in Runtime
• Need FAST compilation speed
41. Multi-Levels IR (Ex: LLVM)
Linear DAG (Another) Linear
Target-Independent
Optimizations • Instruction Selection
• Instruction Scheduling
Target-Specific
Optimizations
43. V8: Unified Graph IR
• Use the same graph structure through
the entire compilation process
• Nodes represent operation (Data and
Control). Edges represent their
dependencies
• Without implicit ordering, it has more
freedom than CFG.
65. What I’d Learn
in Modern Compiler Research
• How to Boost Compilation Speed
• How to Reduce Compilers’ Memory Footprint
• How to Choose Proper Optimizations
• Dynamic-Profiled Optimizations