A sampling-based system and method for adaptively optimizing a computer program
executing in an execution environment that comprises one or more compiler devices
for providing various levels of program optimization. The system comprises a runtime
measurements sub-system for monitoring execution of the computer program to be
optimized, the monitoring including obtaining raw profile data samples and characterizing
the raw profile data; a controller device for receiving the characterized raw profile
data from the runtime measurements sub-system and analyzing the data for determining
whether a level of program optimization for the executing program is to be performed
by a compiler device, the controller generating a compilation plan in accordance
with a determined level of optimization; and, a recompilation sub-system for receiving
a compilation plan from the controller and invoking a compiler device for performing
the level of program optimization of the executing program in accordance with the
compilation plan.