<div dir="ltr">Hello,<div><br></div><div>I'm performing certain analysis with LLVM and interpreter is more suitable.</div><div><br></div><div>Do you perhaps know is there a way to do things that I previously described using interpreter?</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 30, 2014 at 3:44 PM, David Chisnall <span dir="ltr"><<a href="mailto:David.Chisnall@cl.cam.ac.uk" target="_blank">David.Chisnall@cl.cam.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Jasmin,<br>
<br>
It would help if you would explain your reason for wanting to use the interpreter. If you want threads, typically it is because you want performance and so it would make more sense to compile the bitcode once with the JIT in the main function and then call the various functions from your threads.<br>
<span class="HOEnZb"><font color="#888888"><br>
David<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On 30 May 2014, at 14:28, Jasmin Jahic <<a href="mailto:jasmin.jahic@gmail.com">jasmin.jahic@gmail.com</a>> wrote:<br>
<br>
> Hello,<br>
><br>
> thank you for your answers. I'll explain my problem with giving you a concrete details.<br>
><br>
> I have a MAIN program which includes LLVM libraries and loads one bc file. From MAIN I execute different functions from the bc file using LLVM interpreter. On the LLVM website it is said:<br>
> "LLVMContext is an opaque class in the LLVM API which clients can use to operate multiple, isolated instances of LLVM concurrently within the same address space." - It seems that this is not correct or I'm not understanding it properly.<br>
><br>
> One context is used to create two modules, and based on modules all other things needed for the execution (engine builders, execution engines, functions). When functions are executed (sequentially), they are obviously executed in different memory space. I have verified this over access to the global variable.<br>
><br>
> However, if functions are executed using the same execution engine (context, module and execution builder the same), then they are executed in the same memory space. But using one execution engine is not suitable for threads, because one execution engine means one stack.<br>
><br>
> One option is to use different stack frames. Before trying that, I just wanted to ask is there a different way for sharing memory space between more execution engines?<br>
><br>
> Best regards,<br>
> Jasmin JAHIC<br>
><br>
><br>
> On Fri, May 30, 2014 at 12:28 PM, Renato Golin <<a href="mailto:renato.golin@linaro.org">renato.golin@linaro.org</a>> wrote:<br>
> On 30 May 2014 11:01, David Chisnall <<a href="mailto:David.Chisnall@cl.cam.ac.uk">David.Chisnall@cl.cam.ac.uk</a>> wrote:<br>
> > I think your question is a result of misunderstanding the nature of LLVM. It is not a virtual machine, it is an abstract machine and a set of tools implementing compilers for that abstract machine. You don't run the bitcode (well, you can interpret it, but you don't usually), you compile the bitcode and then run the resulting code. If you want to run the same code on all threads, then you just use the LLVM [MC]JIT to compile it once and then you call the generated functions from different threads.<br>
><br>
> Try VMKit:<br>
><br>
> <a href="http://vmkit.llvm.org/" target="_blank">http://vmkit.llvm.org/</a><br>
><br>
> They may have answered your question already.<br>
><br>
> --renato<br>
><br>
<br>
</div></div></blockquote></div><br></div>