[PATCH] [libcxxabi] On single threaded systems, turn mutexes into nops

kledzik at apple.com kledzik at apple.com
Mon May 5 16:12:50 PDT 2014


================
Comment at: src/cxa_exception_storage.cpp:48
@@ +47,3 @@
+#if LIBCXXABI_SINGLE_THREADED
+    __cxa_eh_globals * eh_globals_ = NULL;
+#else
----------------
Why is eh_globals_ being allocated with calloc() in the single threaded case?

This would be much simpler to have a block (like the #if HAS_THREAD_LOCAL) that just has:

  #elif LIBCXXABI_SINGLE_THREADED
     static __cxa_eh_globals eh_globals;
     __cxa_eh_globals *_cxa_get_globals() { return &eh_globals; }
     __cxa_eh_globals *_cxa_get_globals_fast() { return &eh_globals; }
   #else

and the rest of the file stays the same.

http://reviews.llvm.org/D3386






More information about the cfe-commits mailing list