Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just-in-time compiler #28

Open
dvanhorn opened this issue Feb 12, 2021 · 0 comments
Open

Just-in-time compiler #28

dvanhorn opened this issue Feb 12, 2021 · 0 comments
Assignees

Comments

@dvanhorn
Copy link
Member

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.

@vyasgupta vyasgupta self-assigned this Mar 29, 2021
@OlasubomiEfuniyi OlasubomiEfuniyi self-assigned this Apr 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants