Commit 0dcccf0c authored by Simon Marlow's avatar Simon Marlow

Hopefully fix breakage on OS X w/ LLVM

Reordering of includes in GC.c broke on OS X because gctKey is
declared in Task.h and is needed in the storage manager.  This is
really the wrong place for it anyway, so I've moved the gctKey pieces
to where they should be.
parent 81f4cd3e
......@@ -54,9 +54,6 @@ __thread Task *my_task;
# else
ThreadLocalKey currentTaskKey;
# endif
#ifdef llvm_CC_FLAVOR
ThreadLocalKey gctKey;
#endif
#else
Task *my_task;
#endif
......@@ -77,9 +74,6 @@ initTaskManager (void)
#if defined(THREADED_RTS)
#if !defined(MYTASK_USE_TLV)
newThreadLocalKey(&currentTaskKey);
#endif
#if defined(llvm_CC_FLAVOR)
newThreadLocalKey(&gctKey);
#endif
initMutex(&all_tasks_mutex);
#endif
......@@ -115,9 +109,6 @@ freeTaskManager (void)
#if !defined(MYTASK_USE_TLV)
freeThreadLocalKey(&currentTaskKey);
#endif
#if defined(llvm_CC_FLAVOR)
freeThreadLocalKey(&gctKey);
#endif
#endif
tasksInitialized = 0;
......
......@@ -238,12 +238,6 @@ extern __thread Task *my_task;
#else
extern ThreadLocalKey currentTaskKey;
#endif
// LLVM-based compilers do not upport the __thread attribute, so we need
// to store the gct variable as a pthread local storage. We declare the
// key here to keep thread local storage initialization in the same place.
#if defined(llvm_CC_FLAVOR)
extern ThreadLocalKey gctKey;
#endif
#else
extern Task *my_task;
#endif
......
......@@ -52,7 +52,7 @@ extern __thread gc_thread* gct;
// with a C compiler that uses an LLVM back end (clang or llvm-gcc) then we
// use pthread_getspecific() to handle the thread local storage for gct.
#define gct ((gc_thread *)(pthread_getspecific(gctKey)))
#define DECLARE_GCT /* nothing */
#define DECLARE_GCT ThreadLocalKey gctKey;
#elif defined(sparc_HOST_ARCH)
// On SPARC we can't pin gct to a register. Names like %l1 are just offsets
......
......@@ -204,6 +204,10 @@ extern nat n_gc_threads;
extern gc_thread **gc_threads;
#if defined(THREADED_RTS) && defined(llvm_CC_FLAVOR)
extern ThreadLocalKey gctKey;
#endif
#include "EndPrivate.h"
#endif // SM_GCTHREAD_H
......
......@@ -229,6 +229,10 @@ void storageAddCapabilities (nat from, nat to)
}
}
#if defined(THREADED_RTS) && defined(llvm_CC_FLAVOR)
newThreadLocalKey(&gctKey);
#endif
initGcThreads(from, to);
}
......@@ -249,6 +253,9 @@ freeStorage (rtsBool free_heap)
closeMutex(&sm_mutex);
#endif
stgFree(nurseries);
#if defined(THREADED_RTS) && defined(llvm_CC_FLAVOR)
freeThreadLocalKey(&gctKey);
#endif
freeGcThreads();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment