summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2009-04-03 12:18:16 +0000
committerSimon Marlow <marlowsd@gmail.com>2009-04-03 12:18:16 +0000
commitf9d5c95fb4b4989ce4da8005793d3730452a33a9 (patch)
tree44cb4ca0029ffa322af4c50a0b63b173be28edd2 /rts
parented45b268cba82ed698853b4a1c3d35e904ec020d (diff)
downloadhaskell-f9d5c95fb4b4989ce4da8005793d3730452a33a9.tar.gz
On x86, use thread-local storage instead of stealing a reg for gct
Benchmarks show that using TLS instead of stealing a register is better by a few percent on x86, due to the lack of registers. This only affects -threaded; without -threaded we're (now) using static storage for the GC data.
Diffstat (limited to 'rts')
-rw-r--r--rts/sm/GCThread.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/rts/sm/GCThread.h b/rts/sm/GCThread.h
index c563d95efd..5646eddb51 100644
--- a/rts/sm/GCThread.h
+++ b/rts/sm/GCThread.h
@@ -209,10 +209,15 @@ extern gc_thread **gc_threads;
#define SET_GCT(to) gct = (to)
-#if defined(sparc_HOST_ARCH)
+#if defined(sparc_HOST_ARCH) || defined(i386_HOST_ARCH)
// Don't use REG_base or R1 for gct on SPARC because they're getting clobbered
// by something else. Not sure what yet. -- BL 2009/01/03
+// Using __thread is better than stealing a register on x86, because
+// we have too few registers available. In my tests it was worth
+// about 5% in GC performance, but of course that might change as gcc
+// improves. -- SDM 2009/04/03
+
extern __thread gc_thread* gct;
#define DECLARE_GCT __thread gc_thread* gct;