IP Library Granted Patent US 7,412,693
Granted Patent B2
US 7,412,693 · App. 10/966,086 · Granted Aug 12, 2008

Method and apparatus for determining frequency of execution for compiled methods within a virtual machine

View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 7,412,693
App. No.
10/966,086
Granted
Aug 12, 2008
Kind
B2
Abstract

One embodiment of the present invention provides a system that facilitates determining a frequency of execution of compiled methods within a virtual machine. The system starts by determining if a compiled method is executing. If so, the system sets a flag corresponding to the compiled method to indicate that the compiled method is executing. Periodically, the system scans the flag and increments the value of a corresponding counter if the flag is set, and then resets the flag. Finally, the system analyzes the value of the counter to determine a frequency of execution of the compiled method.

Claims (57)

1. A method for determining a relative frequency of execution of compiled methods within a virtual machine, the method comprising:

a flag array wherein each compiled method has a corresponding index into the flag array;

wherein each compiled method has a corresponding counter;

when a compiled method is executed, setting a flag in the flag array corresponding to the compiled method to indicate that the compiled method is executing;

periodically, scanning the flag array and for each compiled method, incrementing a value of the corresponding counter if the flag corresponding to the compiled method is set to indicate that the compiled method has executed at least once since the flag array was last reset, and then resetting the flag array for subsequent scanning; and

for each compiled method, analyzing the value of the corresponding counter to determine a relative frequency of execution of each of the compiled methods.

2. The method of claim 1 , further comprising adjusting a time interval between incrementations of the counter.

3. The method of claim 1 , wherein determining when the compiled method is executed further involves executing an instruction when the compiled method calls a second compiled method, wherein the instruction sets the flag corresponding to the compiled method.

4. The method of claim 1 , wherein determining when the compiled method is executed further involves executing an instruction when the compiled method is called by a second compiled method, wherein the instruction sets the flag corresponding to the compiled method.

5. The method of claim 1 , wherein determining when the compiled method is executed further involves executing an instruction when returning to a second compiled method from the compiled method, wherein the instruction sets the flag corresponding to the compiled method.

6. The method of claim 1 , wherein determining when the compiled method is executed further involves executing an instruction when returning to the compiled method from a second compiled method, wherein the instruction sets the flag corresponding to the compiled method.

7. The method of claim 1 , wherein determining when the compiled method is executed further involves executing an instruction when initiating a backward branch within the compiled method, wherein the instruction sets the flag corresponding to the compiled method.

8. The method of claim 1 , wherein determining when the compiled method is executed further involves executing an instruction at a target for a backward branch within the compiled method, wherein the instruction sets the flag corresponding to the compiled method.

9. The method of claim 1 , further comprising evicting the compiled method if the frequency of execution of the compiled method is below a predetermined threshold, so that the compiled method must be subsequently recompiled or interpreted if the compiled method is executed again.

10. The method of claim 9 , further comprising adjusting the predetermined threshold to regulate a number of compiled methods.

11. The method of claim 1 , further comprising periodically decreasing the counter to introduce decay, thereby fading a relevance of historical execution of the compiled method over time.

12. The method of claim 11 , further comprising periodically decreasing the counter when any counter associated with any method reaches a predetermined threshold.

13. The method of claim 1 , further comprising periodically increasing a weight value assigned to the flag so that subsequent executions of the compiled method count more than prior executions of the compiled method.

14. A computer-readable storage medium storing instructions that when executed by a computer cause the computer to perform a method for determining a relative frequency of execution of compiled methods within a virtual machine, the method comprising:

a flag array wherein each compiled method has a corresponding index into the flag array;

wherein each compiled method has a corresponding counter;

when a compiled method is executed, setting a flag in the flag array corresponding to the compiled method to indicate that the compiled method is executing;

periodically, scanning the flag array and for each compiled method, incrementing a value of the corresponding counter if the flag corresponding to the compiled method is set to indicate that the compiled method has executed at least once since the flag array was last reset, and then resetting the flag array for subsequent scanning; and

for each compiled method, analyzing the value of the corresponding counter to determine a relative frequency of execution of each of the compiled methods.

15. The computer-readable storage medium of claim 14 , wherein the method further comprises adjusting a time interval between incrementations of the counter.

16. The computer-readable storage medium of claim 14 , wherein determining when the compiled method is executed further involves executing an instruction when the compiled method calls a second compiled method, wherein the instruction sets the flag corresponding to the compiled method.

17. The computer-readable storage medium of claim 14 , wherein determining when the compiled method is executed further involves executing an instruction when the compiled method is called by a second compiled method, wherein the instruction sets the flag corresponding to the compiled method.

18. The computer-readable storage medium of claim 14 , wherein determining when the compiled method is executed further involves executing an instruction when returning to a second compiled method from the compiled method, wherein the instruction sets the flag corresponding to the compiled method.

19. The computer-readable storage medium of claim 14 , wherein determining when the compiled method is executed further involves executing an instruction when returning to the compiled method from a second compiled method, wherein the instruction sets the flag corresponding to the compiled method.

20. The computer-readable storage medium of claim 14 , wherein determining when the compiled method is executed further involves executing an instruction when initiating a backward branch within the compiled method, wherein the instruction sets the flag corresponding to the compiled method.

21. The computer-readable storage medium of claim 14 , wherein determining when the compiled method is executed further involves executing an instruction at a target for a backward branch within the compiled method, wherein the instruction sets the flag corresponding to the compiled method.

22. The computer-readable storage medium of claim 14 , wherein the method further comprises evicting the compiled method if the frequency of execution of the compiled method is below a predetermined threshold, so that the compiled method must be subsequently recompiled or interpreted if the compiled method is executed again.

23. The computer-readable storage medium of claim 22 , wherein the method further comprises adjusting the predetermined threshold to regulate a number of compiled methods.

24. The computer-readable storage medium of claim 14 , wherein the method further comprises periodically decreasing the counter to introduce decay, thereby fading a relevance of historical execution of the compiled method over time.

25. The computer-readable storage medium of claim 24 , wherein the method further comprises periodically decreasing the counter when any counter associated with any method reaches a predetermined threshold.

26. The computer-readable storage medium of claim 14 , wherein the method further comprises periodically increasing a weight value assigned to the flag so that subsequent executions of the compiled method count more than prior executions of the compiled method.

27. An apparatus for determining a relative frequency of execution of compiled methods within a virtual machine, comprising:

a processor;

a memory;

a flag array wherein each compiled method has a corresponding index into the flag array;

wherein each compiled method has a corresponding counter;

a determination mechanism configured to determine when a compiled method is executed;

a flag setting mechanism configured to set a flag in the flag array corresponding to the compiled method to indicate that the compiled method is executing, if the compiled method is executing;

a scanning mechanism configured to periodically scan the flag array and for each compiled method, increment a value of the corresponding counter if the flag corresponding to the compiled method is set to indicate that the compiled method has executed at least once since the flag array was last reset, and to reset the flag array for subsequent scanning; and

an analysis mechanism configured to analyze the value of the corresponding counter for each compiled method to determine a relative frequency of execution of each of the compiled methods.

28. The apparatus of claim 27 , further comprising an adjustment mechanism configured to adjust a time interval between incrementations of the counter.

29. The apparatus of claim 27 , wherein the determination mechanism is further configured to determine when the compiled method is executed by executing an instruction when the compiled method calls a second compiled method, wherein the instruction sets the flag corresponding to the compiled method.

30. The apparatus of claim 27 , wherein the determination mechanism is further configured to determine when the compiled method is executed by executing an instruction when the compiled method is called by a second compiled method, wherein the instruction sets the flag corresponding to the compiled method.

31. The apparatus of claim 27 , wherein the determination mechanism is further configured to determine when the compiled method is executed by executing an instruction when returning to a second compiled method from the compiled method, wherein the instruction sets the flag corresponding to the compiled method.

32. The apparatus of claim 27 , wherein the determination mechanism is further configured to determine when the compiled method is executed by executing an instruction when returning to the compiled method from a second compiled method, wherein the instruction sets the flag corresponding to the compiled method.

33. The apparatus of claim 27 , wherein the determination mechanism is further configured to determine when the compiled method is executed by executing an instruction when initiating a backward branch within the compiled method, wherein the instruction sets the flag corresponding to the compiled method.

34. The apparatus of claim 27 , wherein the determination mechanism is further configured to determine when the compiled method is executed by executing an instruction at a target for a backward branch within the compiled method, wherein the instruction sets the flag corresponding to the compiled method.

35. The apparatus of claim 27 , further comprising an eviction mechanism configured to evict the compiled method if the frequency of execution of the compiled method is below a predetermined threshold, so that the compiled method must be subsequently recompiled or interpreted if the compiled method is executed again.

36. The apparatus of claim 35 , further comprising an adjustment mechanism configured to adjust the predetermined threshold to regulate a number of compiled methods.

37. The apparatus of claim 27 , further comprising a decay mechanism configured to periodically decrease the counter to introduce decay, thereby fading a relevance of historical execution of the compiled method over time.

38. The apparatus of claim 37 , wherein the decay mechanism is further configured to periodically decrease the counter when any counter associated with any method reaches a predetermined threshold.

39. The apparatus of claim 27 , further comprising a weighting mechanism configured to periodically increase a weight value assigned to the flag so that subsequent executions of the compiled method count more than prior executions of the compiled method.

Assignments (8)
CORRECTIVE ASSIGNMENT TO CORRECT THE REMOVE APPLICATION 11759915 AND REPLACE IT WITH APPLICATION 11759935 PREVIOUSLY RECORDED ON REEL 040925 FRAME 0001. ASSIGNOR(S) HEREBY CONFIRMS THE RELEASE OF SECURITY INTEREST. Recorded Feb 17, 2020
From: MORGAN STANLEY SENIOR FUNDING, INC.
To: NXP, B.V. F/K/A FREESCALE SEMICONDUCTOR, INC.
Reel/Frame 052917/0001 →
CORRECTIVE ASSIGNMENT TO CORRECT THE REMOVE APPLICATION 11759915 AND REPLACE IT WITH APPLICATION 11759935 PREVIOUSLY RECORDED ON REEL 040928 FRAME 0001. ASSIGNOR(S) HEREBY CONFIRMS THE RELEASE OF SECURITY INTEREST. Recorded Jan 17, 2020
From: MORGAN STANLEY SENIOR FUNDING, INC.
To: NXP B.V.
Reel/Frame 052915/0001 →
CORRECTIVE ASSIGNMENT TO CORRECT THE REMOVE APPLICATION 11759915 AND REPLACE IT WITH APPLICATION 11759935 PREVIOUSLY RECORDED ON REEL 037486 FRAME 0517. ASSIGNOR(S) HEREBY CONFIRMS THE ASSIGNMENT AND ASSUMPTION OF SECURITY INTEREST IN PATENTS. Recorded Dec 10, 2019
From: CITIBANK, N.A.
To: MORGAN STANLEY SENIOR FUNDING, INC.
Reel/Frame 053547/0421 →
RELEASE OF SECURITY INTEREST Recorded Nov 7, 2016
From: MORGAN STANLEY SENIOR FUNDING, INC.
To: NXP B.V.
Reel/Frame 040928/0001 →
RELEASE OF SECURITY INTEREST Recorded Sep 21, 2016
From: MORGAN STANLEY SENIOR FUNDING, INC.
To: NXP, B.V., F/K/A FREESCALE SEMICONDUCTOR, INC.
Reel/Frame 040925/0001 →
ASSIGNMENT AND ASSUMPTION OF SECURITY INTEREST IN PATENTS Recorded Jan 12, 2016
From: CITIBANK, N.A.
To: MORGAN STANLEY SENIOR FUNDING, INC.
Reel/Frame 037486/0517 →
MERGER AND CHANGE OF NAME Recorded Dec 16, 2015
From: ORACLE USA, INC.; SUN MICROSYSTEMS, INC.; ORACLE AMERICA, INC.
To: ORACLE AMERICA, INC.
Reel/Frame 037303/0349 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 15, 2004
From: MATHISKE, BERND J.W.; PLISS, OLEG A.
To: SUN MICROSYSTEMS, INC.
Reel/Frame 015904/0788 →