Dear All, Here's a question Vikram and I received. Is the LLVM JIT thread safe? -- John T. -------------- next part -------------- An embedded message was scrubbed... From: "Adve, Vikram Sadanand" <vadve at uiuc.edu> Subject: Fwd: LLVM and threading Date: Thu, 1 Nov 2007 09:48:59 -0500 Size: 3037 URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20071101/f075a602/attachment.eml>
According to llvm.org/PR418, it should be. :-) --Owen On Nov 1, 2007, at 9:59 PM, John Criswell wrote:> Dear All, > > Here's a question Vikram and I received. Is the LLVM JIT thread safe? > > -- John T. > > > From: "Adve, Vikram Sadanand" <vadve at uiuc.edu> > Date: November 1, 2007 9:48:59 AM CDT > To: "Lenharth, Andrew David" <alenhar2 at uiuc.edu> > Cc: John Criswell <criswell at cs.uiuc.edu> > Subject: Fwd: LLVM and threading > > > Do you guys know if the LLVM JIT is thread-safe? Are there other > parts that are not? Thanks, > > --Vikram > http://www.cs.uiuc.edu/~vadve > http://llvm.org > > > Begin forwarded message: > >> From: Mark Oskin <oskin at cs.washington.edu> >> Date: November 1, 2007 8:57:45 AM CDT >> To: Vikram Adve <vadve at cs.uiuc.edu> >> Subject: LLVM and threading >> >> Hi Vikram- >> >> I've been digging through the LLVM stuff but I can't quite find a >> quick answer to this, so thought I'd ask. Does LLVM support threads? >> Has anyone done this already experimentally? Would it work if I >> didn't need the JIT, just targeted native x86? >> >> thanks! >> >> -Mark Oskin >> > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20071101/23b67b15/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2555 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20071101/23b67b15/attachment.bin>
>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:> Dear All, > > Here's a question Vikram and I received. Is the LLVM JIT thread safe? > > -- John T. > > > > ------------------------------------------------------------------------ > > Subject: > Fwd: LLVM and threading > From: > "Adve, Vikram Sadanand" <vadve at uiuc.edu> > Date: > Thu, 1 Nov 2007 09:48:59 -0500 > To: > "Lenharth, Andrew David" <alenhar2 at uiuc.edu> > > To: > "Lenharth, Andrew David" <alenhar2 at uiuc.edu> > CC: > John Criswell <criswell at cs.uiuc.edu> > > > Do you guys know if the LLVM JIT is thread-safe? Are there other > parts that are not? Thanks, > > --Vikram > http://www.cs.uiuc.edu/~vadve > http://llvm.org > > > Begin forwarded message: > > >> From: Mark Oskin <oskin at cs.washington.edu> >> Date: November 1, 2007 8:57:45 AM CDT >> To: Vikram Adve <vadve at cs.uiuc.edu> >> Subject: LLVM and threading >> >> Hi Vikram- >> >> I've been digging through the LLVM stuff but I can't quite find a >> quick answer to this, so thought I'd ask. Does LLVM support threads? >> Has anyone done this already experimentally? Would it work if I >> didn't need the JIT, just targeted native x86? >> >> thanks! >> >> -Mark Oskin >> >> > > > ------------------------------------------------------------------------ > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
On Nov 1, 2007, at 7:59 PM, John Criswell wrote:> Dear All, > Here's a question Vikram and I received. Is the LLVM JIT thread safe?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