[commit: ghc] master: Add SmallArray# and SmallMutableArray# types (90329b6)

git at git.haskell.org git at git.haskell.org
Sat Mar 29 10:24:57 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/90329b6cc183b3cd05956ae6bdeb6ac6951549c2/ghc

>---------------------------------------------------------------

commit 90329b6cc183b3cd05956ae6bdeb6ac6951549c2
Author: Johan Tibell <johan.tibell at gmail.com>
Date:   Sun Mar 23 12:06:56 2014 +0100

    Add SmallArray# and SmallMutableArray# types
    
    These array types are smaller than Array# and MutableArray# and are
    faster when the array size is small, as they don't have the overhead
    of a card table. Having no card table reduces the closure size with 2
    words in the typical small array case and leads to less work when
    updating or GC:ing the array.
    
    Reduces both the runtime and memory allocation by 8.8% on my insert
    benchmark for the HashMap type in the unordered-containers package,
    which makes use of lots of small arrays. With tuned GC settings
    (i.e. `+RTS -A6M`) the runtime reduction is 15%.
    
    Fixes #8923.


>---------------------------------------------------------------

90329b6cc183b3cd05956ae6bdeb6ac6951549c2
 compiler/cmm/CLabel.hs                             |    9 +-
 compiler/cmm/CmmParse.y                            |    2 +-
 compiler/cmm/SMRep.lhs                             |   57 +++++--
 compiler/codeGen/StgCmmBind.hs                     |    8 +-
 compiler/codeGen/StgCmmCon.hs                      |    4 +-
 compiler/codeGen/StgCmmForeign.hs                  |    5 +-
 compiler/codeGen/StgCmmLayout.hs                   |    2 +-
 compiler/codeGen/StgCmmPrim.hs                     |  168 ++++++++++++++++----
 compiler/ghci/ByteCodeGen.lhs                      |    5 +
 compiler/ghci/RtClosureInspect.hs                  |    2 +
 compiler/prelude/PrelNames.lhs                     |    6 +-
 compiler/prelude/TysPrim.lhs                       |   17 +-
 compiler/prelude/primops.txt.pp                    |  156 +++++++++++++++++-
 includes/Cmm.h                                     |   33 ++++
 includes/rts/storage/ClosureMacros.h               |    9 ++
 includes/rts/storage/ClosureTypes.h                |    6 +-
 includes/rts/storage/Closures.h                    |    6 +
 includes/stg/MiscClosures.h                        |   14 ++
 rts/CheckUnload.c                                  |    8 +
 rts/ClosureFlags.c                                 |    8 +-
 rts/LdvProfile.c                                   |    4 +
 rts/Linker.c                                       |    9 ++
 rts/PrimOps.cmm                                    |  118 ++++++++++++++
 rts/Printer.c                                      |   15 ++
 rts/ProfHeap.c                                     |    8 +
 rts/RetainerProfile.c                              |   12 ++
 rts/StgMiscClosures.cmm                            |   12 ++
 rts/sm/Compact.c                                   |   31 ++++
 rts/sm/Evac.c                                      |    8 +
 rts/sm/Scav.c                                      |  148 +++++++++++++++++
 .../should_run/{cgrun064.hs => CopySmallArray.hs}  |   42 ++---
 .../{cgrun064.stdout => CopySmallArray.stdout}     |    0
 .../{cgrun068.hs => CopySmallArrayStressTest.hs}   |   32 ++--
 ...n068.stdout => CopySmallArrayStressTest.stdout} |    0
 .../{cgrun065.hs => SizeOfSmallArray.hs}           |   11 +-
 .../{cgrun065.stdout => SizeOfSmallArray.stdout}   |    0
 testsuite/tests/codeGen/should_run/all.T           |    3 +
 utils/deriveConstants/DeriveConstants.hs           |    3 +
 utils/genprimopcode/Main.hs                        |    3 +
 39 files changed, 880 insertions(+), 104 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 90329b6cc183b3cd05956ae6bdeb6ac6951549c2


More information about the ghc-commits mailing list