News for hackers. Stuff that matters.
Re:How to write a simple JIT compiler by teaearlgraycold on Wednesday December 15, 2021 @12:30PM (#29568990)
To be pedantic, this is an in-memory AOT compiler and not a JIT compiler.

As an example, here's a JIT compiler I made for BrainFuck that defers the compilation of some loops: https://github.com/danthedaniel/BF-JIT/blob/master/src/runna...

Re:How to write a simple JIT compiler by ufo on Wednesday December 15, 2021 @12:35PM (#29569050)
To be a bit less pedantic, this is an area that is kind of ambiguous... From one point of view it's still fair to call this "just in time".

I wish there was terminology to differentiate between kind of "on demand AOT compilation" and jits that do jitty stuff that can't be done ahead of time.

Re:How to write a simple JIT compiler by chrisseaton on Wednesday December 15, 2021 @01:38PM (#29569920)
> I wish there was terminology to differentiate between kind of "on demand AOT compilation" and jits that do jitty stuff that can't be done ahead of time.

Some people differentiate between dynamic JIT compilation and static JIT compilation.

Re:How to write a simple JIT compiler by adgjlsfhk1 on Wednesday December 15, 2021 @12:39PM (#29569103)
Julia uses the term just ahead of time for this, which I think fits well.
Re:How to write a simple JIT compiler by duped on Wednesday December 15, 2021 @01:00PM (#29569363)
That strikes me as just-in-time optimization less so than ahead-of-time.

If the code isn't compiled until it's executed, "ahead of time" seems extremely confusing

Re:How to write a simple JIT compiler by ufo on Wednesday December 15, 2021 @01:11PM (#29569514)
Arguably the term "ahead of time" also suffers from the same problem. Among compiler people, "ahead of time" vs "just in time" sometimes has to do with whether the compiler uses run-time information when compiling. But the names don't reflect that, they talk about when the compilation happens.
Re:How to write a simple JIT compiler by jhgb on Wednesday December 15, 2021 @03:26PM (#29571181)
> kind of "on demand AOT compilation"

I assume you mean something like Common Lisp does with COMPILE? (http://clhs.lisp.se/Body/f_cmp.htm) That's just called "compilation" in some circles.