[LLVMdev] Interactions with threads and native code

Chris Lattner sabre at nondot.org
Thu Feb 10 20:47:35 PST 2005


On Thu, 10 Feb 2005, Evan Jones wrote:

> On Feb 8, 2005, at 23:52, Chris Lattner wrote:
>> That would be great.  As a first implementation, I would suggest adding a 
>> lock to the ExecutionEngine class in 
>> include/llvm/ExecutionEngine/ExecutionEngine.h, locking it when particular 
>> state is accessed.  Note that the JIT subclasses this in 
>> lib/ExecutionEngine/JIT/JIT.h, so its accesses should be synchronized as 
>> well.
>
> I took a quick look at the code this evening and I think I have a first cut 
> plan: Add a mutex to ExecutionEngine, then lock it in *all* the public 
> methods in ExecutionEngine and JIT. This is not a smart approach, but it 
> would work. The problem is that any other subclasses would also need to do 
> the same thing, at least if they access any of the state in ExecutionEngine.
>
> Any thoughts about this? Am I crazy, or would it work? Are there any other 
> classes that would need similar modification?

I think that will work fine.  The only two subclasses of that are the JIT 
and Interpreter.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.cs.uiuc.edu/




More information about the llvm-dev mailing list