Method and apparatus for dynamic compilation of selective code blocks of computer programming code to different memory locations
First Claim
1. A method for executing a program in a dynamically compiled environment, comprising the steps of:
- dynamically measuring execution frequency of a plurality of portions of said program during program execution;
dynamically compiling at least part of said program, said compiling step placing compiled code embodying a first subset of said plurality of portions in a first memory location, and placing compiled code embodying a second subset of said plurality of portions in a second memory location different from said first memory location, wherein compiled code is allocated to said first and second memory locations using said dynamically measured execution frequency; and
executing code compiled by said dynamically compiling step.
1 Assignment
0 Petitions
Accused Products
Abstract
A dynamic compiler analyzes the frequency of execution of selective code paths within a program procedure, and selectively compiles code paths to different memory locations based on the observed frequency of execution. Preferably, code is dynamically compiled in two stages. In a first compilation stage, the compiler instruments selective code paths to count the number of times each path is taken. A second stage compilation is thereafter triggered when the procedure has been called some threshold number of times. In the second stage, the compiler selectively re-compiles the more frequently executed code paths to a primary location, and re-compiles the remaining code paths to an alternate location. Placing infrequently executed code in an alternate location reduces the size of the primary code area, improving execution efficiency.
73 Citations
26 Claims
-
1. A method for executing a program in a dynamically compiled environment, comprising the steps of:
-
dynamically measuring execution frequency of a plurality of portions of said program during program execution;
dynamically compiling at least part of said program, said compiling step placing compiled code embodying a first subset of said plurality of portions in a first memory location, and placing compiled code embodying a second subset of said plurality of portions in a second memory location different from said first memory location, wherein compiled code is allocated to said first and second memory locations using said dynamically measured execution frequency; and
executing code compiled by said dynamically compiling step. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
-
-
10. A computer program product supporting execution of a program in a dynamically compiled environment, comprising:
-
a plurality of computer executable instructions recorded on signal-bearing media, wherein said instructions, when executed by at least one computer system, cause the at least one computer system to perform the steps of;
dynamically measuring execution frequency of a plurality of portions of said program during program execution;
dynamically compiling at least part of said program, said compiling step placing compiled code embodying a first subset of said plurality of portions in a first memory location, and placing compiled code embodying a second subset of said plurality of portions in a second memory location different from said first memory location, wherein compiled code is allocated to said first and second memory locations using said dynamically measured execution frequency; and
executing code compiled by said dynamically compiling step. - View Dependent Claims (11, 12, 13, 14, 15, 16, 17, 18)
-
-
19. A computer system, comprising:
-
at least one processor;
a memory;
a dynamic compilation execution facility embodied as a plurality of instructions storable in said memory for execution by said at least one processor, said dynamic compilation execution facility dynamically compiling computer programs invoked for execution on said at least one processor;
wherein said dynamic compilation execution facility dynamically compiles a first subset of portions of a program invoked for execution to a primary code cache at a first location in said memory, and dynamically compiles a second subset of portions of said program invoked for execution to a cold code cache at a second location in said memory, said first and second subsets being discrete, said first and second locations being different, said dynamic compilation execution facility automatically determining whether each respective portion of said program is to be compiled to said primary code cache and whether each respective portion is to be compiled to said cold code cache using a respective determination of execution frequency associated with the respective portion. - View Dependent Claims (20, 21, 22, 23)
-
-
24. A method for executing a program in a dynamically compiled environment, comprising the steps of:
-
generating instrumentation code for at least part of said program during program execution, said instrumentation code measuring a respective execution frequency associated with each of a plurality of portions of said program;
obtaining execution frequency data from said instrumentation code during program execution;
dynamically compiling at least part of said program, said compiling step placing compiled code embodying a first subset of said plurality of portions in a primary code cache at a first memory location, and placing compiled code embodying a second subset of said plurality of portions in a cold code cache at a second memory location different from said first memory location, said first and second subsets being discrete, wherein compiled code is allocated to said primary code cache and said cold code cache using said execution frequency data; and
executing code compiled by said dynamically compiling step.
-
-
25. The method for executing a program in a dynamically compiled environment of claim 31, further comprising the step of:
-
wherein said step of generating instrumentation code is performed as part of a first stage compilation of at least part of said program;
wherein said step of dynamically compiling at least part of said program comprises re-compiling at least a part of said program compiled by said first stage compilation after performing said first stage compilation.
-
-
26. The method for executing a program in a dynamically compiled environment of claim 31, wherein said instrumentation code dynamically measures respective frequencies of execution of branch paths of a plurality of gating branches of said program.
Specification