diff options
author | Ben Gamari <ben@smart-cactus.org> | 2017-05-09 16:00:29 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-05-09 17:40:19 -0400 |
commit | 8e72a2eee29543f8a663256f6b8cf4422692cb3a (patch) | |
tree | 0df5808c893c6612a7533eeaff1adea116e0d258 | |
parent | 43a31683acbe2f8120fbb73fe5a6fd1f5de9db80 (diff) | |
download | haskell-8e72a2eee29543f8a663256f6b8cf4422692cb3a.tar.gz |
Revert "CoreTidy: Don't seq unfoldings"
This reverts commit b3da6a6c3546562d5c5e83b8af5d3fd04c07e0c1 as it
reintroduces the original space leak.
-rw-r--r-- | compiler/coreSyn/CoreTidy.hs | 18 | ||||
-rw-r--r-- | testsuite/tests/perf/compiler/all.T | 6 |
2 files changed, 9 insertions, 15 deletions
diff --git a/compiler/coreSyn/CoreTidy.hs b/compiler/coreSyn/CoreTidy.hs index 3578b0b437..89ce692422 100644 --- a/compiler/coreSyn/CoreTidy.hs +++ b/compiler/coreSyn/CoreTidy.hs @@ -15,7 +15,7 @@ module CoreTidy ( #include "HsVersions.h" import CoreSyn -import CoreUnfold ( mkCoreUnfolding ) +import CoreSeq ( seqUnfolding ) import CoreArity import Id import IdInfo @@ -221,21 +221,17 @@ tidyUnfolding tidy_env df@(DFunUnfolding { df_bndrs = bndrs, df_args = args }) _ (tidy_env', bndrs') = tidyBndrs tidy_env bndrs tidyUnfolding tidy_env - (CoreUnfolding { uf_tmpl = unf_rhs, uf_is_top = top_lvl - , uf_src = src, uf_guidance = guidance }) + unf@(CoreUnfolding { uf_tmpl = unf_rhs, uf_src = src }) unf_from_rhs | isStableSource src - = mkCoreUnfolding src top_lvl (tidyExpr tidy_env unf_rhs) guidance - -- Preserves OccInfo - - -- Note that uf_is_value and friends may be a thunk containing a reference - -- to the old template. Consequently it is important that we rebuild them, - -- despite the fact that they won't change, to avoid a space leak (since, - -- e.g., ToIface doesn't look at them; see #13564). This is the same - -- approach we use in Simplify.simplUnfolding and TcIface.tcUnfolding. + = seqIt $ unf { uf_tmpl = tidyExpr tidy_env unf_rhs } -- Preserves OccInfo + -- This seqIt avoids a space leak: otherwise the uf_is_value, + -- uf_is_conlike, ... fields may retain a reference to the + -- pre-tidied expression forever (ToIface doesn't look at them) | otherwise = unf_from_rhs + where seqIt unf = seqUnfolding unf `seq` unf tidyUnfolding _ unf _ = unf -- NoUnfolding or OtherCon {- diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index a5dd1ae64f..4ee88d1b64 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -744,7 +744,7 @@ test('T9020', test('T9675', [ only_ways(['optasm']), compiler_stats_num_field('max_bytes_used', # Note [residency] - [(wordsize(64), 25381032, 15), + [(wordsize(64), 17675240, 15), # 2014-10-13 29596552 # 2014-10-13 26570896 seq the DmdEnv in seqDmdType as well # 2014-10-13 18582472 different machines giving different results.. @@ -755,13 +755,12 @@ test('T9675', # 2016-03-14 38776008 Final demand analyzer run # 2016-04-01 29871032 Fix leaks in demand analysis # 2016-04-30 17675240 Fix leaks in tidy unfoldings - # 2017-05-08 25381032 CoreTidy: Don't seq unfoldings (wordsize(32), 18043224, 15) # 2015-07-11 15341228 (x86/Linux, 64-bit machine) use +RTS -G1 # 2016-04-06 18043224 (x86/Linux, 64-bit machine) ]), compiler_stats_num_field('peak_megabytes_allocated', # Note [residency] - [(wordsize(64), 94, 15), + [(wordsize(64), 63, 15), # 2014-10-13 66 # 2014-10-13 58 seq the DmdEnv in seqDmdType as well # 2014-10-13 49 different machines giving different results... @@ -773,7 +772,6 @@ test('T9675', # 2016-04-14 144 Final demand analyzer run # 2016-07-26 121 Unboxed sums? # 2017-04-30 63 Fix leaks in tidy unfoldings - # 2017-05-08 94 CoreTidy: Don't seq unfoldings (wordsize(32), 56, 15) # 2015-07-11 56 (x86/Linux, 64-bit machine) use +RTS -G1 ]), |