Incremental whole program compilation of code
Abstract
Methods, systems, and computer program products are provided that enable incremental compilation of source code. Attributes of an intermediate language (IL) representation and a compiled representation of a source code are stored. Modified source code that is a revised version of the first source code is received. An IL representation of the modified source code is generated. Attributes of the revised intermediate IL and the stored attributes of the IL representation are compared to determine a first set of functions changed in the modified source code. A second set of functions in the first source code is determined that includes functions affected the determined first set of functions. The first and second sets of functions are compiled to generate a set of compiled functions. Compiled versions of the first and second sets are replaced in the compiled representation of the first source code with the set of compiled functions.
Claims
exact text as granted — not AI-modifiedWhat is claimed is:
1. A method, comprising:
generating a first intermediate language representation of a first source code;
generating a compiled representation of the first source code from the first intermediate language representation;
receiving modified source code that is a revised version of the first source code;
generating an intermediate language representation of the modified source code as a second intermediate language representation;
comparing attributes of the second intermediate language representation to attributes of the first intermediate language representation to determine a first set of functions changed in the modified source code relative to the first source code and any variables changed in the modified source code relative to the first source code;
determining a second set of functions in the first source code affected by at least one of
a function in the determined first set of functions, and
any variables determined to have changed; and
compiling the first set of functions and the second set of functions to generate a set of compiled functions to be replacements for the first and second set of functions in the compiled representation of the first source code.
2. The method of claim 1 , further comprising:
replacing compiled versions of the first and second sets of functions in the compiled representation of the first source code with the set of compiled functions to generate a compiled representation of the modified source code.
3. The method of claim 1 , wherein said comparing comprises:
determining a first set of checksums that includes a checksum calculated for each function in the first intermediate language representation;
determining a second set of checksums that includes a checksum calculated for each function in the second intermediate language representation; and
comparing the first set of checksums to the second set of checksums to determine at least one function that changed in the second intermediate language representation relative to the first intermediate language representation.
4. The method of claim 1 , wherein said comparing comprises:
comparing variables and associated attributes of the intermediate language representation to variables and associated attributes of the second intermediate language representation to determine any changed variables.
5. The method of claim 1 , wherein said determining comprises:
generating a dependence graph based on the first source code; and
analyzing the dependence graph to determine the second set of functions.
6. The method of claim 5 , wherein said generating a dependence graph based on the first source code comprises:
associating a node with each variable and with each function of the first intermediate language representation to designate a plurality of nodes;
determining a first set of directed edges, each directed edge of the first set extends from a first function node to a second function node of the dependence graph to indicate that a change in the function associated with the first function node affects the function associated with the second function node;
determining a second set of directed edges, each directed edge of the second set extends from a variable node to a third function node of the dependence graph to indicate that a change in the variable associated with the variable node affects the function associated with the third function node; and
storing a dependence graph that includes the plurality of nodes, the first set of directed edges, and the second set of directed edges.
7. The method of claim 6 , wherein said analyzing the dependence graph to determine the second set of functions comprises:
traversing directed edges of the first set of directed edges from a node for each function in the determined first set of functions to determine first affected functions;
traversing directed edges of the second set of directed edges from a node for each variable determined to have changed in the second intermediate language representation to determine second affected functions; and
the second set of functions including the first affected functions and the second affected functions.
8. A computing device, comprising:
at least one processor circuit; and
at least one memory that stores program code configured to be executed by the at least one processor circuit to perform operations, the operations including:
generating a first intermediate language representation of a first source code;
generating a compiled representation of the first source code from the first intermediate language representation;
receiving modified source code that is a revised version of the first source code;
generating an intermediate language representation of the modified source code as a second intermediate language representation;
comparing attributes of the second intermediate language representation to attributes of the first intermediate language representation to determine a first set of functions changed in the modified source code relative to the first source code and any variables changed in the modified source code relative to the first source code;
determining a second set of functions in the first source code affected by at least one of
a function in the determined first set of functions, and
any variables determined to have changed; and
compiling the first set of functions and the second set of functions to generate a set of compiled functions to be replacements for the first and second set of functions in the compiled representation of the first source code.
9. The computing device of claim 8 , wherein the operations further comprise:
replacing compiled versions of the first and second sets of functions in the compiled representation of the first source code with the set of compiled functions to generate a compiled representation of the modified source code.
10. The computing device of claim 8 , wherein said comparing comprises:
determining a first set of checksums that includes a checksum calculated for each function in the first intermediate language representation;
determining a second set of checksums that includes a checksum calculated for each function in the second intermediate language representation; and
comparing the first set of checksums to the second set of checksums to determine at least one function that changed in the second intermediate language representation relative to the first intermediate language representation.
11. The computing device of claim 8 , wherein said comparing comprises:
comparing variables and associated attributes of the intermediate language representation to variables and associated attributes of the second intermediate language representation to determine any changed variables.
12. The computing device of claim 8 , wherein said determining comprises:
generating a dependence graph based on the first source code; and
analyzing the dependence graph to determine the second set of functions.
13. The computing device of claim 12 , wherein said generating a dependence graph based on the first source code comprises:
associating a node with each variable and with each function of the first intermediate language representation to designate a plurality of nodes;
determining a first set of directed edges, each directed edge of the first set extends from a first function node to a second function node of the dependence graph to indicate that a change in the function associated with the first function node affects the function associated with the second function node;
determining a second set of directed edges, each directed edge of the second set extends from a variable node to a third function node of the dependence graph to indicate that a change in the variable associated with the variable node affects the function associated with the third function node; and
storing a dependence graph that includes the plurality of nodes, the first set of directed edges, and the second set of directed edges.
14. The computing device of claim 13 , wherein said analyzing the dependence graph to determine the second set of functions comprises:
traversing directed edges of the first set of directed edges from a node for each function in the determined first set of functions to determine first affected functions;
traversing directed edges of the second set of directed edges from a node for each variable determined to have changed in the second intermediate language representation to determine second affected functions; and
the second set of functions including the first affected functions and the second affected functions.
15. A computing device, comprising:
at least one processor circuit; and
at least one memory that stores program code configured to be executed by the at least one processor circuit to perform operations, the operations including:
generating a first intermediate language representation of a first source code;
generating a compiled representation of the first source code from the first intermediate language representation;
receiving modified source code that is a revised version of the first source code;
generating an intermediate language representation of the modified source code as a second intermediate language representation;
comparing attributes of the second intermediate language representation to attributes of the first intermediate language representation to determine a first set of functions changed in the modified source code relative to the first source and any variables changed in the modified source code relative to the first source code;
determining a second set of functions in the first source code affected by a function in the determined first set of functions and any variables determined to have changed; and
compiling the first set of functions and the second set of functions to generate a set of compiled functions to be replacements for the first and second set of functions in the compiled representation of the first source code.
16. The computing device of claim 15 , wherein the operations further comprise:
replacing compiled versions of the first and second sets of functions in the compiled representation of the first source code with the set of compiled functions to generate a compiled representation of the modified source code.
17. The computing device of claim 15 , wherein the operations further comprise:
comparing attributes of the second intermediate language representation and the attributes of the first intermediate language representation to determine any variables changed in the modified source code relative to the first source code; and
wherein said determining a second set of functions comprises:
determining the second set of functions to include any functions in the first source code affected by a variable determined to have changed.
18. The computing device of claim 17 , wherein said comparing attributes of the second intermediate language representation and the attributes of the first intermediate language representation to determine any variables changed in the modified source code relative to the first source code comprises:
comparing variables and associated attributes of the intermediate language representation to variables and associated attributes of the second intermediate language representation to determine any changed variables.
19. The computing device of claim 18 , wherein said determining comprises:
generating a dependence graph based on the first source code; and
analyzing the dependence graph to determine the second set of functions.
20. The computing device of claim 19 , wherein said generating a dependence graph based on the first source code comprises:
associating a node with each variable and with each function of the first intermediate language representation to designate a plurality of nodes;
determining a first set of directed edges, each directed edge of the first set extends from a first function node to a second function node of the dependence graph to indicate that a change in the function associated with the first function node affects the function associated with the second function node;
determining a second set of directed edges, each directed edge of the second set extends from a variable node to a third function node of the dependence graph to indicate that a change in the variable associated with the variable node affects the function associated with the third function node; and
storing a dependence graph that includes the plurality of nodes, the first set of directed edges, and the second set of directed edges.Cited by (0)
No later patents cite this yet.
References (0)
No backward citations on record.