[llvm-commits] VM hooks when locking

Chris Lattner clattner at apple.com
Fri Jul 31 08:35:29 PDT 2009


On Jul 31, 2009, at 1:25 AM, Owen Anderson wrote:

>
> On Jul 31, 2009, at 12:24 AM, Nicolas Geoffray wrote:
>> Another solution would be to only call the hooks with the JIT lock.  
>> The
>> other locks are all internals and won't block the threads too long.
>> Would you prefer that solution? That requires to track all places  
>> where
>> the JIT lock is used, so it's more error-prone.
>
> I like this solution better in general, and I don't think it needs  
> to be error-prone.  Why not introduce a little wrapper class for the  
> JIT lock which calls the hooks before and after locking the real lock?

Why do we even need this?  It seems that vmkit has very very specific  
needs here.  Why not have a vmkit lock which is redundant with the  
llvm lock?  You can wrap the same scope as the JIT and that way you'll  
know the acquire of the LLVM lock will always succeed.  This way, you  
only make VMKit more complicated, not all of llvm.  If you need  
callbacks from the compilation-callback path, that would be very  
reasonable to add.

-Chris



More information about the llvm-commits mailing list