| 1 |
= WholeProgramOptimization |
| 2 |
|
| 3 |
Whole-program optimization is a compilation technique in which |
| 4 |
optimizations operate over the entire program. This allows the |
| 5 |
compiler many optimization opportunities that are not available when |
| 6 |
analyzing modules separately (as with separate compilation). |
| 7 |
|
| 8 |
Most of MLton's optimizations are whole-program optimizations. |
| 9 |
Because MLton compiles the whole program at once, it can perform |
| 10 |
optimization across module boundaries. As a consequence, MLton often |
| 11 |
reduces or eliminates the run-time penalty that arises with separate |
| 12 |
compilation of SML features such as functors, modules, polymorphism, |
| 13 |
and higher-order functions. MLton takes advantage of having the |
| 14 |
entire program to perform transformations such as: defunctorization, |
| 15 |
monomorphisation, higher-order control-flow analysis, inlining, |
| 16 |
unboxing, argument flattening, redundant-argument removal, constant |
| 17 |
folding, and representation selection. Whole-program compilation is |
| 18 |
an integral part of the design of MLton and is not likely to change. |