One embodiment of the present invention provides a system that dynamically compiles
byte codes into native code to facilitate faster execution. This method operates
in a mixed-mode system that supports execution of both compiled code and interpreter
code. During operation, the system periodically determines if a currently executing
thread is executing through the interpreter. If so, the system locates the method
being executed by the thread and compiles the byte codes of the method into native
code. Subsequent executions of the method utilize the faster-executing native code.