Patent ID: 8250544

Claim:
A computer program product comprising one or more computer storage devices having stored thereon computer-executable instructions that, when executed by one or more processors of a computing system, causes the computing system to perform a method for optimizing a computer program while taking into consideration exception handling, the method comprising: an act of the computing system accessing a computer program during compilation of the computer program from source code to intermediate code; an act of the computing system detecting an instruction of the computer program that may cause one or more exceptions to be thrown by the computer program when the computer program is executed, including detecting that one or both of an operator or an operand of the instruction may cause an exception to be thrown when the computer program is executed; an act of the computing system annotating the intermediate code, including annotating one or both of the operator or the operand with corresponding exception information, for each of the operator or the operand the corresponding exception information including: a corresponding indicator that indicates that the operator or the operand may cause one or more corresponding exceptions to be thrown during execution of the operator or the operand; a corresponding description that describes one or more types of the one or more corresponding exceptions that the operator or the operand may throw during execution of the operator or the operand; and a catch handler label that refers to exception code that can be executed to handle the one or more corresponding exceptions that the operator or the operand may throw during execution of the operator or the operand; and an act of the computing system optimizing the intermediate code of the computer program based on the annotated exception information in the intermediate code.