Yes, the JIT in the JVM does just that for you.
In fact, it can generate faster code than compiling the code in advance, because it can generate code optimized for a particular platofrm based on how the code is used at runtime.
Peter Lawrey Jun 07 '10 at 19:01 2010-06-07 19:01
source share