]> granicus.if.org Git - gc/commitdiff
Allow specific TLS attributes for GC_thread_key
authorIvan Maidanski <ivmai@mail.ru>
Tue, 17 Nov 2015 08:39:29 +0000 (11:39 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 17 Nov 2015 21:46:07 +0000 (00:46 +0300)
* doc/README.macros (GC_ATTR_TLS_FAST): Document.
* include/private/thread_local_alloc.h (GC_ATTR_TLS_FAST): New macro
(empty by default).
* include/private/thread_local_alloc.h (GC_thread_key): Use
GC_ATTR_TLS_FAST.
* thread_local_alloc.c (GC_thread_key): Likewise.

doc/README.macros
include/private/thread_local_alloc.h
thread_local_alloc.c

index 09dedcf865978ee567f29240b9d38197b0d7e3f9..c3d27437cb6fe1556b4ce4c29aaea5de9090c75a 100644 (file)
@@ -394,6 +394,9 @@ USE_COMPILER_TLS        Causes thread local allocation to use
   default in HP/UX.  It may help performance on recent Linux installations.
   (It failed for me on RedHat 8, but appears to work on RedHat 9.)
 
+GC_ATTR_TLS_FAST        Use specific attributes for GC_thread_key like
+  __attribute__((tls_model("local-exec"))).
+
 PARALLEL_MARK   Allows the marker to run in multiple threads.  Recommended
   for multiprocessors.
 
index d5c5d5800d39b05267b0a3f0284a5d52c614f2ee..9205bd838fdf0fc2cf615dbeadd8f42178ac5855 100644 (file)
@@ -162,13 +162,17 @@ GC_INNER void GC_mark_thread_local_fls_for(GC_tlfs p);
   GC_EXTERN ptr_t * GC_finalized_objfreelist;
 #endif
 
+#ifndef GC_ATTR_TLS_FAST
+# define GC_ATTR_TLS_FAST /* empty */
+#endif
+
 extern
 #if defined(USE_COMPILER_TLS)
-  __thread
+  __thread GC_ATTR_TLS_FAST
 #elif defined(USE_WIN32_COMPILER_TLS)
-  __declspec(thread)
+  __declspec(thread) GC_ATTR_TLS_FAST
 #endif
-GC_key_t GC_thread_key;
+  GC_key_t GC_thread_key;
 /* This is set up by the thread_local_alloc implementation.  No need    */
 /* for cleanup on thread exit.  But the thread support layer makes sure */
 /* that GC_thread_key is traced, if necessary.                          */
index 29a337b2773c737b75e8e8c9b374cb6968b0d4ce..9db324ebb33db2621e439e39967ef8b152f1dc1f 100644 (file)
@@ -24,9 +24,9 @@
 #include <stdlib.h>
 
 #if defined(USE_COMPILER_TLS)
-  __thread
+  __thread GC_ATTR_TLS_FAST
 #elif defined(USE_WIN32_COMPILER_TLS)
-  __declspec(thread)
+  __declspec(thread) GC_ATTR_TLS_FAST
 #endif
 GC_key_t GC_thread_key;