[commit: ghc] master: seqDmdType needs to seq the DmdEnv as well (d9db81f)

git at git.haskell.org git at git.haskell.org
Mon Oct 13 13:20:26 UTC 2014


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

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

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

commit d9db81f4ed8ca6e7262f84347174d6b0e2e9a76a
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Mon Oct 13 12:44:56 2014 +0200

    seqDmdType needs to seq the DmdEnv as well
    
    otherwise this can retain large lazy calculations. This fixed one space
    leak pointed out in #9675.


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

d9db81f4ed8ca6e7262f84347174d6b0e2e9a76a
 compiler/basicTypes/Demand.lhs      | 8 ++++++--
 testsuite/tests/perf/compiler/all.T | 6 ++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/compiler/basicTypes/Demand.lhs b/compiler/basicTypes/Demand.lhs
index ed055b5..2aa25ce 100644
--- a/compiler/basicTypes/Demand.lhs
+++ b/compiler/basicTypes/Demand.lhs
@@ -1155,8 +1155,12 @@ ensureArgs n d | n == depth = d
                 -- See [Nature of result demand]
 
 seqDmdType :: DmdType -> ()
-seqDmdType (DmdType _env ds res) = 
-  {- ??? env `seq` -} seqDemandList ds `seq` seqDmdResult res `seq` ()
+seqDmdType (DmdType env ds res) =
+  seqDmdEnv env `seq` seqDemandList ds `seq` seqDmdResult res `seq` ()
+
+seqDmdEnv :: DmdEnv -> ()
+seqDmdEnv env = seqDemandList (varEnvElts env)
+
 
 splitDmdTy :: DmdType -> (Demand, DmdType)
 -- Split off one function argument
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T
index 9ef98ac..ad91b91 100644
--- a/testsuite/tests/perf/compiler/all.T
+++ b/testsuite/tests/perf/compiler/all.T
@@ -496,12 +496,14 @@ test('T9020',
 test('T9675',
      [ only_ways(['optasm']),
        compiler_stats_num_field('max_bytes_used',
-          [(wordsize(64), 29596552, 15),
+          [(wordsize(64), 26570896, 15),
           # 2014-10-13    29596552
+          # 2014-10-13    26570896   seq the DmdEnv in seqDmdType as well
           ]),
        compiler_stats_num_field('peak_megabytes_allocated',
-          [(wordsize(64), 66, 4),
+          [(wordsize(64), 58, 4),
           # 2014-10-13    66
+          # 2014-10-13    58         seq the DmdEnv in seqDmdType as well
           ]),
        compiler_stats_num_field('bytes allocated',
           [(wordsize(64), 544489040, 10)



More information about the ghc-commits mailing list