4 ms·
> Whenever a program, while running, creates and runs some new executable code which was not part of the program when it was stored on disk, it’s a JIT. By thi
by celeritascelery 4y ago
> Whenever a program, while running, creates and runs some new executable code which was not part of the program when it was stored on disk, it’s a JIT.
By this definition, the Emacs native compiler would be a jit, even though it is considered an AoT compiler.
I think there needs to be another caveat, where a jit uses some run time information to generate the machine code.
It makes me wonder if there are any JIT compilers that generate code based on runtime data, but not at runtime? Similar to profile guided optimizations in static languages. Basically collect your traces and runtime info, then generate the code offline. This would let you take more time to optimize, and you could save the new code to disk and reuse it.
- adra 4y agoI believe that Graalvm has the ability to take an optimization snapshot at runtime to both build an initial boot pre-optimized mode but I think this is also how their native image is optimized. I'm not entirely sure if the Graalvm native images run a JIT.
- IainIreland 4y agoBy your definition, webassembly doesn't use a JIT, because it doesn't use any runtime information. In practice, the JIT/AOT distinction boils down to whether compilation time counts as part of execution time, or not. If cycles you spend optimizing your code are cycles you don't spend running it, you make different design decisions. (Note also that the Emacs native compiler is built using libgccjit.)
- skitter 4y agoDespite its name, libgccjit does aot just fine, e.g. as used in rustc's gcc backend. That said, I find your definition is the most meaningful.
- celeritascelery 4y agoTouché. I like that better.