A technique for improving the execution speed of a computer system by
effectively reducing the costs to perform a search operation for an
exception handler during the exception handling process is established. A
computer system comprises 1) a compiler for compiling a program written
in a programming language having an exception handling mechanism and 2)
an execution unit for executing the compiled program. The execution unit
calculates an occurrence frequency of an execution context in which a
search operation for an exception handler is performed for execution
handling, and determines the execution context to be optimized based on
the frequency data. The compiler determines the exception handler for
handling an exception that occurs in the above execution context, and
generate a code describing a process path from a point that throw the
exception in said execution context to the exception handler.
Specifically, the compiler deletes the code that throws the exception,
and generates a code that branches to the corresponding exception
handler.