Bril JIT with On-Stack Replacement
Interpreters
Many widely-used programming languages such as Python and JavaScript rely
heavily on interpreters. Some representation of the source code is passed to the
interpreter, where the instructions are evaluated immediately.
Since interpreters do not translate source programs to machine code and they
only consider the subset of instructions that are actually evaluated at run time,
startup cost for a program is minimized. This is huge for developers who may
update and run programs hundreds of times over. So interpreters are fast for
source translation but overall have slow performance because they are not
optimized for the architecture itself.
JITs and On-Stack Replacement
Ideally, we want to compile our program to machine code which will allow us to
perform platform specific optimizations. However, compilation can be costly and
in doing so, we lose the startup time benefit of an interpreter.
A just-in-time (JIT) compiler attemps to find the best of both worlds. Instead
of compiling source code ahead of time, a JIT compiler aims to compile code at
run time. There are three advantages to highlight with this approach:
cs.cornell.edu