Unwind information for optimized programs
AssigneeIntel Corporation
InventorsHarish G. Patil, Robert Muth, Geoff Lowney
Life of this patent
Estimating the term…
Abstract
Analyzing a first binary version of a program and unwind information associated with the first binary version of the program, performing optimization on the first binary version of the program to produce a second binary version of the program based at least in part on the results of the analysis, and generating new unwind information for the second binary version of the program based at least in part on the results of the analysis and at least in part on the optimization performed.
Claims16
A method comprising:
- (a) analyzing a first binary version of a program and unwind information associated with the first binary version of the program, the unwind information further comprising language-independent information related to unwinding the program, associated with each unwind region of each procedure of the program, wherein analyzing includes:
- (i) generating a representation of the program, including a representation of instructions, basic blocks, and procedures;
- (ii) identifying a basic block type of each represented basic block and marking the representation with the basic block type;
- (iii) generating unwind state data and unwind attributes for each unwind region of each procedure of the program;
- (iv) associating unwind state data and attributes with representations of the instructions of the program;
- and
- (v) associating unwind state data and attributes with representations of procedures of the program;
- (b) performing optimization on the first binary version of the program to produce a second binary version of the program based at least in part on the results of the analysis;
- and
- (c) generating updated unwind information for the second binary version of the program based at least in part on the results of the analysis and at least in part on the optimization performed;
- wherein performing optimization on the first binary version of the program to produce the second binary version of the program based at least in part on the results of the analysis further comprises:
- (i) protecting instructions with associated unwind attributes from deletion during optimization;
- (ii) if a first instruction with associated unwind attributes is duplicated to create a second instruction during optimization, then creating a representation of the second instruction and unwind attributes associated with the representation of the second instruction based at least in part on the unwind attributes associated with the representation of the first instruction;
- (iii) preventing any instruction from being moved from a basic block of one basic block type to a basic block of a different basic block type during optimization;
- and
- (iv) if a procedure in the first binary version of the program is split into two new procedures during optimization, then generating a representation of each new procedure, unwind state data and attributes for the representation of each new procedure based at least in part on the unwind state data and attributes for the representation of the procedure in the first binary version of the program and at least in part on an unwind rule for the instruction at which the split is made.
A computer-readable storage medium having stored thereon data which when accessed by a machine causes the machine to perform a method, the method comprising:
- (a) analyzing a first binary version of a program and unwind information associated with the first binary version of the program, the unwind information comprising language-independent information related to unwinding the program, associated with each unwind region of each procedure of the program, wherein analyzing includes:
- (i) generating a representation for the program's instructions, basic blocks, and procedures;
- (ii) identifying the basic block type of each basic block and marking the representation of each basic block with the basic block type;
- (iii) generating unwind state data and unwind attributes for each unwind region of each procedure of the program that specify how program state, including at least the values of program-related registers, should be restored for unwinding;
- (iv) associating unwind state data and attributes with instructions of the program;
- and
- (v) associating unwind state data and attributes with procedures of the program;
- (b) performing optimization on the first binary version of the program to produce a second binary version of the program based at least in part on the results of the analysis;
- and
- (c) generating new unwind information for the second binary version of the program based at least in part on the results of the analysis and at least in part on the optimization performed, wherein performing optimization on the first binary version of the program to produce the second binary version of the program based at least in part on the results of the analysis further comprises:
- (i) protecting instructions with associated unwind attributes from deletion during optimization;
- (ii) if an first instruction with associated unwind attributes is duplicated to create a second instruction during optimization, then creating unwind attributes associated with the second instruction based at least in part on the unwind attributes associated with the first instruction;
- (iii) preventing any instruction from being moved from a basic block of one basic block type to a basic block of a different basic block type during optimization;
- and
- (iv) if a procedure in the first binary version of the program is split into a two new procedures during optimization, then generating unwind state data and attributes for each new procedure based at least in part on the unwind state data and attributes for the procedure in the first binary version of the program and at least in part on an unwind rule for the instruction at which the split is made.
Dependencies are inferred from the claim text.