You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An alternative to an ahead-of-time compiler as we've written is to write a just-in-time compiler.
If our original goal was to run Racket programs on x86 machines, we could have instead of writing a compiler from Racket programs to x86 instead written an interpreter for Racket in x86. In other words, we don't need a general compiler, we need to compile a single program: the interp.rkt program. And for a single program, we might as well do it by hand. (We can of course obtain this program by using our compiler now that we have it, too).
The problem with this approach is that program execution will be inefficient due to the interpretation overhead.
The idea of a JIT compiler is that the interpreter can instead of interpreting the program directly, first generate machine code and then execute that as it goes. So in other words the interpreter compiles expressions as needed and executes them.
For this project, study how JIT compilers are implemented and try to implement a JIT compiler for one of the subset languages of Racket (you might start with Iniquity to keep things simple).
An alternative to an ahead-of-time compiler as we've written is to write a just-in-time compiler.
If our original goal was to run Racket programs on x86 machines, we could have instead of writing a compiler from Racket programs to x86 instead written an interpreter for Racket in x86. In other words, we don't need a general compiler, we need to compile a single program: the interp.rkt program. And for a single program, we might as well do it by hand. (We can of course obtain this program by using our compiler now that we have it, too).
The problem with this approach is that program execution will be inefficient due to the interpretation overhead.
The idea of a JIT compiler is that the interpreter can instead of interpreting the program directly, first generate machine code and then execute that as it goes. So in other words the interpreter compiles expressions as needed and executes them.
For this project, study how JIT compilers are implemented and try to implement a JIT compiler for one of the subset languages of Racket (you might start with Iniquity to keep things simple).
I particularly like the approach of the PyPy folks (https://doc.pypy.org/en/latest/extradoc.html). In particular, take a look at https://www.researchgate.net/publication/252023163_Automatic_generation_of_JIT_compilers_for_dynamic_languages_in_NET.
The text was updated successfully, but these errors were encountered: