diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2015-11-17 11:39:29 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2015-11-18 00:46:07 +0300 |
commit | 02528757f439dfc5750e28fb3e5794303ccd21f9 (patch) | |
tree | 565c2ef0a89a0f4bde59b3e65ce92e35e97026e0 | |
parent | 30702c2aa0f57ad3cf89226c8fece53bed3de30f (diff) | |
download | bdwgc-02528757f439dfc5750e28fb3e5794303ccd21f9.tar.gz |
Allow specific TLS attributes for GC_thread_key
* 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.
-rw-r--r-- | doc/README.macros | 3 | ||||
-rw-r--r-- | include/private/thread_local_alloc.h | 10 | ||||
-rw-r--r-- | thread_local_alloc.c | 4 |
3 files changed, 12 insertions, 5 deletions
diff --git a/doc/README.macros b/doc/README.macros index 09dedcf8..c3d27437 100644 --- a/doc/README.macros +++ b/doc/README.macros @@ -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. diff --git a/include/private/thread_local_alloc.h b/include/private/thread_local_alloc.h index d5c5d580..9205bd83 100644 --- a/include/private/thread_local_alloc.h +++ b/include/private/thread_local_alloc.h @@ -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. */ diff --git a/thread_local_alloc.c b/thread_local_alloc.c index 29a337b2..9db324eb 100644 --- a/thread_local_alloc.c +++ b/thread_local_alloc.c @@ -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; |