Patent ID: 8181170

Claim:
A method comprising: analyzing a first binary version of a program and unwind information associated with the first binary version of the program, the unwind information including: information for restoring registers when unwinding a program stack for the first binary version, and information for processing exceptions to unwinding the program stack for the first binary version; annotating internal representations of the first binary version in accordance with the unwind information, the internal representations corresponding to unwind regions comprising any one or more of instructions, basic blocks, and procedures of the program's source code, wherein annotating includes, for each procedure: generating a sequence of unwind state records for the unwind regions and attaching the sequence of unwind state records to the internal representation corresponding to the procedure, generating decoded type and decoded action tables, and attaching the tables to the internal representation corresponding to the procedure; decorating selected instructions of the internal representation with attributes encoding any one of: a field for a register in the unwind state record pointing to a slot corresponding to the selected instruction, a landing pad for a basic block or instruction; generating unwind rules for each instruction of the annotated internal representations, the unwind rules governing how to unwind out of an enclosing procedure at each instruction; performing optimization on the first binary version to produce a second binary version of the program in accordance with the unwind rules governing how to unwind out of the enclosing procedure at each instruction of the annotated internal representations of the first binary version; and generating updated unwind information for the second binary version, the updated unwind information including: information for restoring registers when unwinding a program stack for the second binary version, and information for processing exceptions when unwinding the program stack for the second binary version.