Proposal: C++ Should Support Just-in-Time Compilation
open-std.org
open-std.org
This would be exciting if it came to fruition at some point. Unfortunately C++ standard being what it is, we're looking at like 2025 before we see the first standard compliant implementation. Perhaps other languages could take this idea and run with it.
do you ? I've been doing JIT in C++ with the clang api for quite some time already. Sure, it's heavy in terms of "compile time" and binary size increase since you have to ship clang & llvm, but it enables some pretty cool stuff.
Does Lua-Terra (http://terralang.org/) accomplish what you're thinking of here, or have I completely misunderstood you?
Another commenter already mentioned LLVM, but here is a concrete example (https://weliveindetail.github.io/blog/post/2017/07/25/compil...). Of course it would still be nice not to be tied to a single compiler...
You can also use cling as a jupyter C++ kernel as well.
1. Be able to replace very complex template dispatch mechanisms with simple JIT ones.
Your suggestion is not possible, because you can't compile it once (maybe you can compile it a ton of times though!)
That is, unless someone has implemented a very very ridiculous set of dynamic detection and dispatch mechanisms, and your compiler supports changing microarchitecture/etc optimization per function or you split it out/ifdef it and compile the same file 5000 ways.
Even then, you will likely miss something the JIT will not, and you will be unable to support new architectures/microarchitectures without recompiling.
2. Be able to JIT things without changes to application source code.
3, Be able to easily integrate things like CUDA into the JIT model.
(FWIW: Hal is a very long time and well respected LLVM contributor, so he generally wouldn't suggest something trivially stupid :P)