EP1589425B1

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

Abstract

This record has no abstract on file.

EP1589425B1, drawing sheet 1
Sheet 1 of 3

Term

Term ended

Expired 28 February 2025, 1.6 years ago.

  1. Priority
  2. Filed
  3. Granted
  4. Expired
  5. Today

15 claims: 11 independent, 4 dependent

  1. 1
    A method for determining a frequency of execution of compiled methods (112) within a virtual machine (102), the method comprising:providing a flag array (200), wherein each compiled method has a corresponding index into the flag array;when a compiled method is executed, setting (406) a flag bit in the flag array corresponding to the compiled method to indicate that the compiled method is executing, wherein setting the flag bit is performed by extra code generated during compilation of the method, and wherein the compiled method is one of the compiled methods executed within the virtual machine;periodically, scanning (502) the flag array and, for each compiled method, incrementing (504) the value of a corresponding counter (310) if the flag bit corresponding to the compiled method is set, and then resetting (506) the flag array;and for each compiled method, analyzing the value of the corresponding counter to determine a frequency of execution of the compiled method.
  2. 4
    The method of any preceding claim, 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 bit corresponding to the compiled method.
  3. 5
    The method of any preceding claim, 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 bit corresponding to the compiled method.
  4. 6
    The method of any preceding claim, 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 bit corresponding to the compiled method.
  5. 7
    The method of any preceding claim, 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 bit corresponding to the compiled method.
  6. 8
    The method of any preceding claim, 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 bit corresponding to the compiled method.
  7. 9
    The method of any preceding claim, further comprising evicting the compiled method if the frequency of execution of the compiled method is below a predetermined threshold, so that the method must be subsequently recompiled or interpreted if the compiled method is executed again.
  8. 11
    The method of any preceding claim, further comprising periodically decreasing the counter to introduce decay, thereby fading the relevance of historical execution of the compiled method over time.
  9. 13
    The method of any preceding claim, further comprising periodically increasing a weight value assigned to the flag bit so that subsequent executions of the compiled method count more than prior executions of the compiled method.
  10. 14
    A computer-readable storage medium storing instructions that when executed by a computer cause the computer to perform a method for determining a frequency of execution of compiled methods (112) within a virtual machine (102), the method comprising:providing a flag array (200), wherein each compiled method has a corresponding index into the flag array;when a compiled method is executed, setting a flag bit in the flag array corresponding to the compiled method to indicate that the compiled method is executing, wherein setting the flag bit is performed by extra code generated during compilation of the method, and wherein the compiled method is one of the compiled methods executed within the virtual machine;periodically, scanning the flag array and, for each compiled method, incrementing the value of a corresponding counter (310) if the flag bit corresponding to the compiled method is set, and then resetting the flag array;and for each compiled method, analyzing the value of the corresponding counter to determine a frequency of execution of the compiled method.
  11. 15
    Apparatus for determining a frequency of execution of compiled methods (112) within a virtual machine (102), the apparatus comprising:means for providing a flag array (200), wherein each compiled method has a corresponding index into the flag array;means for setting (406) a flag bit in the flag array corresponding to a compiled method when the compiled method is executed to indicate that the compiled method is executing, wherein setting the flag bit is performed by extra code generated during compilation of the method, and wherein the compiled method is one of the compiled methods executed within the virtual machine;means for periodically scanning (502) the flag array and, for each compiled method, incrementing (504) the value of a corresponding counter (310) if the flag bit corresponding to the compiled method is set, and then resetting (506) the flag array;and means for analyzing, for each compiled method, the value of the corresponding counter to determine a frequency of execution of the compiled method.