Apparatus, methods, and computer program products are disclosed for
determining how to compile a program at runtime. A bytecode instruction
associated with the program that can be compiled in multiple ways is
retrieved and compiled in a particular way, typically the default way. At
runtime, a virtual machine determines whether another way of compiling the
bytecode instruction is more desirable and, if so, the bytecode is then
recompiled the other way. In some embodiments, the portion of the program
that contains the bytecode instruction to be recompiled is placed in a
queue with other instructions that are to be recompiled. The virtual
machine may examine changing requirements of the program that have
developed at the program's execution in which the requirements are derived
from profile data on each of the multiple ways the program can be
compiled. The bytecode instruction within the program may be recompiled in
a more preferred way based upon the profile data.