[LLVM and threading]

Dear All,

Here's a question Vikram and I received. Is the LLVM JIT thread safe?

-- John T.

Fwd: LLVM and threading.eml (2.93 KB)

According to llvm.org/PR418, it should be. :slight_smile:

–Owen

From what I know:

1) Static compilation is not thread safe. For example, the LLVM type
tables are not thread safe.
2) The JIT is mostly thread safe. There are however some improvements to
do with dynamic method patching.

Nicolas

John Criswell wrote:

Yes it is (it acquires a lock before jit'ing). Note that LLVM itself is not thread-safe, so if your main thread is generating llvm IR dynamically, you have to take the JIT lock to prevent the JIT from hurting any generator of IR.

-Chris