Just In Time

Program-Transformation.Org: The Program Transformation Wiki
Just In Time dynamic compilers, also called JITs, are programs that postpone compilation (translation from some input language such as Java ByteCodes) until the code is actually needed to be run. At that point, the input code is translated into native machine instructions to form a code fragment, which is also stored in the fragment cache. If the code is needed again later, it is run from the cache at full native speed, so the cost of translation is amortized over many runs of the code.

Actually, many JITs do not translate all input code. Only code that is known to be executed several times (a so called "hot trace") is translated; other code may be interpreted. This would be a two stage DynamicTranslator. A multistage JIT such as Sun's HotSpot (server version) also performs expensive optimizations usually reserved for StaticTranslators.

To find out what code is hot and what is not, the input code must be instrumented. For example, counters may be placed at the start of methods, and at all backwards conditional branches (which may form the end of loops).

-- MikeVanEmmerik - 01 Dec 2001