Completing decision logic to avoid a side effect
AssigneeInternational Business Machines Corporation
InventorsJean-Michel G. B. Bernelas, Ulrich M. Junker, Remi Van Keisbelck
Life of this patent
Estimating the term…
Abstract
An approach is provided for completing a decision logic. For statements in a syntax tree of the decision logic and using a symbolic execution technique, path expression(s) that refer to respective input object(s) are identified. A statement in the decision logic is detected that modifies an attribute value of a path expression included in the path expression(s) and that refers to an input object included in the input object(s). A copy instruction is inserted as a new node in the syntax tree so that the attribute value of the path expression is a copy of the input object. Responsive to inserting the copy instruction, the path expression is prevented from modifying the input object.
Claims17
A method of completing a decision logic, the method comprising:
- for statements in a syntax tree of the decision logic and using a symbolic execution technique, a computer identifying one or more path expressions that refer to respective one or more input objects;
- the computer detecting a statement in the decision logic that modifies an attribute value of a path expression that is included in the identified one or more path expressions and that refers to an input object included in the one or more input objects;
- the computer inserting a copy instruction as a new node in the syntax tree so that the attribute value of the path expression is a copy of the input object, and in response to the step of inserting, the computer preventing the path expression from modifying the input object
- the computer detecting an assignment action in the decision logic that modifies the attribute value of the path expression and determining that the path expression does not include an input variable;
- and
- the computer determining that the attribute value of the path expression is equal to an attribute value of another path expression that includes the input variable, wherein the attribute value of the other path expression is not permitted to be modified, and wherein the detecting the statement is based on the assignment action being detected, the path expression not including the input variable, and the attribute value of the path expression being equal to the attribute value of the other path expression that includes the input variable.
A computer program product for completing a decision logic, the computer program product comprising a computer readable storage medium having computer readable program code stored on the computer readable storage medium, wherein the computer readable storage medium is not a transitory signal per se, the computer readable program code being executed by a central processing unit (CPU) of a computer system to cause the computer system to perform a method comprising:
- for statements in a syntax tree of the decision logic and using a symbolic execution technique, the computer system identifying one or more path expressions that refer to respective one or more input objects;
- the computer system detecting a statement in the decision logic that modifies an attribute value of a path expression that is included in the identified one or more path expressions and that refers to an input object included in the one or more input objects;
- the computer system inserting a copy instruction as a new node in the syntax tree so that the attribute value of the path expression is a copy of the input object, and in response to the inserting, the computer system preventing the path expression from modifying the input object;
- the computer system detecting an assignment action in the decision logic that modifies the attribute value of the path expression and determining that the path expression does not include an input variable;
- and
- the computer system determining that the attribute value of the path expression is equal to an attribute value of another path expression that includes the input variable, wherein the attribute value of the other path expression is not permitted to be modified, and wherein the detecting the statement is based on the assignment action being detected, the path expression not including the input variable, and the attribute value of the path expression being equal to the attribute value of the other path expression that includes the input variable.
A computer system comprising:
- a central processing unit (CPU);
- a memory coupled to the CPU;
- and
- a computer readable storage device coupled to the CPU, the computer readable storage device containing instructions that are executed by the CPU via the memory to implement a method of completing a decision logic, the method comprising the steps of:
- for statements in a syntax tree of the decision logic and using a symbolic execution technique, the computer system identifying one or more path expressions that refer to respective one or more input objects;
- the computer system detecting a statement in the decision logic that modifies an attribute value of a path expression that is included in the identified one or more path expressions and that refers to an input object included in the one or more input objects;
- the computer system inserting a copy instruction as a new node in the syntax tree so that the attribute value of the path expression is a copy of the input object, and in response to the step of inserting, the computer system preventing the path expression from modifying the input object;
- the computer system detecting an assignment action in the decision logic that modifies the attribute value of the path expression and determining that the path expression does not include an input variable;
- and
- the computer system determining that the attribute value of the path expression is equal to an attribute value of another path expression that includes the input variable, wherein the attribute value of the other path expression is not permitted to be modified, and wherein the step of detecting the statement is based on the assignment action being detected, the path expression not including the input variable, and the attribute value of the path expression being equal to the attribute value of the other path expression that includes the input variable.
Dependencies are inferred from the claim text.