From 6015a94f9108a502150565577b66c23650796639 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Fri, 27 Jul 2007 10:41:57 +0000 Subject: Pointer Tagging This patch implements pointer tagging as per our ICFP'07 paper "Faster laziness using dynamic pointer tagging". It improves performance by 10-15% for most workloads, including GHC itself. The original patches were by Alexey Rodriguez Yakushev , with additions and improvements by me. I've re-recorded the development as a single patch. The basic idea is this: we use the low 2 bits of a pointer to a heap object (3 bits on a 64-bit architecture) to encode some information about the object pointed to. For a constructor, we encode the "tag" of the constructor (e.g. True vs. False), for a function closure its arity. This enables some decisions to be made without dereferencing the pointer, which speeds up some common operations. In particular it enables us to avoid costly indirect jumps in many cases. More information in the commentary: http://hackage.haskell.org/trac/ghc/wiki/Commentary/Rts/HaskellExecution/PointerTagging --- rts/Sparks.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'rts/Sparks.c') diff --git a/rts/Sparks.c b/rts/Sparks.c index ca60e1338c..0ff4ee4cce 100644 --- a/rts/Sparks.c +++ b/rts/Sparks.c @@ -200,6 +200,12 @@ newSpark (StgRegTable *reg, StgClosure *p) { StgSparkPool *pool = &(reg->rSparks); + /* I am not sure whether this is the right thing to do. + * Maybe it is better to exploit the tag information + * instead of throwing it away? + */ + p = UNTAG_CLOSURE(p); + ASSERT_SPARK_POOL_INVARIANTS(pool); if (closure_SHOULD_SPARK(p)) { -- cgit v1.2.1