Method and apparatus for enabling global compiler optimizations in the presence of exception handlers within a computer program
First Claim
Patent Images
1. A computer apparatus comprising:
- (A) an optimizer for optimizing a first instruction stream that is used to generate a second instruction stream, the first instruction stream being generated by a compiler and comprising a plurality of variables, the optimizer including;
an exception range determiner, the exception range determiner determining at least one exception range of the first instruction stream during which at least one exception may occur;
a resume point identifier, the resume point identifier identifying at least one resume point within the first instruction stream, each resume point identifying a range of at least one instruction that is executed when the at least one exception occurs;
a live range calculator, the live range calculator determining the liveness of the plurality of variables, the liveness of a selected variable that is used in the at least one instruction in the exception handling range defined by a resume point before the selected variable is defined extending to at least one instruction within the at least one exception range defined by the exception range determiner; and
(B) a CPU, the CPU executing the second instruction stream.
1 Assignment
0 Petitions
Accused Products
Abstract
A method and apparatus allows a compiler to optimize code in the presence of exception handlers. According to a first embodiment, arcs are added to a control flow graph, prior to performing global optimizations, to account for exception handling code. According to the second embodiment, information relating to control flow to exception handlers is provided in pseudo-references in the code, which allows the compiler to determine how to appropriately optimize the code.
68 Citations
14 Claims
-
1. A computer apparatus comprising:
-
(A) an optimizer for optimizing a first instruction stream that is used to generate a second instruction stream, the first instruction stream being generated by a compiler and comprising a plurality of variables, the optimizer including; an exception range determiner, the exception range determiner determining at least one exception range of the first instruction stream during which at least one exception may occur; a resume point identifier, the resume point identifier identifying at least one resume point within the first instruction stream, each resume point identifying a range of at least one instruction that is executed when the at least one exception occurs; a live range calculator, the live range calculator determining the liveness of the plurality of variables, the liveness of a selected variable that is used in the at least one instruction in the exception handling range defined by a resume point before the selected variable is defined extending to at least one instruction within the at least one exception range defined by the exception range determiner; and (B) a CPU, the CPU executing the second instruction stream. - View Dependent Claims (2, 3)
-
-
4. A computer apparatus for generating a second instruction stream from a first instruction stream, the second instruction stream being executable on a processor having a plurality of registers, the first instruction stream having a plurality of variables, the computer apparatus comprising:
an optimizer for optimizing the first instruction stream, the optimizer including; an exception range determiner, the exception range determiner determining at least one exception range of the first instruction stream during which at least one exception may occur; a resume point identifier, the resume point identifier identifying at least one resume point within the first instruction stream, each resume point identifying a range of at least one instruction that is executed when the at least one exception occurs; and a live range calculator, the live range calculator determining the liveness of the plurality of variables, the liveness of a selected variable that is used in the at least one instruction in the exception handling range define by a resume point before the selected variable is defined extending to at least one instruction within the at least one exception range defined by the exception range determiner. - View Dependent Claims (5, 6, 7)
-
8. A program product comprising:
-
(A) an optimizer, the optimizer being used on a computer apparatus to optimize an instruction stream, the instruction stream having a plurality of variables, the optimizer including; an exception range determiner, the exception range determiner determining at least one exception range of the instruction stream during which at least one exception may occur; a resume point identifier, the resume point identifier identifying at least one resume point within the instruction stream, each resume point identifying a range of at least one instruction that is executed when the at least one exception occurs; and a live range calculator, the live range calculator determining the liveness of the plurality of variables, the liveness of a selected variable that is used in the at least one instruction in the exception handling range defined by a resume point before the selected variable is defined extending to at least one instruction within the at least one exception range defined by the exception range determiner; and (B) signal bearing media bearing the optimizer. - View Dependent Claims (9, 10)
-
-
11. A method for optimizing an instruction stream having a plurality of variables, the method comprising the steps of:
-
determining at least one exception range of the instruction stream during which at least one exception may occur; identifying at least one resume point within the first instruction stream, each resume point identifying a range of at least one instruction that is executed when the at least one exception occurs; and determining the liveness of the plurality of variables, the liveness of a selected variable that is used in the at least one instruction in the exception handling range defined by a resume point before the selected variable is defined extending to at least one instruction within the at least one exception range. - View Dependent Claims (12, 13, 14)
-
Specification