Methods and systems consistent with the present invention provide a
statistical profile of execution characteristics of a program, then use
that statistical profile to regenerate code at run-time. When the
information in the statistical profile is insufficient to make an
optimization decision, methods and systems in accordance with the present
invention may use the statistical profile plus additional information
described below to determine a minimal level of instrumentation required
to answer a particular optimization question. They then add at run-time
the minimal instrumentation required to decide an optimization question,
continue running the program for a period of time, and then analyze the
resulting instrumentation data. These systems may either iterate the
process to get more data or use the available data to compile a more
highly optimized program.