How an Optimizing Compiler Works
summary
An optimizer is implemented as an 11 MB tool that reads Java class files with ObjectWeb ASM bytecode->dataflow graph conversion, runs interprocedural and recursive type inference using a lattice with a bottom sentinel, then applies inlining, constant folding, dead code elimination and late scheduling to emit optimized class files. The demo reproduces the hand optimizations on a sample program, it works but has no benchmarks and is not production ready, and closed world analysis promises up to 2–10x speedups.
AI-written summary · about
chapters (20)
- 0:00Start
- 2:17Manual Optimizations: Baseline
- 2:53Manual Optimizations: Type Inference
- 3:11Manual Optimizations. Constant Folding
- 3:34Manual Optimizations: Dead Code Elimination
- 3:53Manual Optimizations: Partial Evaluation
- 4:23Manual Optimizations: Late Scheduling
- 4:50Manual Optimizations: Final
- 8:20Sourcecode
- 9:16Abstract Syntax Trees
- 13:53Dataflow Graphs
- 15:32Type Inference & Constant Folding
- 16:24Type Lattices
- 17:31Inferring Values on the Dataflow Graph
- 24:05Recursive Inter-Procedural Inference
- 29:05Liveness & Reachability Analysis
- 29:28Strawman Program
- 30:54Liveness Optimizations
- 31:34Final Output Code
- 32:00How an Optimizing Compiler Works
related talks
52mUnderstanding Compiler Optimization
21mDiagnosing Compiler Performance by Comparing Optimization Decisions
34mWhat happens to your code when you don't look?
53mWell there's your problem! Your engine's missing! A look under Java's hood
10mA quick view into a compiler
35mJava Source to Byte Code Transformation - The Hidden Story!
23mFast and Compact: Reducing Size of AOT-Compiled Java Code Without Sacrificing Performance
54mWhat Lies Beneath
