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