[commit: ghc] master: An overhaul of the SRT representation (eb8e692)

git at git.haskell.org git at git.haskell.org
Wed May 16 12:36:33 UTC 2018


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

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

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

commit eb8e692cab7970c495681e14721d05ecadd21581
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Mon Sep 26 12:07:05 2016 +0100

    An overhaul of the SRT representation
    
    Summary:
    - Previously we would hvae a single big table of pointers per module,
      with a set of bitmaps to reference entries within it. The new
      representation is identical to a static constructor, which is much
      simpler for the GC to traverse, and we get to remove the complicated
      bitmap-traversal code from the GC.
    
    - Rewrite all the code to generate SRTs in CmmBuildInfoTables, and
      document it much better (see Note [SRTs]). This has been something
      I've wanted to do since we moved to the new code generator, I
      finally had the opportunity to finish it while on a transatlantic
      flight recently :)
    
    There are a series of 4 diffs:
    
    1. D4632 (this one), which does the bulk of the changes
    
    2. D4633 which adds support for smaller `CmmLabelDiffOff` constants
    
    3. D4634 which takes advantage of D4632 and D4633 to save a word in
       info tables that have an SRT on x86_64. This is where most of the
       binary size improvement comes from.
    
    4. D4637 which makes a further optimisation to merge some SRTs with
       static FUN closures.  This adds some complexity and the benefits
       are fairly modest, so it's not clear yet whether we should do this.
    
    Results (after (3), on x86_64)
    
    - GHC itself (staticaly linked) is 5.2% smaller
    
    - -1.7% binary sizes in nofib, -2.9% module sizes. Full nofib results: P176
    
    - I measured the overhead of traversing all the static objects in a
      major GC in GHC itself by doing `replicateM_ 1000 performGC` as the
      first thing in `Main.main`.  The new version was 5-10% faster, but
      the results did vary quite a bit.
    
    - I'm not sure if there's a compile-time difference, the results are
      too unreliable.
    
    Test Plan: validate
    
    Reviewers: bgamari, michalt, niteria, simonpj, erikd, osa1
    
    Subscribers: thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D4632


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

eb8e692cab7970c495681e14721d05ecadd21581
 compiler/cmm/CLabel.hs                          |  55 +-
 compiler/cmm/Cmm.hs                             |  14 +-
 compiler/cmm/CmmBuildInfoTables.hs              | 913 ++++++++++++++++--------
 compiler/cmm/CmmInfo.hs                         |   9 +-
 compiler/cmm/CmmParse.y                         |  12 +-
 compiler/cmm/CmmPipeline.hs                     |  21 +-
 compiler/cmm/Hoopl/Dataflow.hs                  |   6 +
 compiler/cmm/PprCmm.hs                          |   2 +-
 compiler/cmm/PprCmmDecl.hs                      |  17 +-
 compiler/codeGen/StgCmmClosure.hs               |  10 +-
 compiler/main/HscMain.hs                        |  20 +-
 compiler/stgSyn/CoreToStg.hs                    |   9 -
 includes/rts/storage/ClosureMacros.h            |   2 +-
 includes/rts/storage/InfoTables.h               |  53 +-
 includes/stg/MiscClosures.h                     |  16 +
 libraries/ghci/GHCi/InfoTable.hsc               |   8 +
 rts/RtsAPI.c                                    |   2 +-
 rts/RtsSymbols.c                                |  16 +
 rts/StgMiscClosures.cmm                         |  55 +-
 rts/sm/Evac.c                                   |   4 +-
 rts/sm/Scav.c                                   | 109 +--
 testsuite/tests/regalloc/regalloc_unit_tests.hs |   2 +-
 22 files changed, 817 insertions(+), 538 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 eb8e692cab7970c495681e14721d05ecadd21581


More information about the ghc-commits mailing list