annotate llvm/docs/HistoricalNotes/2001-04-16-DynamicCompilation.txt @ 164:fdfabb438fbf

...
author anatofuz
date Thu, 19 Mar 2020 17:02:53 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 By Chris:
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 LLVM has been designed with two primary goals in mind. First we strive to
anatofuz
parents:
diff changeset
4 enable the best possible division of labor between static and dynamic
anatofuz
parents:
diff changeset
5 compilers, and second, we need a flexible and powerful interface
anatofuz
parents:
diff changeset
6 between these two complementary stages of compilation. We feel that
anatofuz
parents:
diff changeset
7 providing a solution to these two goals will yield an excellent solution
anatofuz
parents:
diff changeset
8 to the performance problem faced by modern architectures and programming
anatofuz
parents:
diff changeset
9 languages.
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 A key insight into current compiler and runtime systems is that a
anatofuz
parents:
diff changeset
12 compiler may fall in anywhere in a "continuum of compilation" to do its
anatofuz
parents:
diff changeset
13 job. On one side, scripting languages statically compile nothing and
anatofuz
parents:
diff changeset
14 dynamically compile (or equivalently, interpret) everything. On the far
anatofuz
parents:
diff changeset
15 other side, traditional static compilers process everything statically and
anatofuz
parents:
diff changeset
16 nothing dynamically. These approaches have typically been seen as a
anatofuz
parents:
diff changeset
17 tradeoff between performance and portability. On a deeper level, however,
anatofuz
parents:
diff changeset
18 there are two reasons that optimal system performance may be obtained by a
anatofuz
parents:
diff changeset
19 system somewhere in between these two extremes: Dynamic application
anatofuz
parents:
diff changeset
20 behavior and social constraints.
anatofuz
parents:
diff changeset
21
anatofuz
parents:
diff changeset
22 From a technical perspective, pure static compilation cannot ever give
anatofuz
parents:
diff changeset
23 optimal performance in all cases, because applications have varying dynamic
anatofuz
parents:
diff changeset
24 behavior that the static compiler cannot take into consideration. Even
anatofuz
parents:
diff changeset
25 compilers that support profile guided optimization generate poor code in
anatofuz
parents:
diff changeset
26 the real world, because using such optimization tunes that application
anatofuz
parents:
diff changeset
27 to one particular usage pattern, whereas real programs (as opposed to
anatofuz
parents:
diff changeset
28 benchmarks) often have several different usage patterns.
anatofuz
parents:
diff changeset
29
anatofuz
parents:
diff changeset
30 On a social level, static compilation is a very shortsighted solution to
anatofuz
parents:
diff changeset
31 the performance problem. Instruction set architectures (ISAs) continuously
anatofuz
parents:
diff changeset
32 evolve, and each implementation of an ISA (a processor) must choose a set
anatofuz
parents:
diff changeset
33 of tradeoffs that make sense in the market context that it is designed for.
anatofuz
parents:
diff changeset
34 With every new processor introduced, the vendor faces two fundamental
anatofuz
parents:
diff changeset
35 problems: First, there is a lag time between when a processor is introduced
anatofuz
parents:
diff changeset
36 to when compilers generate quality code for the architecture. Secondly,
anatofuz
parents:
diff changeset
37 even when compilers catch up to the new architecture there is often a large
anatofuz
parents:
diff changeset
38 body of legacy code that was compiled for previous generations and will
anatofuz
parents:
diff changeset
39 not or can not be upgraded. Thus a large percentage of code running on a
anatofuz
parents:
diff changeset
40 processor may be compiled quite sub-optimally for the current
anatofuz
parents:
diff changeset
41 characteristics of the dynamic execution environment.
anatofuz
parents:
diff changeset
42
anatofuz
parents:
diff changeset
43 For these reasons, LLVM has been designed from the beginning as a long-term
anatofuz
parents:
diff changeset
44 solution to these problems. Its design allows the large body of platform
anatofuz
parents:
diff changeset
45 independent, static, program optimizations currently in compilers to be
anatofuz
parents:
diff changeset
46 reused unchanged in their current form. It also provides important static
anatofuz
parents:
diff changeset
47 type information to enable powerful dynamic and link time optimizations
anatofuz
parents:
diff changeset
48 to be performed quickly and efficiently. This combination enables an
anatofuz
parents:
diff changeset
49 increase in effective system performance for real world environments.