Patent ID: 7350200

Claim:
A method comprising: storing native code associated with a first method and a second method within a native code space; associating a reference to the first method and the second method in a method table; determining whether the first method or the second method is invoked by detecting whether the first method or the second method correspond to the native code; determining whether the native code space exceeds a predefined native code space size threshold in response to an invocation of the first method or the second method wherein the determination whether the native code space exceeds the predefined native code space size threshold is performed by native code size threshold check code inserted into a compilation stub of JVM; incrementing method counters each time the first method or the second method is invoked, wherein the method counters correspond to the first method and the second method; unwinding a stack to determine whether the first method or the second method is active based on whether a corresponding method counter has exceeded a count threshold; reclaiming the native code associated with the first method and compiling byte code into native code associated with the second method in response to determining that the second method is active; and updating the method table for the first method to reference an appropriate symbolic reference to the compilation stub.