Java Reference
In-Depth Information
On-stack replacement (OSR) is used to overcome this problem. It is the opposite of
dynamic de-optimization, where the JVM can switch from interpretation mode to compi-
lation mode or swap a better version of compiled code in the middle of a loop, without
waiting for the enclosing method to be exited and re-entered [Fink and Qian, 2003]. When
the interpreter sees a method looping, it will invoke HotSpot to compile this method. While
the interpreter is still running the method, HotSpot will compile the method aside, with
an entry point at the target of the backward branch. Then the run-time will replace the
interpreted stack activation frame with the compiled frame, so that execution continues
with the new frame from that point [Paleczny et al., 2001]. HotSpot can apply aggressive
specializations based on the current conditions at any time and re-compile the code that is
running if those conditions change during run-time by means of OSR.
Clever techniques like aggressive inlining, dynamic de-optimization, OSR, and many
others [Paleczny et al., 2001, Oracle, 2010] allow HotSpot to produce better code when
compared to traditional JIT compilation.
8.3 Eclipse Compiler for Java (ECJ)
Eclipse is an open-source development platform comprised of extensible frameworks, tools,
and run-times, originally developed by IBM. The Eclipse platform is structured as a set
of sub-systems, which are implemented as plug-ins. The Eclipse Java Development Tools
(JDT) provide the plug-ins for a Java integrated development environment with its own
Java compiler called the Eclipse Compiler for Java (ECJ), which is often compared with
Oracle's Java compiler.
The ECJ is an incremental compiler, meaning that after the initial compilation of a
project, it compiles only the modified (or newly added) file and its dependent files next
time, instead of re-compiling the whole project again.
Compilation in Eclipse can be invoked in three different ways [Arthorne, 2004]:
Full Compilation requires that all source files in the project be compiled. This is
either performed as the initial compilation, or as a result of a clean operation that
is performed on the project, which deletes all the .class files and problem markers,
thus forcing a re-compilation of an entire project.
Incremental Compilation compiles only the changed files (by visiting the complete
resource delta tree) and the files that are affected by the change, for example, classes
that implement an interface, the classes calling methods of the changed classes, etc.
Auto Compilation is essentially the same as incremental compilation. Here, incre-
mental compilation is triggered automatically because a change in source code has
occurred.
Eclipse's incremental compiler for Java uses a last build state to do an optimized build
based on the changes in the project since the last compilation. The changes since the last
compilation are captured as a resource delta tree, which is a hierarchical description of what
has changed between two discrete points in the lifetime of the Eclipse workspace. The next
time ECJ is called, it uses this resource delta tree to determine the source files that need
to be re-compiled because they were changed, removed, or added.
In addition to the resource delta tree, the compiler keeps a dependency graph in memory
as part of its last built state. The dependency graph includes all the references from each
 
Search WWH ::




Custom Search