Java Reference
In-Depth Information
Chapter8
CelebrityCompilers
8.1 Introduction
Here we survey some of the popular Java (or Java-like) compilers. For each of these, we
discuss issues or features that are peculiar to the compiler in question. The compilers we
discuss are the following:
Oracle's Java HotSpot TM compiler
IBM's Eclipse compiler for Java
The GNU Java compiler
Microsoft's C # compiler
This chapter will only give a taste of these compilers. The reader may wish to consult
some of the recommended readings in the Further Readings section (Section 8.6) at the end
of this chapter for a deeper understanding of them.
8.2 Java HotSpot Compiler
The original Java Virtual Machine (JVM) was developed by Sun Microsystems. The Oracle
Corporation, which acquired Sun in 2010, now maintains it. What makes Oracle's JVM
compiler [Oracle, 2010] special, aside from the fact that it is the original Java compiler, is
its implementation of its just-in-time (JIT) compiler.
A typical JIT compiler will translate a method's (JVM) byte code into native code the
first time the method is invoked and then cache the native code. In this manner, only native
code is executed. When a method is invoked repeatedly, its native code may be found in
the cache. In programs with large loops or recursive methods, JIT compilation drastically
reduces the execution time [Kazi et al., 2000].
An obvious drawback of JIT compilation is the initial run-time delay in the execution
of a program, which is caused by both the compilation of methods the first time they are
encountered and the application of platform-dependent optimizations. JIT compilers are
able to perform optimizations that static compilers 1 cannot, because they have access to
run-time information, such as input parameters, control flow, and target machine specifics
(for example, the compiler knows what processor the program is running on and can tune
the generated code accordingly). Other than that, JIT compilers do not spend as much
1 Static compilation is also known as ahead-of-time compilation, which is discussed in Section 8.4.2.
277
 
Search WWH ::




Custom Search