A system and method for iterative code optimization using adaptive or dynamic
size
metrics, for use with run-time software systems and virtual machines. The dynamic
size metric may be calculated both for a set of predetermined factors (together
with associated weights), and also for a set of variable factors determined during
the runtime code introspection process. The predetermined factors, and their associated
weights, may be varied to reflect the overall performance of the code in each optimization
instance. In one embodiment a method is provided for performing adaptive optimization
of application code within a virtual machine environment, the method comprising
the steps of: gathering information about an application code and optimization
parameters during run-time, passing said information via a feedback mechanism to
an optimizer, calculating a dynamic size metric for the current application code
using said optimization parameters, and optimizing the application code based on
the dynamic size metric.