Methods and apparatus for compiling computer programs using partial function inlining
First Claim
1. A computer-implemented method for inlining code of a computer program, comprising:
- identifying a subprogram of the computer program, wherein the subprogram exhibits varying execution characteristics associated with corresponding execution paths;
identifying a range of variables associated with a first execution characteristic of the subprogram;
associating the range of variables with a first execution path of the subprogram;
coding an inline directive as part of a program comment statement associated with the first execution path; and
selectively inlining computer code of the first execution path of the subprogram based on the inline directive.
2 Assignments
0 Petitions
Accused Products
Abstract
A method and system makes inlining decisions that are efficient for subprograms that have significantly varying execution times over a range of variables or execution paths. A subprogram of a computer program is identified and certain execution paths of the subprogram are selectively inlined. The subprogram may be identified based on execution characteristics of the subprogram. The selective inlining of the execution paths may be based on execution characteristics of the paths. The paths may be selectively inlined based on an inline indication associated with an execution path, where the inline indication may be an inline directive. The inline directive may be included as part of a program comment statement. A compiler makes determinations whether to inline a specific execution path of a subprogram by evaluating certain information supplied in conjunction with the path. By supplying information in association with the subprogram path, the compiler may more easily determine the various execution characteristics of the execution paths and may inline or not based on the execution characteristic indication associated with the subprogram execution path.
-
Citations
32 Claims
-
1. A computer-implemented method for inlining code of a computer program, comprising:
-
identifying a subprogram of the computer program, wherein the subprogram exhibits varying execution characteristics associated with corresponding execution paths;
identifying a range of variables associated with a first execution characteristic of the subprogram;
associating the range of variables with a first execution path of the subprogram;
coding an inline directive as part of a program comment statement associated with the first execution path; and
selectively inlining computer code of the first execution path of the subprogram based on the inline directive. - View Dependent Claims (2, 3, 4, 5)
-
-
6. A computer program compiler for inlining computer program code, comprising:
-
a subprogram identification module that identifies subprograms of the computer code by identifying ranges of variables that each relate to a corresponding execution characteristic of a corresponding subprogram included in the computer code, associating the ranges of variables with certain execution paths of each of the subprograms, and inserting inline directives in a part of a program comment statement associated with each of the certain execution paths; and
a path identification module that selectively inlines computer code of the certain execution paths of the subprograms based on the inline directives.
-
-
7. A computer-implemented method of determining whether to replace subprogram code of a computer program, comprising the steps of:
-
identifying a subprogram that has a first and a second execution characteristic;
identifying certain arguments that cause the subprogram to exhibit the first execution characteristic;
associating the certain arguments that cause the subprogram to exhibit the first execution characteristic with a portion of the subprogram;
replacing the portion of the subprogram that exhibits the first execution characteristic with program instructions that explicitly define operations of the first execution characteristic; and
leaving intact a second portion of the subprogram that exhibits the second execution characteristic. - View Dependent Claims (8, 9, 10, 11, 12, 13, 14)
-
-
15. A computer readable medium for inlining computer program code, which when executed by a computer, performs the steps of:
-
identifying a subprogram that has a plurality of execution characteristics by identifying ranges of variables that cause the subprogram to exhibit the execution characteristics, associating a certain range of variables with one of the execution characteristics, and associating the certain range of variables with a selected portion of the subprogram that corresponds to the one execution characteristic;
inlining only the selected portion of the subprogram that corresponds to the one execution characteristic, wherein the selected portion is defined by a selected path of a plurality of execution paths that may be executed by the subprogram and the selected path is determined by identifying a non-executable statement configured to direct the computer to interpret at least a portion of the non-executable statement as a special directive. - View Dependent Claims (16, 17)
-
-
18. A computer-implemented method of replacing subprogram code in a computer system, comprising the steps of:
-
identifying a subprogram that operates in a first manner when operands passed to the subprogram fall within a first range of values and that operates in a second manner when operands passed to the subprogram fall within a second range of values;
associating the operands with the first range of values with an execution path of the subprogram;
replacing subprogram statements included in the execution path that cause the subprogram to operate in the first manner with expanded code.
-
-
19. An apparatus having a processor and a memory containing programs for inlining code of a computer program which when executed using the processor perform steps comprising:
-
identifying a subprogram of the computer program, wherein the subprogram exhibits varying execution characteristics associated with corresponding execution paths, the identifying including;
identifying a range of variables associated with a first execution characteristic of the subprogram, associating the range of variables with a first execution path of the subprogram, and coding an inline directive as part of a program comment statement associated with the first execution path; and
selectively inlining computer code of the first execution path of the subprogram based on the inline directive. - View Dependent Claims (20, 21, 22, 23)
-
-
24. An apparatus having a processor and a memory containing programs for determining whether to replace subprogram code of a computer program which when executed using the processor perform steps comprising:
-
identifying a subprogram that has a first and a second execution characteristic;
identifying certain arguments that cause the subprogram to exhibit the first execution characteristic;
associating the certain arguments that cause the subprogram to exhibit the first execution characteristic with a portion of the subprogram;
replacing the portion of the subprogram that exhibits the first execution characteristic with program instructions that explicitly define operations of the first execution characteristic; and
leaving intact a second portion of the subprogram that exhibits the second execution characteristic. - View Dependent Claims (25, 26, 27, 28, 29, 30, 31)
-
-
32. An apparatus having a processor and a memory containing programs for replacing subprogram code in a computer system which when executed using the processor perform steps comprising,
identifying a subprogram that operates in a first manner when operands passed to the subprogram fall within a first range of values and that operates in a second manner when operands passed to the subprogram fall within a second range of values; -
associating the operands that fall within a first range of values with one of many execution paths of the subprogram; and
replacing the subprogram statements included in the one execution path that cause the subprogram to operate in the first manner with expanded code.
-
Specification