[Git][ghc/ghc][master] rts: replace ad-hoc MYTASK_USE_TLV with proper CC_SUPPORTS_TLS
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Mon Jun 10 01:03:20 UTC 2024
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
f3017dd3 by Cheng Shao at 2024-06-09T21:02:49-04:00
rts: replace ad-hoc MYTASK_USE_TLV with proper CC_SUPPORTS_TLS
This patch replaces the ad-hoc `MYTASK_USE_TLV` with the
`CC_SUPPORTS_TLS` macro. If TLS support is detected by autoconf, then
we should use that for managing `myTask` in the threaded RTS.
- - - - -
2 changed files:
- rts/Task.c
- rts/Task.h
Changes:
=====================================
rts/Task.c
=====================================
@@ -52,7 +52,7 @@ Mutex all_tasks_mutex;
// A thread-local-storage key that we can use to get access to the
// current thread's Task structure.
#if defined(THREADED_RTS)
-# if defined(MYTASK_USE_TLV)
+# if CC_SUPPORTS_TLS
__thread Task *my_task;
# else
ThreadLocalKey currentTaskKey;
@@ -75,7 +75,7 @@ initTaskManager (void)
peakWorkerCount = 0;
tasksInitialized = 1;
#if defined(THREADED_RTS)
-#if !defined(MYTASK_USE_TLV)
+#if !CC_SUPPORTS_TLS
newThreadLocalKey(¤tTaskKey);
#endif
initMutex(&all_tasks_mutex);
@@ -109,7 +109,7 @@ freeTaskManager (void)
#if defined(THREADED_RTS)
closeMutex(&all_tasks_mutex);
-#if !defined(MYTASK_USE_TLV)
+#if !CC_SUPPORTS_TLS
freeThreadLocalKey(¤tTaskKey);
#endif
#endif
=====================================
rts/Task.h
=====================================
@@ -265,11 +265,7 @@ extern uint32_t peakWorkerCount;
// A thread-local-storage key that we can use to get access to the
// current thread's Task structure.
#if defined(THREADED_RTS)
-#if ((defined(linux_HOST_OS) && \
- (defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH))) || \
- (defined(mingw32_HOST_OS) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 4)) && \
- (!defined(CC_LLVM_BACKEND))
-#define MYTASK_USE_TLV
+#if CC_SUPPORTS_TLS
extern __thread Task *my_task;
#else
extern ThreadLocalKey currentTaskKey;
@@ -287,7 +283,7 @@ extern Task *my_task;
INLINE_HEADER Task *
myTask (void)
{
-#if defined(THREADED_RTS) && !defined(MYTASK_USE_TLV)
+#if defined(THREADED_RTS) && !CC_SUPPORTS_TLS
return (Task*) getThreadLocalVar(¤tTaskKey);
#else
return my_task;
@@ -297,7 +293,7 @@ myTask (void)
INLINE_HEADER void
setMyTask (Task *task)
{
-#if defined(THREADED_RTS) && !defined(MYTASK_USE_TLV)
+#if defined(THREADED_RTS) && !CC_SUPPORTS_TLS
setThreadLocalVar(¤tTaskKey,task);
#else
my_task = task;
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f3017dd3a7e3a2bd8a4f0b9f86268ff403f8f7c6
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f3017dd3a7e3a2bd8a4f0b9f86268ff403f8f7c6
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240609/9d61134f/attachment-0001.html>
More information about the ghc-commits
mailing list