Techniques are provided for recovering from compilation errors in
environments that use dynamic compilers. Application programs include
Java bytecodes, and compilation includes sequential invocation of
separate compilation phases on a region of bytecodes. If compilation of a
region results in a fatal error, then the compiler identifies the
"failed" phase. If the failed phase is a non-essential phase, then the
compiler attempts to re-compile the region after skipping the failed
phase. However, if the failed phase is essential, then the compiler
attempts to replace that failed phase with a simpler version.
Nevertheless, if the fatal error cannot be avoided or the compiler is
unable to replace the failed phase with a simpler version, then the
compiler prevents compilation of the code encompassing the fatal error in
future attempts.