Methods and apparatus for eliminating C recursion from interpreter loops
are disclosed. According to one aspect of the present invention, a computer-implemented
method for substantially eliminating C recursion from the execution of static initializer
methods in a virtual machine environment includes rewriting native C code associated
with a static initializer as a Java method, and using a transition frame
in a Java stack to execute the Java method. The method also includes
using a native method to manipulate the Java stack, and using a first opcode
in the transition frame. In one embodiment, using the first opcode in the transition
frame includes using the first opcode to determine that the transition frame is
associated with the static initializer. In another embodiment, the method further
includes causing the static initializer to run, wherein the static initializer
using a second opcode, and resuming execution at the second opcode after the static
initializer has run.