The execution model for mobile, dynamically-linked, object-oriented program
s has evolved from fast interpretation to a mix of interpreted and dynamica
lly compiled execution. The primary motivation for dynamic compilation is t
hat compiled code executes significantly faster than interpreted code. Howe
ver, dynamic compilation, which is performed while the application is runni
ng, introduces execution delay, In this paper we present two dynamic compil
ation techniques that enable high performance execution while reducing the
effect of this compilation overhead, These techniques can be classified as
(1) decreasing the amount of compilation performed, and (2) overlapping com
pilation with execution.
We first present and evaluate lazy compilation, an approach used in most dy
namic compilation systems in which individual methods are compiled on-deman
d upon their first invocation. This is in contrast to eager complication, i
n which all methods in a class are compiled when a new class is loaded. In
this work, we describe our experience with eager compilation, as well as th
e implementation and transition to lazy compilation. We empirically detail
the effectiveness of this decision. Our experimental results using the Spec
JVM Java benchmarks and the Jalapeno JVM show that, compared to eager compi
lation, lazy compilation results in 57% fewer methods being compiled and re
ductions in total time of 14 to 26%, Total time in this context is compilat
ion plus execution time.
Next, we present profile-driven, background compilation, a technique that a
ugments lazy compilation by using idle cycles in multiprocessor systems to
overlap compilation with application execution. With this approach, compila
tion occurs on a thread separate from that of application threads so as to
reduce intermittent, and possibly substantial, delay in execution. Profile
information is used to prioritize methods as candidates for background comp
ilation. Methods are compiled according to this priority scheme so that per
formance-critical methods are invoked using optimized code as soon as possi
ble. Our results indicate that background compilation can achieve the perfo
rmance of off-line compiled applications and masks almost all compilation o
verhead. We show significant reductions in total time of 14 to 71% over laz
y compilation. Copyright (C) 2001 John Wiley & Sons, Ltd.