Method and apparatus for dynamically optimizing byte-coded programs
First Claim
1. A computer-implemented method for processing a computer program during run-time, the computer program including byte codes, the byte codes being arranged as a plurality of methods, the computer-implemented method comprising:
- invoking a first method selected from the plurality of methods, wherein invoking the first selected method includes interpreting the first selected method;
determining when it is suitable to compile the first selected method; and
compiling the first selected method when it is determined that compiling the first selected method is suitable.
0 Assignments
0 Petitions
Accused Products
Abstract
Methods and apparatus for dynamically determining whether portions of code should be interpreted or compiled in order to optimize a software application during run-time are disclosed. According to one aspect of the present invention, computer-implemented method for run-time processing of a computer program which includes byte-codes arranged as a plurality of methods includes invoking a first method selected from the plurality of methods. Invoking the first selected method involves interpreting the first selected method. An invocation tracker which is arranged to track the number of invocations of the first selected method is updated, and a determination is made regarding when the invocation tracker indicates that the number of invocations of the first selected method exceeds a threshold value. The first selected method is compiled when it is determined that the invocation tracker indicates that the number of invocations of the first selected method exceeds a threshold value. This threshold value is periodically adjusted to keep the compilation and the interpretation overheads within acceptable ranges.
-
Citations
27 Claims
-
1. A computer-implemented method for processing a computer program during run-time, the computer program including byte codes, the byte codes being arranged as a plurality of methods, the computer-implemented method comprising:
-
invoking a first method selected from the plurality of methods, wherein invoking the first selected method includes interpreting the first selected method;
determining when it is suitable to compile the first selected method; and
compiling the first selected method when it is determined that compiling the first selected method is suitable. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
measuring a compilation overhead associated with compiling the first selected method;
determining when the compilation overhead is within an acceptable range; and
adjusting the threshold value when it is determined that the compilation overhead is not within the acceptable range.
-
-
8. A computer-implemented method as recited in claim 1 wherein determining when it is suitable to compile the first selected method includes monitoring an amount of time elapsed while interpreting the first selected method, wherein when the amount of time elapsed exceeds a threshold value, the first selected method is compiled.
-
9. A computer-implemented method as recited in claim 8 further including:
-
measuring a compilation overhead associated with compiling the first selected method;
determining when the compilation overhead is within an acceptable range; and
adjusting the threshold value when it is determined that the compilation overhead is not within the acceptable range.
-
-
10. A computer-implemented method as recited in claim 1 further including:
-
determining when to compile the first selected method when it is determined that compiling the first selected method is suitable; and
scheduling a compilation of the first selected method when it is determined that compiling the first selected method is suitable.
-
-
11. A computer-implemented method as recited in claim 10 wherein scheduling the compilation of the first selected method includes delaying the compilation of the first selected method before compiling the first selected method.
-
12. A computer-implemented method for processing a computer program during run-time, the program including byte codes, the byte codes being arranged as a plurality of methods, the computer-implemented method comprising:
-
invoking a first method selected from the plurality of methods, wherein invoking the first selected method includes calling a second method selected from the plurality of methods;
invoking the second selected method in response to calling the second selected method, the second selected method being invoked using the first selected method, wherein invoking the second selected method includes interpreting the second selected method;
tracking a number of invocations of the second selected method;
determining when the number of invocations of the second selected method exceeds a threshold value; and
compiling the first selected method when it is determined that the number of invocations of the second selected method exceeds the threshold value. - View Dependent Claims (13, 14, 15, 16)
-
-
17. A computer-implemented method for processing a computer program during run-time, the program including byte codes, the byte codes being arranged as a plurality of methods, the computer-implemented method comprising:
-
invoking a first method selected from the plurality of methods, wherein invoking the first selected method includes calling a second method selected from the plurality of methods;
invoking the second selected method in response to calling the second selected method, the second selected method being invoked using the first selected method, wherein invoking the second selected method includes interpreting the second selected method;
determining when time associated with interpreting the second selected method exceeds a threshold value; and
compiling the first selected method when it is determined that the time associated with interpreting the second selected method exceeds the threshold value. - View Dependent Claims (18, 19)
-
-
20. A computer program product for causing a computer to process byte codes during runtime, the byte codes being arranged as a plurality of methods, the computer program product comprising:
-
computer code for invoking a first method selected from the plurality of methods, wherein invoking the first selected method includes interpreting the first selected method;
computer code for determining when it is desirable to compile the first selected method;
computer code for compiling the first selected method when it is determined that compiling the first selected method is desirable; and
a computer-readable medium that stores the computer codes. - View Dependent Claims (21)
-
-
22. A computer system for executing byte codes, the byte codes being arranged as a plurality of methods, the computer system comprising:
-
an interpreter arranged to interpret a first method selected from the plurality of methods;
a mechanism for determining when it is beneficial to compile the first selected method; and
a compiler arranged to compile the first selected method when compiling the first selected method is determined to be beneficial. - View Dependent Claims (23, 24, 25)
-
-
26. A computer program product for processing byte codes during run-time, the byte codes being arranged as a plurality of methods, the computer program product comprising:
-
computer code for invoking a first method selected from the plurality of methods, wherein invoking the first selected method includes calling a second method selected from the plurality of methods;
computer code for invoking the second selected method in response to calling the second selected method, the second selected method being invoked using the first selected method, wherein invoking the second selected method includes interpreting the second selected method;
computer code for tracking a number of invocations of the second selected method;
computer code for determining when the number of invocations of the second selected method exceeds a threshold value;
computer code for compiling the first selected method when it is determined that the number of invocations of the second selected method exceeds the threshold value; and
a computer-readable medium that stores the computer codes. - View Dependent Claims (27)
-
Specification