
How to start JIT-ting - luu
https://blog.indutny.com/4.how-to-start-jitting
======
mntmn
I had a lot of fun recently getting my feet wet with JIT using GNU lightning.
I highly recommend to check it out because it's quite small and doesn't
require an industrial strength toolchain like LLVM. All you need to get
started is on one page:
[http://www.gnu.org/software/lightning/manual/lightning.html](http://www.gnu.org/software/lightning/manual/lightning.html)

In case you're curious, I built a working LISP compiler from it, but will have
to refactor it soon; it has central flaws in handling (un)boxing. Anyway:
[https://github.com/mntmn/bomberjacket/blob/master/sledge/com...](https://github.com/mntmn/bomberjacket/blob/master/sledge/compiler.c)

~~~
legulere
On the other hand, it uses lots of macro magic and can break at some points.
Also the amount of registers is restricted by 32 bit x86.

------
joe_the_user
It would be nice to have a reference on how to create a JIT compiler. I seems
like there really any system surveys of the subject equivalent to the "Dragon
Book" for regular compilers.

------
Zardoz84
I'm taking a look to asmJIT
([https://github.com/kobalicek/asmjit](https://github.com/kobalicek/asmjit)) ,
to implement a CPU core JIT emulator for Trillek ([https://github.com/trillek-
team/trillek-vcomputer-module](https://github.com/trillek-team/trillek-
vcomputer-module)). But always I find that there is a lack of information of
how handle self-rewriting code on a JIT emulator.

Actually I have some ideas using a mix buckets + interval tree to track
used/dirty blocks...

~~~
indutny
I think QEMU is using used/dirty blocks in some way to handle this.

