Java Reference
In-Depth Information
ters, and data paths can be reconfigured. Special-purpose instructions have
also been introduced, such as the MMX instructions for Intel machines. These
instructions facilitate graphics and numerical computations. Such architec-
tural innovations cannot succeed unless compilers can make e
ective use of
both RISC and the more specialized instructions. Thus, collaboration between
computer architects, language designers, and compiler writers continues to be
strong.
The programming language community has defined the semantic gap
as a (subjective) measure of the distance between a compiler's source and
target languages. As this gap continues to widen, the compiler community
is challenged to build e
ff
cient bridges. These challenges come from many
sources. Examples include object-orientation, mobile code, active network
components, and distributed object systems. Compilers must produce excel-
lent code quickly, quietly, and—of course—correctly.
14.1.1 Why Optimize?
Although its given name is a misnomer, it is certainly the goal of program
optimization to improve a program's performance. Truly optimal performance
cannot be achieved automatically, as the task subsumes problems that are
known to be undecidable [Mar03]. It can be proven that there is no algorithm
that can handle all instances of an undecidable problem. The main areas in
whichprogramoptimizers strive for improvement are discussed in this section,
beginning with the example shown in Figure 14.1. In this program, variables
A , B ,and C are of type Matrix . For simplicity, we assume all matrices are of
size N × N .The
operators are overloaded as shown to performmatrix
multiplication and assignment, respectively, using the function and procedure
provided in Figure 14.1.
×
and
=
High-Level Language Features
High-level languages contain features that o
ff
er flexibility and generality at
the cost of some runtime e
ciency. Optimizing compilers attempt to recover
performance for such features in the following ways:
Perhaps it can be shown that a given feature is not used by some portion
of a program.
In the example of Figure 14.1, suppose that the Matrix type is extended
to SymMatrix —with definitions of the Matrix methods optimized for
symmetric matrices.
If A and B are actually of type SymMatrix ,then
languages that o
er virtual function dispatch are obligated to call the
most specialized method for an object's actual type. However, if the
compiler can determine that
ff
×
and
=
are not redefined in any subclass
 
 
Search WWH ::




Custom Search