[commit: ghc] master: Improve accuracy of get/setAllocationCounter (20cbb01)

git at git.haskell.org git at git.haskell.org
Mon Mar 19 16:39:55 UTC 2018


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

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

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

commit 20cbb0165e4d18df510e707791e761942d3c10f0
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Mon Mar 19 12:02:43 2018 -0400

    Improve accuracy of get/setAllocationCounter
    
    Summary:
    get/setAllocationCounter didn't take into account allocations in the
    current block. This was known at the time, but it turns out to be
    important to have more accuracy when using these in a fine-grained
    way.
    
    Test Plan:
    New unit test to test incrementally larger allocaitons.  Before I got
    results like this:
    
    ```
    +0
    +0
    +0
    +0
    +0
    +4096
    +0
    +0
    +0
    +0
    +0
    +4064
    +0
    +0
    +4088
    +4056
    +0
    +0
    +0
    +4088
    +4096
    +4056
    +4096
    ```
    
    Notice how the results aren't always monotonically increasing.  After
    this patch:
    
    ```
    +344
    +416
    +488
    +560
    +632
    +704
    +776
    +848
    +920
    +992
    +1064
    +1136
    +1208
    +1280
    +1352
    +1424
    +1496
    +1568
    +1640
    +1712
    +1784
    +1856
    +1928
    +2000
    +2072
    +2144
    ```
    
    Reviewers: hvr, erikd, simonmar, jrtc27, trommler
    
    Reviewed By: simonmar
    
    Subscribers: trommler, jrtc27, rwbarton, thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D4363


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

20cbb0165e4d18df510e707791e761942d3c10f0
 compiler/codeGen/StgCmmForeign.hs                   |  4 ++--
 compiler/prelude/primops.txt.pp                     | 14 ++++++++++++++
 includes/Cmm.h                                      |  2 ++
 includes/rts/Threads.h                              |  2 --
 includes/stg/MiscClosures.h                         |  3 +++
 libraries/base/GHC/Conc/Sync.hs                     | 21 +++++----------------
 rts/PrimOps.cmm                                     | 20 ++++++++++++++++++++
 rts/RtsSymbols.c                                    |  4 ++--
 rts/Threads.c                                       | 13 +------------
 testsuite/tests/rts/all.T                           |  6 ++++++
 testsuite/tests/rts/alloccounter1.hs                | 19 +++++++++++++++++++
 .../tests/rts/alloccounter1.stdout                  |  0
 12 files changed, 74 insertions(+), 34 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 20cbb0165e4d18df510e707791e761942d3c10f0


More information about the ghc-commits mailing list