]> granicus.if.org Git - gc/commitdiff
Fix thread_local_alloc GC_malloc[_atomic] for USE_CUSTOM_SPECIFIC TLS
authorIvan Maidanski <ivmai@mail.ru>
Tue, 15 Nov 2011 10:44:29 +0000 (14:44 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 15 Nov 2011 10:44:29 +0000 (14:44 +0400)
platforms (e.g., Solaris)

* thread_local_alloc.c (GC_malloc, GC_malloc_atomic): Test result of
GC_getspecific() for NULL in all cases except for USE_COMPILER_TLS and
USE_WIN32_COMPILER_TLS (i.e., no-op implementation of GC_getspecific).

thread_local_alloc.c

index 37b5579e81f91a2a28381716aba7d8a221005d93..e208f8b19d55075712a49709c9f423f44875ae2c 100644 (file)
@@ -163,6 +163,8 @@ GC_API void * GC_CALL GC_malloc(size_t bytes)
       tsd = GC_getspecific(k);
 #   else
       tsd = GC_getspecific(GC_thread_key);
+#   endif
+#   if !defined(USE_COMPILER_TLS) && !defined(USE_WIN32_COMPILER_TLS)
       if (EXPECT(0 == tsd, FALSE)) {
         return GC_core_malloc(bytes);
       }
@@ -198,6 +200,8 @@ GC_API void * GC_CALL GC_malloc_atomic(size_t bytes)
       tsd = GC_getspecific(k);
 #   else
       tsd = GC_getspecific(GC_thread_key);
+#   endif
+#   if !defined(USE_COMPILER_TLS) && !defined(USE_WIN32_COMPILER_TLS)
       if (EXPECT(0 == tsd, FALSE)) {
         return GC_core_malloc_atomic(bytes);
       }