Dynamically compiled computer program code containing virtual calls can
reduce the options for optimization during compilation. A virtual call
can affect sections of the program code that are compiled subsequent to
the virtual call. Therefore, the state under which the effected sections
are to be executed may not be known at the time of compilation thus
complicating optimization of these sections. If assumptions are made
about the state of an effected section, then this section can be
optimized. In order to provide proper operation of the executing program
code given the optimization, a check of the validity of the assumptions
is performed prior to execution of the optimized section. If an
assumption does not hold true then the original un-optimized section can
be executed to reduce adverse program performance.