Managing variable assignments in a program
First Claim
1. A computer-implemented method for managing variable assignments in a program, comprisingthe program containing a plurality of paths, wherein each path is a portion or sequence of programming statements that are executed during a particular execution of the program, and one or more variable assignments located at one or more corresponding program points, wherein each variable assignment assigns a value to a variable;
- identifying one or more variable assignments in the program that is live on only a portion of the plurality of paths from the corresponding program point by examining each variable assignment in an order that is reverse from an order of execution of the program to form one or more identified variable assignments,for each identified variable assignment,determining, in an order that is reverse from an order of execution of the program, one or more program points at which the identified variable assignment would be closer to one or more locations in the program at which the variable of the identified variable assignment is used,responsive to determining the one or more program points, determining whether the identified variable assignment is movable to the one or more program points, wherein the identified variable assignment is movable to the one or more program points if the identified variable assignment is live on all of a plurality of paths from the one or more program points, wherein the one or more identified variable assignments is live on all of the plurality of paths at the one or more program points if each of the plurality of paths from the one or more program points uses the variable of the identified variable assignment, andresponsive to determining that the identified variable assignment is movable to the one or more program points, moving the identified variable assignment to the one or more program points.
3 Assignments
0 Petitions
Accused Products
Abstract
A computer-implemented method, apparatus, and computer program product to manage variable assignments in a program. The process identifies a set of variable assignments that is live on a portion of paths to form a set of identified variable assignments. Each of the set of identified variable assignments assign a value to at least one variable of a set of variables. The process determines a set of program points at which the set of identified variable assignments is live on all paths. The process also moves the set of identified variable assignments to the set of program points in response to determining that the set of identified variable assignments is movable to the set of program points.
-
Citations
13 Claims
-
1. A computer-implemented method for managing variable assignments in a program, comprising
the program containing a plurality of paths, wherein each path is a portion or sequence of programming statements that are executed during a particular execution of the program, and one or more variable assignments located at one or more corresponding program points, wherein each variable assignment assigns a value to a variable; -
identifying one or more variable assignments in the program that is live on only a portion of the plurality of paths from the corresponding program point by examining each variable assignment in an order that is reverse from an order of execution of the program to form one or more identified variable assignments, for each identified variable assignment, determining, in an order that is reverse from an order of execution of the program, one or more program points at which the identified variable assignment would be closer to one or more locations in the program at which the variable of the identified variable assignment is used, responsive to determining the one or more program points, determining whether the identified variable assignment is movable to the one or more program points, wherein the identified variable assignment is movable to the one or more program points if the identified variable assignment is live on all of a plurality of paths from the one or more program points, wherein the one or more identified variable assignments is live on all of the plurality of paths at the one or more program points if each of the plurality of paths from the one or more program points uses the variable of the identified variable assignment, and responsive to determining that the identified variable assignment is movable to the one or more program points, moving the identified variable assignment to the one or more program points. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
-
-
12. A computer program product comprising:
-
a non-transitory computer-usable medium having computer-usable program code for managing variable assignments in a program, the computer program product comprising; computer-usable program code for identifying a one or more variable assignments that is live only on a portion of a plurality of paths in the program by examining each variable assignment in an order that is reverse from an order of execution of the program to form one or more identified variable assignments, wherein each of the one or more identified variable assignments assigns a value to a variable, and wherein the one or more variable assignments is located at one or more corresponding program points, and each of the paths is a portion or sequence of programming statements that are executed during a particular execution of the program, and for each identified variable assignment, computer-usable program code for determining, in an order that is reverse from an order of execution of the program, one or more program points at which the identified variable assignment would be closer to one or more locations in the program at which the variable of the identified variable assignment is used; computer-usable program code for responsive to determining the one or more program points, determining whether the identified variable assignment is movable to the one or more program points, wherein the identified variable assignment is movable to the one or more program points if the one or more program points is live on all of the plurality of paths at the one or more program points, wherein the identified variable assignment is live on all of the plurality of paths at the one or more program points if each of the plurality of paths from the one or more program points uses the variables of the identified variable assignment, and computer-usable program code for responsive to determining that the identified variable assignment is movable to the one or more program points, moving the identified variable assignment to the one or more program points.
-
-
13. A data processing system comprising:
-
a bus system; a memory connected to the bus system, wherein the memory includes a set of instructions; and a processing unit connected to the bus system, wherein the processing unit executes the set of instructions to identify one or more variable assignments that is live on only a portion of a plurality of paths by examining each variable assignment in an order that is reverse from an order of execution of a program to form one or more identified variable assignments, wherein each of the one or more identified variable assignments assigns a value to a variable, and wherein the one or more variable assignments is located at one or more corresponding program points, and each of the paths is a portion or sequence of programming statements that are executed during a particular execution of the program, and for each identified variable assignment, determines, in an order that is reverse from an order of execution of the program, one or more program points at which the identified variable assignment is closer to one or more locations in the program at which the variable of the identified variable assignment is used, responsive to determining the set of program points, determines whether the identified variable assignment is movable to the one or more program points, wherein the identified variable assignment is movable to the one or more program points if the one or more program points is live on all of the plurality of paths at the one or more program points, wherein the identified variable assignment is live on all of the plurality of paths at the one or more program points if each of the plurality of paths from the one or more program points uses the variables of the identified variable assignment; and moves the identified variable assignment to the one or more program points in response to determining that the identified variable assignment is movable to the one or more program points.
-
Specification