Claims
- 1. A method for dynamically compiling byte codes into native code to facilitate faster execution, comprising:
periodically determining if a currently executing thread is executing through the interpreter, and if so:
locating a method currently being executed by the thread, and compiling byte codes of the method into native code so that subsequent executions of the method execute native code.
- 2. The method of claim 1, further comprising suspending execution of the thread prior to compiling the method, and resuming execution of the thread after the method has compiled.
- 3. The method of claim 2, wherein resuming execution of the thread involves resuming execution of the method in interpreted mode utilizing byte codes.
- 4. The method of claim 2, wherein resuming execution of the thread involves resuming execution of the method utilizing native code rather than in interpreted mode utilizing byte codes.
- 5. The method of claim 4, wherein resuming execution of the thread utilizing native code involves replacing an activation record on the process stack with a compiled version of the activation record.
- 6. The method of claim 1, wherein periodically examining a currently executing thread involves examining the currently executing thread after receiving an interrupt.
- 7. The method of claim 6, wherein the interrupt is received from a tick timer that periodically generates interrupts for an operating system.
- 8. The method of claim 1, further comprising periodically removing native code for methods in order to free up memory space, thereby causing subsequent executions of the methods to execute byte codes in interpreted mode.
- 9. The method of claim 1, further comprising not compiling the method into native code if a predetermined threshold is met, wherein meeting the predetermined threshold can involve:
exceeding a processor time allowance; exceeding a memory usage allowance; or exceeding a memory storage quota.
- 10. A computer-readable storage medium storing instructions that when executed by a computer cause the computer to perform a method for dynamically compiling byte codes into native code to facilitate faster execution, comprising:
periodically determining if a currently executing thread is executing through the interpreter, and if so:
locating a method currently being executed by the thread, and compiling byte codes of the method into native code so that subsequent executions of the method execute native code.
- 11. The computer-readable storage medium of claim 10, further comprising suspending execution of the thread prior to compiling the method, and resuming execution of the thread after the method has compiled.
- 12. The computer-readable storage medium of claim 11, wherein resuming execution of the thread involves resuming execution of the method in interpreted mode utilizing byte codes.
- 13. The computer-readable storage medium of claim 11, wherein resuming execution of the thread involves resuming execution of the method utilizing native code rather than in interpreted mode utilizing byte codes.
- 14. The computer-readable storage medium of claim 13, wherein resuming execution of the thread utilizing native code involves replacing an activation record on the process stack with a compiled version of the activation record.
- 15. The computer-readable storage medium of claim 10, wherein periodically examining a currently executing thread involves examining the currently executing thread after receiving an interrupt.
- 16. The computer-readable storage medium of claim 15, wherein the interrupt is received from a tick timer that periodically generates interrupts for an operating system.
- 17. The computer-readable storage medium of claim 10, further comprising periodically removing native code for methods in order to free up memory space, thereby causing subsequent executions of the methods to execute byte codes in interpreted mode.
- 18. The computer-readable storage medium of claim 10, further comprising not compiling the method into native code if a predetermined threshold is met, wherein meeting the predetermined threshold can involve:
exceeding a processor time allowance; exceeding a memory usage allowance; or exceeding a memory storage quota.
- 19. An apparatus that dynamically compiles byte codes into native code to facilitate faster execution, comprising:
a determining mechanism configured to periodically determine if a currently executing thread is executing through the interpreter; and a dynamic compilation mechanism that is configured to,
locate a method currently being executed by the thread, and to compile byte codes of the method into native code so that subsequent executions of the method execute native code.
- 20. The apparatus of claim 19, further comprising a control mechanism configured to suspend execution of the thread prior to compiling the method, and to resume execution of the thread after the method has compiled.
- 21. The apparatus of claim 20, wherein the control mechanism is configured to resume execution of the thread by resuming execution of the method in interpreted mode utilizing byte codes.
- 22. The apparatus of claim 20, wherein the control mechanism is configured to resume execution of the thread by resuming execution of the method utilizing native code rather than in interpreted mode utilizing byte codes.
- 23. The apparatus of claim 22, wherein while resuming execution of the thread, the control mechanism is configured to utilize native code by replacing an activation record on the process stack with a compiled version of the activation record.
- 24. The apparatus of claim 19, wherein the determining mechanism is configured to examine the currently executing thread after receiving an interrupt.
- 25. The apparatus of claim 24, wherein the interrupt is received from a tick timer that periodically generates interrupts for an operating system.
- 26. The apparatus of claim 19, further comprising a de-optimization mechanism that is configured to periodically remove native code for methods in order to free up memory space, thereby causing subsequent executions of the methods to execute byte codes in interpreted mode.
- 27. The apparatus of claim 19, wherein the compiling mechanism is configured to not compile the method into native code if a predetermined threshold is met, wherein meeting the predetermined threshold can involve:
exceeding a processor time allowance; exceeding a memory usage allowance; or exceeding a memory storage quota.
RELATED APPLICATION
[0001] This application hereby claims priority under 35 U.S.C. §119 to U.S. Provisional Patent Application No. 60/332,925, filed on Nov. 14, 200 1, entitled “Improving Performance In Virtual Machines,” by inventors Lars Bak, Jacob R. Andersen, Kasper V. Lund and Steffen Grarup.
Provisional Applications (1)
|
Number |
Date |
Country |
|
60332925 |
Nov 2001 |
US |