[LLVMdev] Interactions with threads and native code

Evan Jones ejones at uwaterloo.ca
Thu Feb 10 17:31:12 PST 2005


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?

Evan Jones




More information about the llvm-dev mailing list