Pointer Tagging
authorSimon Marlow <simonmar@microsoft.com>
Fri, 27 Jul 2007 10:41:57 +0000 (10:41 +0000)
committerSimon Marlow <simonmar@microsoft.com>
Fri, 27 Jul 2007 10:41:57 +0000 (10:41 +0000)
commit6015a94f9108a502150565577b66c23650796639
tree20d499d1a9644c2c98374d99f511a4a1c2cb7d1d
parent04d444716b2e5415fb8f13771e49f1192ef8c8f8
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
<mrchebas@gmail.com>, 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
39 files changed:
compiler/cmm/CmmLint.hs
compiler/cmm/PprC.hs
compiler/codeGen/CgBindery.lhs
compiler/codeGen/CgClosure.lhs
compiler/codeGen/CgCon.lhs
compiler/codeGen/CgHeapery.lhs
compiler/codeGen/CgInfoTbls.hs
compiler/codeGen/CgPrimOp.hs
compiler/codeGen/CgProf.hs
compiler/codeGen/CgTailCall.lhs
compiler/codeGen/CgUtils.hs
compiler/codeGen/ClosureInfo.lhs
compiler/main/Constants.lhs
compiler/nativeGen/MachCodeGen.hs
includes/Closures.h
includes/Cmm.h
includes/InfoTables.h
includes/MachDeps.h
includes/Rts.h
includes/Storage.h
includes/mkDerivedConstants.c
rts/Apply.cmm
rts/HeapStackCheck.cmm
rts/Interpreter.c
rts/PrimOps.cmm
rts/RetainerProfile.c
rts/RtsAPI.c
rts/Sanity.c
rts/Sparks.c
rts/Stable.c
rts/Stats.c
rts/StgMiscClosures.cmm
rts/StgStartup.cmm
rts/StgStdThunks.cmm
rts/sm/Compact.c
rts/sm/Evac.c
rts/sm/GC.c
rts/sm/Scav.c
utils/genapply/GenApply.hs