Commit 8e72a2ee authored by Ben Gamari's avatar Ben Gamari 🐢

Revert "CoreTidy: Don't seq unfoldings"

This reverts commit b3da6a6c as it
reintroduces the original space leak.
parent 43a31683
......@@ -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
{-
......
......@@ -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
]),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment