Open pgoodman opened 10 years ago
I think this is a really insightful email about HHVM's code gen approach, and I think it could apply really well to the proposed incremental takeover: http://article.gmane.org/gmane.comp.compilers.llvm.devel/78971
The idea being: collect profiling data, potentially for multiple targets, and then put their associated code into a one of the hot, cold, or frozen code regions.
Another related thing to the hot / cold / frozen code is general placement of fragments. It would be interesting if instrumented fragments could be placed into a colder region than app fragments, at least in the case where those instrumented fragments are predicated. Similarly, it might be interesting to allow for one to add an @unlikely
annotation to conditional jumps in inline assembly.
By default, Granary operates as a JIT. In theory, Granary can also operate as a load-time binary instrumentation system as well. I think there is a third option, which would be an incremental takeover. This option would only be well-defined for cases where Granary has control of specific program entrpoints that are continuously re-executed (e.g. system calls in the kernel).
Here's the idea:
This would have the interesting property that execution gets laid out nicely, but the overhead of translating would be isolated to a worker thread.