<div dir="ltr">Ping :-)</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 30, 2014 at 8:13 PM, Bruno Cardoso Lopes <span dir="ltr"><<a href="mailto:bruno.cardoso@gmail.com" target="_blank">bruno.cardoso@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Chandler,<br>
<br>
IIRC, you're working on a fix for the compile time regression caused<br>
by this commit. Gently ping :-)<br>
Any news on a that or any ideas you may share on how to solve it?<br>
<br>
Thanks again,<br>
<br>
Reference: <a href="http://llvm.org/bugs/show_bug.cgi?id=20641" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=20641</a><br>
<div class="HOEnZb"><div class="h5"><br>
On Fri, Jun 27, 2014 at 12:13 PM, Chandler Carruth <<a href="mailto:chandlerc@gmail.com">chandlerc@gmail.com</a>> wrote:<br>
> Author: chandlerc<br>
> Date: Fri Jun 27 10:13:01 2014<br>
> New Revision: 211900<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=211900&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=211900&view=rev</a><br>
> Log:<br>
> Re-apply r211287: Remove support for LLVM runtime multi-threading.<br>
><br>
> I'll fix the problems in libclang and other projects in ways that don't<br>
> require <mutex> until we sort out the cygwin situation.<br>
><br>
> Modified:<br>
>     llvm/trunk/docs/ProgrammersManual.rst<br>
>     llvm/trunk/include/llvm-c/Core.h<br>
>     llvm/trunk/include/llvm/Support/ManagedStatic.h<br>
>     llvm/trunk/include/llvm/Support/Threading.h<br>
>     llvm/trunk/lib/IR/Core.cpp<br>
>     llvm/trunk/lib/Support/Threading.cpp<br>
>     llvm/trunk/unittests/Support/ManagedStatic.cpp<br>
><br>
> Modified: llvm/trunk/docs/ProgrammersManual.rst<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ProgrammersManual.rst?rev=211900&r1=211899&r2=211900&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ProgrammersManual.rst?rev=211900&r1=211899&r2=211900&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/docs/ProgrammersManual.rst (original)<br>
> +++ llvm/trunk/docs/ProgrammersManual.rst Fri Jun 27 10:13:01 2014<br>
> @@ -2170,46 +2170,13 @@ compiler, consider compiling LLVM and LL<br>
>  using the resultant compiler to build a copy of LLVM with multithreading<br>
>  support.<br>
><br>
> -.. _startmultithreaded:<br>
> -<br>
> -Entering and Exiting Multithreaded Mode<br>
> ----------------------------------------<br>
> -<br>
> -In order to properly protect its internal data structures while avoiding<br>
> -excessive locking overhead in the single-threaded case, the LLVM must intialize<br>
> -certain data structures necessary to provide guards around its internals.  To do<br>
> -so, the client program must invoke ``llvm_start_multithreaded()`` before making<br>
> -any concurrent LLVM API calls.  To subsequently tear down these structures, use<br>
> -the ``llvm_stop_multithreaded()`` call.  You can also use the<br>
> -``llvm_is_multithreaded()`` call to check the status of multithreaded mode.<br>
> -<br>
> -Note that both of these calls must be made *in isolation*.  That is to say that<br>
> -no other LLVM API calls may be executing at any time during the execution of<br>
> -``llvm_start_multithreaded()`` or ``llvm_stop_multithreaded``.  It is the<br>
> -client's responsibility to enforce this isolation.<br>
> -<br>
> -The return value of ``llvm_start_multithreaded()`` indicates the success or<br>
> -failure of the initialization.  Failure typically indicates that your copy of<br>
> -LLVM was built without multithreading support, typically because GCC atomic<br>
> -intrinsics were not found in your system compiler.  In this case, the LLVM API<br>
> -will not be safe for concurrent calls.  However, it *will* be safe for hosting<br>
> -threaded applications in the JIT, though :ref:`care must be taken<br>
> -<jitthreading>` to ensure that side exits and the like do not accidentally<br>
> -result in concurrent LLVM API calls.<br>
> -<br>
>  .. _shutdown:<br>
><br>
>  Ending Execution with ``llvm_shutdown()``<br>
>  -----------------------------------------<br>
><br>
>  When you are done using the LLVM APIs, you should call ``llvm_shutdown()`` to<br>
> -deallocate memory used for internal structures.  This will also invoke<br>
> -``llvm_stop_multithreaded()`` if LLVM is operating in multithreaded mode.  As<br>
> -such, ``llvm_shutdown()`` requires the same isolation guarantees as<br>
> -``llvm_stop_multithreaded()``.<br>
> -<br>
> -Note that, if you use scope-based shutdown, you can use the<br>
> -``llvm_shutdown_obj`` class, which calls ``llvm_shutdown()`` in its destructor.<br>
> +deallocate memory used for internal structures.<br>
><br>
>  .. _managedstatic:<br>
><br>
> @@ -2217,15 +2184,11 @@ Lazy Initialization with ``ManagedStatic<br>
>  ------------------------------------------<br>
><br>
>  ``ManagedStatic`` is a utility class in LLVM used to implement static<br>
> -initialization of static resources, such as the global type tables.  Before the<br>
> -invocation of ``llvm_shutdown()``, it implements a simple lazy initialization<br>
> -scheme.  Once ``llvm_start_multithreaded()`` returns, however, it uses<br>
> +initialization of static resources, such as the global type tables.  In a<br>
> +single-threaded environment, it implements a simple lazy initialization scheme.<br>
> +When LLVM is compiled with support for multi-threading, however, it uses<br>
>  double-checked locking to implement thread-safe lazy initialization.<br>
><br>
> -Note that, because no other threads are allowed to issue LLVM API calls before<br>
> -``llvm_start_multithreaded()`` returns, it is possible to have<br>
> -``ManagedStatic``\ s of ``llvm::sys::Mutex``\ s.<br>
> -<br>
>  .. _llvmcontext:<br>
><br>
>  Achieving Isolation with ``LLVMContext``<br>
><br>
> Modified: llvm/trunk/include/llvm-c/Core.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=211900&r1=211899&r2=211900&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=211900&r1=211899&r2=211900&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm-c/Core.h (original)<br>
> +++ llvm/trunk/include/llvm-c/Core.h Fri Jun 27 10:13:01 2014<br>
> @@ -2848,16 +2848,13 @@ void LLVMDisposePassManager(LLVMPassMana<br>
>   * @{<br>
>   */<br>
><br>
> -/** Allocate and initialize structures needed to make LLVM safe for<br>
> -    multithreading. The return value indicates whether multithreaded<br>
> -    initialization succeeded. Must be executed in isolation from all<br>
> -    other LLVM api calls.<br>
> -    @see llvm::llvm_start_multithreaded */<br>
> +/** Deprecated: Multi-threading can only be enabled/disabled with the compile<br>
> +    time define LLVM_ENABLE_THREADS.  This function always returns<br>
> +    LLVMIsMultithreaded(). */<br>
>  LLVMBool LLVMStartMultithreaded(void);<br>
><br>
> -/** Deallocate structures necessary to make LLVM safe for multithreading.<br>
> -    Must be executed in isolation from all other LLVM api calls.<br>
> -    @see llvm::llvm_stop_multithreaded */<br>
> +/** Deprecated: Multi-threading can only be enabled/disabled with the compile<br>
> +    time define LLVM_ENABLE_THREADS. */<br>
>  void LLVMStopMultithreaded(void);<br>
><br>
>  /** Check whether LLVM is executing in thread-safe mode or not.<br>
><br>
> Modified: llvm/trunk/include/llvm/Support/ManagedStatic.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ManagedStatic.h?rev=211900&r1=211899&r2=211900&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ManagedStatic.h?rev=211900&r1=211899&r2=211900&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/Support/ManagedStatic.h (original)<br>
> +++ llvm/trunk/include/llvm/Support/ManagedStatic.h Fri Jun 27 10:13:01 2014<br>
> @@ -103,9 +103,6 @@ void llvm_shutdown();<br>
>  /// llvm_shutdown() when it is destroyed.<br>
>  struct llvm_shutdown_obj {<br>
>    llvm_shutdown_obj() { }<br>
> -  explicit llvm_shutdown_obj(bool multithreaded) {<br>
> -    if (multithreaded) llvm_start_multithreaded();<br>
> -  }<br>
>    ~llvm_shutdown_obj() { llvm_shutdown(); }<br>
>  };<br>
><br>
><br>
> Modified: llvm/trunk/include/llvm/Support/Threading.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Threading.h?rev=211900&r1=211899&r2=211900&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Threading.h?rev=211900&r1=211899&r2=211900&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/Support/Threading.h (original)<br>
> +++ llvm/trunk/include/llvm/Support/Threading.h Fri Jun 27 10:13:01 2014<br>
> @@ -7,7 +7,8 @@<br>
>  //<br>
>  //===----------------------------------------------------------------------===//<br>
>  //<br>
> -// TThis file defines llvm_start_multithreaded() and friends.<br>
> +// This file declares helper functions for running LLVM in a multi-threaded<br>
> +// environment.<br>
>  //<br>
>  //===----------------------------------------------------------------------===//<br>
><br>
> @@ -15,22 +16,8 @@<br>
>  #define LLVM_SUPPORT_THREADING_H<br>
><br>
>  namespace llvm {<br>
> -  /// llvm_start_multithreaded - Allocate and initialize structures needed to<br>
> -  /// make LLVM safe for multithreading.  The return value indicates whether<br>
> -  /// multithreaded initialization succeeded.  LLVM will still be operational<br>
> -  /// on "failed" return, and will still be safe for hosting threading<br>
> -  /// applications in the JIT, but will not be safe for concurrent calls to the<br>
> -  /// LLVM APIs.<br>
> -  /// THIS MUST EXECUTE IN ISOLATION FROM ALL OTHER LLVM API CALLS.<br>
> -  bool llvm_start_multithreaded();<br>
> -<br>
> -  /// llvm_stop_multithreaded - Deallocate structures necessary to make LLVM<br>
> -  /// safe for multithreading.<br>
> -  /// THIS MUST EXECUTE IN ISOLATION FROM ALL OTHER LLVM API CALLS.<br>
> -  void llvm_stop_multithreaded();<br>
> -<br>
> -  /// llvm_is_multithreaded - Check whether LLVM is executing in thread-safe<br>
> -  /// mode or not.<br>
> +  /// Returns true if LLVM is compiled with support for multi-threading, and<br>
> +  /// false otherwise.<br>
>    bool llvm_is_multithreaded();<br>
><br>
>    /// llvm_execute_on_thread - Execute the given \p UserFn on a separate<br>
><br>
> Modified: llvm/trunk/lib/IR/Core.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Core.cpp?rev=211900&r1=211899&r2=211900&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Core.cpp?rev=211900&r1=211899&r2=211900&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/IR/Core.cpp (original)<br>
> +++ llvm/trunk/lib/IR/Core.cpp Fri Jun 27 10:13:01 2014<br>
> @@ -2708,11 +2708,10 @@ void LLVMDisposePassManager(LLVMPassMana<br>
>  /*===-- Threading ------------------------------------------------------===*/<br>
><br>
>  LLVMBool LLVMStartMultithreaded() {<br>
> -  return llvm_start_multithreaded();<br>
> +  return LLVMIsMultithreaded();<br>
>  }<br>
><br>
>  void LLVMStopMultithreaded() {<br>
> -  llvm_stop_multithreaded();<br>
>  }<br>
><br>
>  LLVMBool LLVMIsMultithreaded() {<br>
><br>
> Modified: llvm/trunk/lib/Support/Threading.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Threading.cpp?rev=211900&r1=211899&r2=211900&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Threading.cpp?rev=211900&r1=211899&r2=211900&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Support/Threading.cpp (original)<br>
> +++ llvm/trunk/lib/Support/Threading.cpp Fri Jun 27 10:13:01 2014<br>
> @@ -7,7 +7,8 @@<br>
>  //<br>
>  //===----------------------------------------------------------------------===//<br>
>  //<br>
> -// This file implements llvm_start_multithreaded() and friends.<br>
> +// This file defines helper functions for running LLVM in a multi-threaded<br>
> +// environment.<br>
>  //<br>
>  //===----------------------------------------------------------------------===//<br>
><br>
> @@ -19,38 +20,14 @@<br>
><br>
>  using namespace llvm;<br>
><br>
> -static bool multithreaded_mode = false;<br>
> -<br>
> -bool llvm::llvm_start_multithreaded() {<br>
> +bool llvm::llvm_is_multithreaded() {<br>
>  #if LLVM_ENABLE_THREADS != 0<br>
> -  assert(!multithreaded_mode && "Already multithreaded!");<br>
> -  multithreaded_mode = true;<br>
> -<br>
> -  // We fence here to ensure that all initialization is complete BEFORE we<br>
> -  // return from llvm_start_multithreaded().<br>
> -  sys::MemoryFence();<br>
>    return true;<br>
>  #else<br>
>    return false;<br>
>  #endif<br>
>  }<br>
><br>
> -void llvm::llvm_stop_multithreaded() {<br>
> -#if LLVM_ENABLE_THREADS != 0<br>
> -  assert(multithreaded_mode && "Not currently multithreaded!");<br>
> -<br>
> -  // We fence here to insure that all threaded operations are complete BEFORE we<br>
> -  // return from llvm_stop_multithreaded().<br>
> -  sys::MemoryFence();<br>
> -<br>
> -  multithreaded_mode = false;<br>
> -#endif<br>
> -}<br>
> -<br>
> -bool llvm::llvm_is_multithreaded() {<br>
> -  return multithreaded_mode;<br>
> -}<br>
> -<br>
>  #if LLVM_ENABLE_THREADS != 0 && defined(HAVE_PTHREAD_H)<br>
>  #include <pthread.h><br>
><br>
><br>
> Modified: llvm/trunk/unittests/Support/ManagedStatic.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/ManagedStatic.cpp?rev=211900&r1=211899&r2=211900&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/ManagedStatic.cpp?rev=211900&r1=211899&r2=211900&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/unittests/Support/ManagedStatic.cpp (original)<br>
> +++ llvm/trunk/unittests/Support/ManagedStatic.cpp Fri Jun 27 10:13:01 2014<br>
> @@ -47,7 +47,6 @@ TEST(Initialize, MultipleThreads) {<br>
>    void *p1 = test1::allocate_stack(a1);<br>
>    void *p2 = test1::allocate_stack(a2);<br>
><br>
> -  llvm_start_multithreaded();<br>
>    pthread_t t1, t2;<br>
>    pthread_create(&t1, &a1, test1::helper, nullptr);<br>
>    pthread_create(&t2, &a2, test1::helper, nullptr);<br>
> @@ -55,7 +54,6 @@ TEST(Initialize, MultipleThreads) {<br>
>    pthread_join(t2, nullptr);<br>
>    free(p1);<br>
>    free(p2);<br>
> -  llvm_stop_multithreaded();<br>
>  }<br>
>  #endif<br>
><br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Bruno Cardoso Lopes<br>
<a href="http://www.brunocardoso.cc" target="_blank">http://www.brunocardoso.cc</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Bruno Cardoso Lopes <br><a href="http://www.brunocardoso.cc">http://www.brunocardoso.cc</a></div>
</div>