Intermediate language representation and modification
First Claim
1. A computer-implemented method for modifying execution of a computer program function having a plurality of instructions, comprising:
- a) in response to detecting an invocation of the computer program function, generating a directed graph representing the computer program function, the directed graph including a plurality of instruction nodes, each instruction node representing a corresponding instruction of the plurality of instructions;
b) inserting, into the directed graph, one or more meta-nodes, the one or more meta-nodes including a first edge to an instruction node of the directed graph corresponding to an instruction of an exception block and a second edge to an instruction node of the directed graph corresponding to a handler associated with the exception block; and
c) employing the one or more meta-nodes to perform at least one of adding or removing at least one other instruction node to the directed graph; and
d) translating the directed graph to an intermediate language representation of the computer program function.
2 Assignments
0 Petitions
Accused Products
Abstract
A system and method for facilitating analysis and modification of a computer program. A directed graph is generated from an intermediate language representation of a computer program function, with a node representing each instruction. Meta-edges or meta-nodes are inserted into the directed graph to facilitate location of instruction nodes. One type of meta-edge is a back edge that identifies branch instruction nodes. Some meta-nodes may identify instructions of a specific type. Some meta-nodes may identify exception blocks and corresponding handlers. Analysis of a program function may include insertion of new instructions prior to execution of the function.
41 Citations
19 Claims
-
1. A computer-implemented method for modifying execution of a computer program function having a plurality of instructions, comprising:
-
a) in response to detecting an invocation of the computer program function, generating a directed graph representing the computer program function, the directed graph including a plurality of instruction nodes, each instruction node representing a corresponding instruction of the plurality of instructions; b) inserting, into the directed graph, one or more meta-nodes, the one or more meta-nodes including a first edge to an instruction node of the directed graph corresponding to an instruction of an exception block and a second edge to an instruction node of the directed graph corresponding to a handler associated with the exception block; and c) employing the one or more meta-nodes to perform at least one of adding or removing at least one other instruction node to the directed graph; and d) translating the directed graph to an intermediate language representation of the computer program function. - View Dependent Claims (2, 3, 4)
-
-
5. A computer-implemented method for modifying execution of a computer program function having a plurality of instructions, comprising:
-
a) in response to detecting an invocation of the computer program function, generating a directed graph representing the computer program function, the directed graph including a plurality of instruction nodes, each instruction node representing a corresponding instruction of the plurality of instructions; b) inserting, into the directed graph, a type meta-node corresponding to a type of instruction, the type meta-node pointing to a plurality of associated instruction nodes of the directed graph, each associated instruction node representing a corresponding instruction of the type corresponding to the type meta-node; c) employing the type meta-node to perform at least one of adding or removing at least one other instruction node to the directed graph; and d) translating the directed graph to an intermediate language representation of the computer program function; wherein the type corresponding to the type meta-node is at least one of a branch instruction, an exception block beginning, an exception block ending, an exception handler beginning, or an object allocation instruction. - View Dependent Claims (6, 7, 8)
-
-
9. A hardware computer-readable storage device comprising computer program instructions for enabling execution of a computer program function having a plurality of instructions including at least one branch instruction and at least one exception handler, the program instructions executable by a processor to perform actions including:
-
a) in response to detecting an invocation of the computer program function, generating a data structure representing the computer program function, the data structure including at least one directed graph, each of the plurality of instructions represented by a corresponding instruction node of the at least one directed graph; b) inserting, into the at least one directed graph, a back edge corresponding to each target of each branch instruction, the back edge indicating an instruction node representing the branch instruction corresponding to the target; c) employing the back edge to insert at least one instruction node into the at least one directed graph; d) inserting, into the at least one directed graph, at least one instruction type meta-node, each instruction type meta-node having one or more edges to a corresponding one or more instruction nodes of the at least one directed graph, the one or more instruction nodes representative of a type of instruction corresponding to the instruction type meta-node; e) employing the one or more edges of the at least one instruction type meta-node to insert at least one other instruction node into the at least one directed graph; and f) translating the data structure to an intermediate language representation of the computer program function. - View Dependent Claims (10, 11, 12, 13)
-
-
14. A computer-based system for translating and executing a computer program, comprising:
-
a) a run-time manager that in response to an invocation of a computer program function, generating a directed graph representing the computer program function, the directed graph including at least one instruction type meta-node pointing to at least one node representing an instruction of a designated type and further including an exception meta-node with a first edge to an exception block and a second edge to an exception handler corresponding to the exception block; b) an application that modifies the directed graph to insert one or more nodes representative of one or more program instructions for performing analysis of the computer program function; and c) a code generator that translates the directed graph to an executable representation of the computer program function; and d) a hardware processor that executes an executable representation of the computer program function; wherein the runtime manager manages execution of the executable representation of the computer program function. - View Dependent Claims (15, 16, 17, 18, 19)
-
Specification