[llvm-commits] [llvm] r85295 - in /llvm/trunk: docs/tutorial/LangImpl4.html docs/tutorial/OCamlLangImpl4.html include/llvm/ExecutionEngine/ExecutionEngine.h lib/ExecutionEngine/ExecutionEngine.cpp lib/ExecutionEngine/JIT/JIT.cpp lib/ExecutionEngi

Jeffrey Yasskin jyasskin at google.com
Tue Oct 27 23:07:18 PDT 2009


On Tue, Oct 27, 2009 at 10:03 PM, Evan Cheng <evan.cheng at apple.com> wrote:
> I believe lazy compilation should still be the
> default behavior for JIT. If it's not thread safe, then clients who want JIT
> safety should fix it.

You say that as if it's an easy thing to do and can be done once and
for all. You should probably read the bug (http://llvm.org/PR5184) to
see why that's wrong.

As to why lazy compilation should not be the default: it has confused
users who tried running their JITs under helgrind and got reports
inside one of the most confusing parts of the JIT. When the race
actually bites users, it's going to be extremely hard to debug, since
it happens when a call is first executed and depends on exactly how
the call was aligned. And there are other races in the JIT unless you
hold the JIT lock around all IR manipulation. I don't think it's a
good idea to make the default behavior of LLVM crash randomly in
hard-to-debug ways. Finally, I haven't heard of any cases besides lli
where the current lazy JIT is actually the right choice for
performance.

Now, lazy JITting is safe in a single-threaded program. It might make
sense to change the default depending on whether
llvm_start_multithreaded() has been called, but that seemed more
confusing than saying that you always have to enable it if you want
it.



More information about the llvm-commits mailing list