Machine-based normalization of machine instructions
First Claim
1. A method, comprising:
- accessing, by a processor, a first source code comprising functions;
mapping, by the processor, ones of the functions to a corresponding dependency-ordered behavior representation generated from a control-flow graph representation by rearranging graph edges from control flow dependencies to data state dependencies comprising a set of nodes, the mapping further comprising, for ones of the nodes;
mapping an input of the function to an input variable of the node;
mapping an output of the function to an output variable of the node, and mapping an operation of the function to a transformation of the node and wherein the operation of the function transforms the input, of the function to the output of the function; and
identifying, by the processor, a path comprising a number of path nodes, the path nodes comprise nodes having an input common with the output of another node;
wherein at least one path node is a terminal node having the output variable mapped to at least one of the functions providing an output of the first source code;
wherein at least one path node is an intermediate node having the input variable in common with the output variable of at least one of the number of nodes;
transforming, by the processor, the path nodes into a normalized language-agnostic representation that preserves data flow encoded within the program and provides assurances that the data flow are correct and complete comprising a plurality of components; and
regenerating, from the plurality of components, the normalized language-agnostic representation into a programming language alternative to that of the first source code or into an enhanced version of the first source code, wherein the mapping further comprises;
identifying a first variable name in the first source code having a first semantic meaning and mapped to a first path node;
identifying a second variable name in the first source code having a second semantic meaning and mapped to a second path node;
upon determining, by the processor, that the output of the first path node is common with the input of the second path node, determining a new semantic meaning between the first semantic meaning and the second semantic meaning, andwherein the mapping further comprises renaming one of the first variable name or the second variable name that is associated with the first or second semantic meaning to the other of the first variable name or the second variable name that is associated with the determined new semantic meaning.
0 Assignments
0 Petitions
Accused Products
Abstract
Computer source code maintenance represents a significant aspect of computer systems. Code that was developed for one platform, in one language, may require a significant investment in human effort to port such code to another platform or language. Converting source code to a language-agnostic source code allows a user to view the interaction of various portions of the source code in a unified view. Additionally, the language-agnostic source code may be automatically regenerated by a processor to a different platform or language. As a further benefit, documentation, standards-compliance, security, and/or other non-functional requirements may be provided to further enhance the utility of the original source code.
68 Citations
19 Claims
-
1. A method, comprising:
-
accessing, by a processor, a first source code comprising functions;
mapping, by the processor, ones of the functions to a corresponding dependency-ordered behavior representation generated from a control-flow graph representation by rearranging graph edges from control flow dependencies to data state dependencies comprising a set of nodes, the mapping further comprising, for ones of the nodes;
mapping an input of the function to an input variable of the node;
mapping an output of the function to an output variable of the node, and mapping an operation of the function to a transformation of the node and wherein the operation of the function transforms the input, of the function to the output of the function; andidentifying, by the processor, a path comprising a number of path nodes, the path nodes comprise nodes having an input common with the output of another node; wherein at least one path node is a terminal node having the output variable mapped to at least one of the functions providing an output of the first source code; wherein at least one path node is an intermediate node having the input variable in common with the output variable of at least one of the number of nodes; transforming, by the processor, the path nodes into a normalized language-agnostic representation that preserves data flow encoded within the program and provides assurances that the data flow are correct and complete comprising a plurality of components; and regenerating, from the plurality of components, the normalized language-agnostic representation into a programming language alternative to that of the first source code or into an enhanced version of the first source code, wherein the mapping further comprises; identifying a first variable name in the first source code having a first semantic meaning and mapped to a first path node; identifying a second variable name in the first source code having a second semantic meaning and mapped to a second path node; upon determining, by the processor, that the output of the first path node is common with the input of the second path node, determining a new semantic meaning between the first semantic meaning and the second semantic meaning, and wherein the mapping further comprises renaming one of the first variable name or the second variable name that is associated with the first or second semantic meaning to the other of the first variable name or the second variable name that is associated with the determined new semantic meaning. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
-
-
12. A system, comprising:
-
a data storage; and
a processor;
wherein the processor is programmed to perform;accessing, from the data storage by the processor, a first source code comprising functions; mapping, by the processor, ones of the functions to a corresponding dependency-ordered behavior representation generated from a control-flow graph representation by rearranging graph edges from control flow dependencies to data state dependencies comprising a set of nodes, the mapping further comprising, for ones of the nodes; mapping an input of the function to an input variable of the node; mapping an output of the function to an output variable of the node; mapping an operation of the function to a transformation of the node and wherein the operation of the function transforms the input of the function to the output of the function; identifying, by the processor, a path comprising a number of path nodes, the path nodes comprise nodes having an input common with the output of another node; wherein at least one path node is a terminal node having the output variable mapped to at least one of the functions providing an output of the first source code; wherein at least one path node is an intermediate node having the input variable in common with the output variable of at least one of the number of nodes; transforming, by the processor, the path nodes into a normalized language-agnostic representation that preserves data flow encoded within the program and provides assurances that the data flow are correct and complete comprising a plurality of components; regenerating, from the plurality of components, the normalized language-agnostic representation into a programming language alternative to that of the first source code or into an enhanced version of the first source code; and storing the programming language alternative or the enhanced version of the first source code in the data storage; wherein the mapping further comprises; identifying a first variable name in the first source code having a first semantic meaning and mapped to a first path node; identifying a second variable name in the first source code having a second semantic meaning and mapped to a second path node; upon determining, by the processor, that the output of the first path node is common with the input of the second path node, determining a new semantic meaning between the first semantic meaning and the second semantic meaning, and wherein the mapping further comprises renaming one of the first variable name or the second variable name that is associated with the first or second semantic meaning to the other of the first variable name or the second variable name that is associated with the determined new semantic meaning. - View Dependent Claims (13, 14, 15, 16, 17)
-
-
18. A system, comprising:
-
means to access, by a processor, a first source code comprising functions; means to map, by the processor, ones of the functions to a corresponding dependency-ordered behavior representation generated from a control-flow graph representation by rearranging graph edges from control flow dependencies to data state dependencies comprising a set of nodes, the mapping further comprising, for ones of the nodes; mapping an input of the function to an input variable of the node; mapping an output of the function to an output variable of the node; mapping an operation of the function to a transformation of the node and wherein the operation of the function transforms the input of the function to the output of the function; and means to identify, by the processor, a path comprising a number of path nodes, the path nodes comprise nodes having an input common with the output of another node; wherein at least one path node is a terminal node having the output variable mapped to at least one of the functions providing an output of the first source code; wherein at least one path node is an intermediate node having the input variable in common with the output variable of at least one of the number of nodes; means to transform, by the processor, the path nodes into a normalized language-agnostic representation that preserves data flow encoded within the program and provides assurances that the data flow are correct and complete comprising a plurality of components; and means to generate, by the processor, from the plurality of components, the normalized language-agnostic representation into a programming language alternative to that of the first source code or into an enhanced version of the first source code; wherein the mapping further comprises; means to identify, by the processor, a first variable name in the first source code having a first semantic meaning and mapped to a first path node; means to identify, by the processor, a second variable name in the first source code having a second semantic meaning and mapped to a second path node; upon determining, by the processor, that the output of the first path node is common with the input of the second path node, determining by the processor, a new semantic meaning between the first semantic meanie and the second semantic meaning, and wherein the mapping further comprises renaming by the processor one of the first variable name or the second variable name that is associated with the first or second semantic meaning to the other of the first variable name or the second variable name that is associated with the determined new semantic meaning. - View Dependent Claims (19)
-
Specification