Patent ID: 8543974

Claim:
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.