c++jit

Hot recompilation for C++


I was recently amazed to see Java code being automatically recompiled and injected into a running program. Since modern C++ compilers (eg. LLVM-based) start investigating JIT compilation, I am wondering if there is any work made on this topic.

Update: By "hot recompilation", I mean editing the code, recompiling a specific part of the executable and running it without restarting the program. The common use case would be a game engine with an infinite loop where you would edit some code in the rendering step, and see the changes on the next frame.

What is the research state of hot recompilation for C++? Is there any working implementation?


Solution

  • It's possible that by "hot recompilation" you mean something like "Edit and continue" in Visual C++.

    Maybe that link constitutes an answer to your question.

    But it would be easier if you would define the term you're asking about, "hot recompilation", more clearly (as I'm writing this it's not well defined).

    added: "Edit and continue" for C++ was apparently introduced with Visual C++ 6.0, in the 1990's. So it's only slightly amazing that some Java implementation can do it now. <g> However, the /Zi switch that enables edit-and-continue does also, as I recall, change the behavior of __LINE__ so that e.g. the original ScopeGuard implementation doesn't work (one then has to use Microsoft-specific __COUNTER__).

    Cheers & hth.,