Plan-based program slicing
AssigneeInternational Business Machines Corporation
InventorsAharon Abadi, Jonathan Bnayahu, Ran Ettinger, Yishai Feldman
Life of this patent
Estimating the term…
Abstract
A method for generating a slice from a plan-based representation of a program is provided. The method comprises constructing a plan representation of a program, wherein the plan representation comprises a plurality of nodes, edges, and ports; and receiving one or more slicing criteria from a user. The slicing criteria comprise one or more variable occurrences or statements from the program, according to which a slice is generated from the plan representation.
Claims20
A method of generating a slice from a plan-based representation of a program, the method comprising:
- constructing, using one or more processors, a first plan representation of a program, wherein the first plan representation comprises a plurality of nodes, edges, and ports,
- wherein a node represents at least one of an operation associated with data input/output (I/O) in the program, a test specification associated with a branch in control flow of the program, or a join specification associated with a point in the program where control and data flow are joined,
- wherein a port represents at least one of a data port or a control port, wherein a data edge connects a data port on a first node to a data port on a second node, and wherein a control edge connects a control port on a third node to a control port on a fourth node, such that an edge defines control or data flow among the nodes;
- receiving one or more slicing criteria from a user, wherein the slicing criteria comprise one or more variable occurrences or statements from the program;
- associating each variable occurrence in the set of slicing criteria to a corresponding data edge in the first plan representation;
- associating each statement in the set of slicing criteria to a corresponding node or edge in the first plan representation;
- adding input or source ports associated with the set of slicing criteria to a second plan representation;
- iteratively adding input control or data ports to the second plan representation according to control or data dependence, respectively, of ports in the second plan representation;
- adding one or more ports, nodes, or edges to the second plan representation to complete control or data flows in the second plan representation;
- adding a minimal set of join specifications to the second plan representation to prevent fan-in of control;
- adding a minimal set of test specifications to the second plan representation to prevent fan-in of control;
- and
- coverting the second plan representation to source code of the program;
- and
- generating a slice from the plan representation according to the slicing criteria.
A system of generating a slice from a plan-based representation of a program, the system comprising:
- one or more processors coupled to one or more memory units;
- a logic unit for constructing, using one or more processors, a plan representation of a program, wherein the plan representation comprisesa plurality of nodes, edges, and ports,
- wherein a node represents at least one of an operation associated with data input/output (I/O) in the program, a test specification associated with a branch in control flow of the program, or a join specification associated with a point in the program where control and data flow are joined,
- wherein a port represents at least one of a data port or a control port, wherein a data edge connects a data port on a first node to a data port on a second node, and wherein a control edge connects a control port on a third node to a control port on a fourth node, such that an edge defines control;
- or data flow among the nodes;
- a logic unit for receiving one or more slicing criteria from a user, wherein the slicing criteria comprise one or more variable occurrences or statements from the program;
- a logic unit for associating each variable occurrence in the set of slicing criteria to a corresponding data edge in the first plan representation;
- a logic for associating each statement in the set of slicing criteria to a corresponding node or edge in the first plan representation;
- a logic unit for adding input or source ports associated with the set of slicing criteria to a second plan representation;
- a logic unit for iteratively adding input control or data ports to the second plan representation according to control or data dependence, respectively, of ports in the second plan representation;
- a logic unit for adding one or more ports, nodes, or edges to the second plan representation to complete control or data flows in the second plan representation;
- a logic unit for adding a minimal set of join specifications to the second plan representation to prevent fan-in control;
- a logic unit for adding a minimal set of test specifications to the second plan representation to prevent fan-in of control;
- and
- a logic unit for converting the second plan representation to source code of the program;
- and
- a logic unit for generating a slice from the plan representation according to the slicing criteria.
A computer program product comprising logic code stored in a non-transitory storage medium, wherein execution of the logic code on a computer causes the computer to:
- construct a first plan representation of a program, wherein the first plan representation comprises a plurality of nodes, edges, and ports,
- wherein a node represents at least one of an operation associated with data input/output (I/O) in the program, a test specification associated with a branch in control flow of the program, or a join specification associated with a point in the program where control and data flow are joined,
- wherein a port represents at least one of a data port or a control port, wherein a data edge connects a data port on a first node to a data port on a second node, and wherein a control edge connects a control port on a third node to a control port on a fourth node, such that an edge defines control or data flow among the nodes;
- associate each variable occurrence in a set of slicing criteria to a corresponding data edge in the first plan representation;
- associate each statement in the set of slicing criteria to a corresponding node or edge in the first plan representation;
- add input or source ports associated with the set of slicing criteria to a second plan representation;
- iteratively add input control or data ports to the second plan according to control or data dependence, respectively, of ports in the second plan representation;
- add one or more ports, nodes, or edges to the second plan representation to complete control or data flows in the second plan representation;
- add a minimal set of join specifications to the second plan to prevent fan-in of control;
- add a minimal set of test specifications to the second plan to prevent fan-in of control;
- convert the second plan representation to source code of the program;
- generate a slice from the plan representation according to the slicing criteria.
Dependencies are inferred from the claim text.