summaryrefslogtreecommitdiff
path: root/rts/sm
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2013-01-17 16:42:38 +0000
committerSimon Marlow <marlowsd@gmail.com>2013-01-17 20:30:01 +0000
commit0dcccf0ca650a3f6fd69e4af428e827b718f0b4b (patch)
tree619f13bbb52acb78a403ffff155d15e56abf1674 /rts/sm
parent81f4cd3e08996d35b3a70dfee4d70a829f2f2622 (diff)
downloadhaskell-0dcccf0ca650a3f6fd69e4af428e827b718f0b4b.tar.gz
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.
Diffstat (limited to 'rts/sm')
-rw-r--r--rts/sm/GCTDecl.h2
-rw-r--r--rts/sm/GCThread.h4
-rw-r--r--rts/sm/Storage.c7
3 files changed, 12 insertions, 1 deletions
diff --git a/rts/sm/GCTDecl.h b/rts/sm/GCTDecl.h
index f9c8fcb137..6eb6cc2e8b 100644
--- a/rts/sm/GCTDecl.h
+++ b/rts/sm/GCTDecl.h
@@ -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
diff --git a/rts/sm/GCThread.h b/rts/sm/GCThread.h
index 7d163cb48a..59327bc20b 100644
--- a/rts/sm/GCThread.h
+++ b/rts/sm/GCThread.h
@@ -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
diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c
index ff4f172ac5..518ae0d0c8 100644
--- a/rts/sm/Storage.c
+++ b/rts/sm/Storage.c
@@ -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();
}